Beispiel #1
0
 private void tmrHeroBullet_Tick(object sender, EventArgs e)
 {
     if (bullet.image.Visible == true)
     {
         bullet.move();
         for (int i = 0; i < walls.Length; i++)
         {
             if (bullet.isColliding(walls[i]))
             {
                 bullet.image.Visible = false;
             }
         }
         for (int i = 0; i < planets.Length; i++)
         {
             if (planets[i].image.Visible == true)
             {
                 if (bullet.isColliding(planets[i]))
                 {
                     axWindowsMediaPlayer1.URL = directory + SOUND_PLANET_EXPLODE;
                     axWindowsMediaPlayer1.Ctlcontrols.play();
                     planets[i].image.Visible = false;
                     bullet.image.Visible     = false;
                 }
             }
         }
         for (int i = 0; i < enemies.Length; i++)
         {
             if (enemies[i].image.Visible == true)
             {
                 if (bullet.isColliding(enemies[i]))
                 {
                     axWindowsMediaPlayer1.URL = directory + SOUND_ENEMY_EXPLODE;
                     axWindowsMediaPlayer1.Ctlcontrols.play();
                     enemies[i].image.Visible = false;
                     bullet.image.Visible     = false;
                 }
             }
         }
         bullet.redraw();
     }
 }
Beispiel #2
0
 private void tmrHero_Tick(object sender, EventArgs e)
 {
     hero.move();
     for (int i = 0; i < walls.Length; i++)
     {
         if (hero.isColliding(walls[i]))
         {
             hero.stickTo(walls[i]);
         }
     }
     hero.redraw();
 }