Exemplo n.º 1
0
 //Animation. Анімація
 public void ChangeSprite()
 {
     if (dead)
     {
         form.tmr_animation.Interval = 270;
         currentSprite = pacmanSprites[16 + deadSpriteLoop];
         deadSpriteLoop++;
         if (deadSpriteLoop > 11)
         {
             form.tmr_animation.Stop();
             form.tmr_animation.Interval = 33;
             deadSpriteLoop = 0;
             lives--;
             if (lives == 0)
             {
                 form.GameOver();
             }
             else
             {
                 form.Restart();
             }
         }
     }
     else if (moving)
     {
         currentSprite = pacmanSprites[direction * 4 + spriteLoop];
         spriteLoop++;
         if (spriteLoop > 3)
         {
             spriteLoop = 0;
         }
     }
 }