Exemplo n.º 1
0
 public override void DetectEnemyHit(MovingObject mob)
 {
     //dont kill friends
     if (mob.Type == this.Type)
         return;
     //collision with enemy detected
     if(Position.Y > mob.Position.Y)
     {
         //enemy is above, cant kill
         return;
     }
     mob.Die();
 }
Exemplo n.º 2
0
 public override void DetectEnemyHit(MovingObject mob)
 {
     //collision with enemy detected
     if (Position.Y < mob.Position.Y - mob.Height / 10)
     {
         //hit enemy from above
         mob.Die();
         Score += 100;
         //bounce off of enemy
         CanJump = true;
         Jump();
     }
     else
     {
         Die();
     }
 }