public void moveDown() { point.y -= dimensions.height; point.z += 0.75f; if (bubble != null) { bubble.setPosition(point); } }
public static void snapToGrid(Bubble b) { bool found = false; GridSquare best; best = grid[0, 0]; for (int j = 0; j <= grid.GetUpperBound(1); j++) { for (int i = 0; i <= grid.GetUpperBound(0); i++) { if (grid[i, j].enoughToSnap(b.getPosition()) && grid[i, j].bubble == null) { best = grid[i, j]; found = true; break; } else if (grid[i, j].bubble == null && getSnappingScore(b, grid[i, j]) < getSnappingScore(b, best)) { best = grid[i, j]; } } if (found) { break; } } b.setPosition(new Point(best.point)); best.bubble = b; popped = new List <Bubble>(); stuckToWall = new List <Bubble>(); checkPopping(best); if (popped.Count > 2) { popBubbles(); droppingBubbles = new List <Bubble>(); checkDropping(grid[0, 0]); checkDropping(grid[1, 0]); checkDropping(grid[2, 0]); checkDropping(grid[3, 0]); checkDropping(grid[4, 0]); checkDropping(grid[5, 0]); checkDropping(grid[6, 0]); checkDropping(grid[7, 0]); getRemainingBubbles(); dropBubbles(); } }
public static void snapToGrid(Bubble b) { bool found = false; GridSquare best; best = grid[0, 0]; for (int j = 0; j <= grid.GetUpperBound(1); j++) { for (int i = 0; i <= grid.GetUpperBound(0); i++) { if (grid[i, j].enoughToSnap(b.getPosition())) { best = grid[i,j]; found = true; break; } else if(grid[i,j].bubble !=null && getSnappingScore(b, grid[i,j]) < getSnappingScore(b, best)) { best = grid[i, j]; } } if (found) { break; } } b.setPosition(new Point(best.point)); best.bubble = b; popped = new List<Bubble>(); checkPopping(best); if (popped.Count > 2) { popBubbles(); } }