示例#1
0
 private static void AddBullet(ActorEnemy enemy)
 {
     if (enemy != null && enemy.ShotCoolDown <= 0)
     {
         var shot = new ActorBullet();
         shot.SrcRect = new Rectangle(497, 2, 9, 33);
         shot.Location.X = enemy.Location.X
             + enemy.SrcRect.Width / 2
             - shot.SrcRect.Width / 2;
         shot.Location.Y = enemy.Location.Y
             + enemy.SrcRect.Height
             - shot.SrcRect.Height;
         shot.Speed.Y = 200.0f;
         _bullets.Add(shot);
         enemy.ShotCoolDown = enemy.SecondsBetweenShots;
     }
 }
示例#2
0
 private static void AddBullet(ActorPlayer player)
 {
     if (player != null && player.ShotCoolDown <= 0)
     {
         var shot = new ActorBullet();
         shot.SrcRect = new Rectangle(497, 37, 9, 33);
         shot.Location.X = player.Location.X
             + player.SrcRect.Width / 2
             - shot.SrcRect.Width / 2;
         shot.Location.Y = player.Location.Y;
         shot.Speed.Y = -200.0f;
         _bullets.Add(shot);
         player.ShotCoolDown = player.SecondsBetweenShots;
     }
 }