Beispiel #1
0
 public void EnableAutoPilot(Mobile Enemy)
 {
     this.Control = false;
     this.AutoPilot = true;
     this.Enemy = Enemy;
 }
Beispiel #2
0
        public void Reset(GameMode gameMode)
        {
            this.CurrentGameMode = gameMode;
            this.Window.Title = "Planes Game Muhammad Al-Syrwan ( MhdSyrwan.wordpress.com )";
            graphics.GraphicsDevice.Reset();
            EndTimeOut = -1;
            if (Plane != null || EnemyPlane != null)
            {
                this.Components.Remove(Plane);
                this.Components.Remove(EnemyPlane);
            }

            Plane = new Mobile(this, myTexture, Vector2.One * 100, 0.0f, 1);
            EnemyPlane = new Mobile(this, Enemy, Vector2.Zero, 0.0f, 1);

            Plane.FireKey = Keys.RightControl;
            EnemyPlane.FireKey = Keys.LeftControl;

            // Relatives and Collisions ..
            Plane.RelativeThings.Add(EnemyPlane);
            EnemyPlane.RelativeThings.Add(Plane);

            // Enemy Controls
            EnemyPlane.Control = true;
            EnemyPlane.Acccelerate = Keys.W;
            EnemyPlane.BackAccelerate = Keys.S;
            EnemyPlane.TurnLeft = Keys.A;
            EnemyPlane.TurnRight = Keys.D;

            Plane.Bounding = true;
            EnemyPlane.Bounding = true;

            Plane.BoundingRect = BoundingRectangle;
            EnemyPlane.BoundingRect = BoundingRectangle;

            this.Components.Add(Plane);
            this.Components.Add(EnemyPlane);

            Plane.Velocity = Vector2.Zero;
            EnemyPlane.Velocity = Vector2.Zero;
            Plane.Position = Vector2.One * 400;
            EnemyPlane.Position = Vector2.UnitX * GraphicsDevice.Viewport.Width / 2 + Vector2.One * 400;
            if (gameMode!=GameMode.Multiplayer) EnemyPlane.EnableAutoPilot(Plane);
            Plane.Health = 100;
            EnemyPlane.Health = 100;

            Plane.Rotation = 0;
            EnemyPlane.Rotation = 0;

            Winner = Winning.none;
            Paused = false;
        }