/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (DishBreaker game = new DishBreaker()) { game.Run(); } }
public void Update(DishBreaker game) { if (count > 120 && !Burst) { if (person) { if(blast) game.collision++; person = false; blast = false; } do { t = rand.Next(0, 4); } while (((!dir) && (t == game.position[1])) || (dir && (t == game.position[0]))); if (dir) { game.position[1] = t; } else { game.position[0] = t; } t = rand.Next(0, 3); PlatePosition = game.windowPosition[t]; count = 0; } if (fall) { if (fallcount > t2) { t1 = rand.Next(1, 2); t2 = (t + 1) * rand.Next(1, 2); fallcount = 0; person = true; } do { t = rand.Next(0, 4); }while (((!dir) && (t == game.position[1])) || (dir && (t == game.position[0]))); if (dir) { game.position[1] = t; } else { game.position[0] = t; } PlatePosition = game.windowPosition[t]; fall = false; count = 0; fallcount++; } if (Burst) { if (!person) { PlateSpeed.X = 0; PlateSpeed.Y = 10; PlatePosition += PlateSpeed; if (PlatePosition.Y > game.GraphicsDevice.Viewport.Height) { fall = true; Burst = false; } return; } else { blast = true; Burst = false; } } count++; if (PlateContains(game.PinVector_r) || PlateContains(game.PinVector_l)) { if (!person) { PlatePopSound.Play(); game.score += 10; } Burst = true; return; } }
public void Draw(DishBreaker game) { if(game.collision > 2) game.spriteBatch.Draw(GameOverTexture,gameoverPosition, Color.White); else if (blast) game.spriteBatch.Draw(BlastTexture, PlatePosition, Color.White); else if (Burst) game.spriteBatch.Draw(FallTexture, PlatePosition, Color.White); else if (person) game.spriteBatch.Draw(personTexture, PlatePosition, Color.White); else game.spriteBatch.Draw(PlateTexture, PlatePosition, Color.White); }