Example #1
0
 void UpdatePlayerCollision(Player p, Enemy e)
 {
     if (IsPlayerColliding(p, e))
     {
         e.SetEnemyVelocity(-1f * e.GetEnemyVelocity());
     }
 }
Example #2
0
 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; 
 }
Example #3
0
 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);
 }
Example #4
0
 private bool IsPlayerColliding(Player p, Enemy e)
 {
     if (p.GetPlayerPosition() == e.GetEnemyPosition()) return true;
     else return false;
 }