public GameState Update(GameTime gameTime) { // Remove Old Stuff on Screen if didnt explode for (int i = 0; i < projectiles.Count; i++) { if (projectiles[i].IsActive == false) { projectiles.RemoveAt(i); } } for (int i = 0; i < meteors.Count; i++) { if (meteors[i].IsActive == false) { meteors.RemoveAt(i); } } // Add Meteors if its time if (spawner.UpdateTimer(gameTime)) { meteors.Add(new Meteor(rng, (int)player.ScreenBorder.X, (int)player.ScreenBorder.Y)); if (meteors[meteors.Count - 1].Size == Size.Small) { meteors[meteors.Count - 1].DefaultSprite = meteorSprites[0]; } else if (meteors[meteors.Count - 1].Size == Size.Medium) { meteors[meteors.Count - 1].DefaultSprite = meteorSprites[1]; } else { meteors[meteors.Count - 1].DefaultSprite = meteorSprites[2]; } } // Player Movement player.Update(gameTime); // Player Extension and Adds Proj to list if needed if (player.FireProjectile()) { foreach (Projectiles p in player.ProjectilesToAdd) { Projectiles tempProj = p; tempProj.DefaultSprite = projectileSprite; projectiles.Add(tempProj); } } // Update Projectiles if Any foreach (Projectiles p in projectiles) { p.Update(); } foreach (Meteor m in meteors) { m.Update(); } foreach (Projectiles p in projectiles) { foreach (Meteor m in meteors) { if (m.Spritebox.Intersects(p.Hitbox) && m.IsActive && ComplementsCheck(p, m)) { m.IsActive = false; p.IsActive = false; player.PlayerScore += (m.PointVaue * player.Multiplier); break; } } } foreach (Meteor m in meteors) { if (m.Spritebox.Intersects(player.Hitbox) && m.IsActive) { m.IsActive = false; if (player.IsInvincible) { player.PlayerScore += (m.PointVaue * player.Multiplier); } else { player.Playerstate = PlayerState.die; break; } } } if (uI.Update(player, gameTime)) { return(GameState.gameover); } scrollingBackground.Update(1, scrollSpeed, gameTime); if (player.Playerstate == PlayerState.die) { return(GameState.gameover); } return(GameState.play); }