public void Init() { MapController.Asteroids.Clear(); player = new Player(300, 400, spritesheet); asteroidToSpawn = 2f; MapController.AddAsteroid(); }
private void UpdateCallback(object sender, EventArgs e) { if (AsteroidsController.Collide(player)) { Init(); } if (asteroidToSpawn > 0) { asteroidToSpawn -= (float)timer1.Interval / 300; } if (asteroidToSpawn <= 0) { MapController.AddAsteroid(); asteroidToSpawn = 2f; } if (player.isMoving) { player.Move(); } for (int i = 0; i < MapController.Asteroids.Count; i++) { MapController.Asteroids[i].Move(); } Invalidate(); }