コード例 #1
0
ファイル: AppMain.cs プロジェクト: skyvalve/Nebilu
        private static void HandleAliens()
        {
            // Alien counter.
            alienTimeCounter += TimeDelta;
            // Generating if statement.
            if(alienTimeCounter > 2400){
                alienTimeCounter -= 2400;
                int offset = rand.Next(-200, 201);
                int speed;
                speed = rand.Next(2, 5);

                AlienShip m = new AlienShip(graphics, graphics.Screen.Rectangle.Width + 50,
                                  graphics.Screen.Rectangle.Height / 2 +offset, speed);
                Alienator.Add(m);
            }
            // foreach statement.
            foreach(AlienShip m in Alienator){
                m.Update();
            }

            for(int i = Alienator.Count-1; i >= 0; i--){
                // Loop to substract.
                if(Alienator[i].X < -100){
                    Alienator.RemoveAt(i);
                }
            }
        }
コード例 #2
0
ファイル: AppMain.cs プロジェクト: skyvalve/Nebilu
 public static void NewGame()
 {
     // HUD.cs initializing.
     hud = new HUD(graphics);
     // Hero ship initializer.
     Hero = new HeroShip(graphics);
     // List Alien ships.
     Alienator = new List<AlienShip>();
     // A connected variables for each alien ships.
     AlienShip m;
     // Here add enemy ships.
     m = new AlienShip(graphics, graphics.Screen.Rectangle.Width - 100,
                   graphics.Screen.Rectangle.Height / 2, 4);
     Alienator.Add(m);
     m = new AlienShip(graphics, graphics.Screen.Rectangle.Width - 150,
                   graphics.Screen.Rectangle.Height / 2 + 150, 2);
     Alienator.Add(m);
     m = new AlienShip(graphics, graphics.Screen.Rectangle.Width - 50,
                   graphics.Screen.Rectangle.Height / 2 - 100, 6);
     Alienator.Add(m);
     m = new AlienShip(graphics, graphics.Screen.Rectangle.Width - 50,
                   graphics.Screen.Rectangle.Height / 2 - 200, 5);
     Alienator.Add(m);
     // Alien generating.
     alienTimeCounter = 0;
     // Missile generating.
     missile = new List<Projectile>();
     // Shot timer.
     ShotTimer = 0;
     // Explosion here.
     Explosions = new List<explosion>();
 }