void UpdatePlayerCollision(Player p, Enemy e) { if (IsPlayerColliding(p, e)) { e.SetEnemyVelocity(-1f * e.GetEnemyVelocity()); } }
public void UpdateEnemyShooting(int Time, Player p) { bool AllowShooting = false; if(Time - LastUpdateTime >= this.GetRandomTime()) // have the enemys shoot evry random amount of Updates { this.IsShooting = true; } LastUpdateTime = Time; }
public Game(ref Graphics G, int GameSizeX, int GameSizeY) { this.g = G; Game.IH = new InputHandler(); IH.UpdateMousePosition(); I = Input.No; this.Enemies = new List<Enemy>(); this.PlayerBullets = new List<Bullet>(); this.EnemyBullets = new List<Bullet>(); this.GameSizeX = GameSizeX; this.GameSizeY = GameSizeY; this.BulletSpeed = 2; this.PlayerSpeed = 5; P = new Player(IH.GetMousePostion(), this.PlayerSpeed); }
private bool IsPlayerColliding(Player p, Enemy e) { if (p.GetPlayerPosition() == e.GetEnemyPosition()) return true; else return false; }