Exemple #1
0
 public Asteroid(Wilderness wild, Vector2 vector)
 {
     Wilderness = wild;
     Position = vector;
     LoadContent();
     this.Type = GameType.Unmovable;
     this.LocalBounds = new Rectangle((int)Position.X, (int)Position.Y, 25, 25);
 }
Exemple #2
0
 public Spaceship(Vector2 position, Wilderness wild, string name)
 {
     this.Wilderness = wild;
     this.Position = position;
     this.Name = name;
     this.LocalBounds = new Rectangle((int)position.X,(int)position.Y,25,25);
     LoadContent();
 }
Exemple #3
0
 public Enemy(Vector2 position, Wilderness wild, string name)
 {
     this.Position = position;
     this.Wilderness = wild;
     this.Name = name;
     this.Type = GameType.Enemy;
     this.mEngine = new AIEngine(this);
     this.currentBehaviour = Behaviour.None;
     this.IsAlive = true;
     random = new Random((int)(position.X + position.Y) - DateTime.Now.Millisecond);
     LoadContent();
     mAnimator = new SuperNova.Graphics.Animator(mDie);
     this.LocalBounds = new Rectangle((int)Position.X, (int)Position.Y, 25, 25);
 }
Exemple #4
0
 public Spacestation(Wilderness wild, string name)
 {
     this.Wilderness = wild;
     this.Name = name;
     LoadContent();
 }
Exemple #5
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            //We are going to pass that state down the line to the player
            MouseState state = Mouse.GetState();

            //Check the state of the game
            if (mState == GameState.Menu)
            {
                switch (mainMenu.Update(gameTime, state))
                {
                    case 0:
                        //New game
                        break;
                    case 1:
                        //Load saved game
                        mWildness = new Wilderness(this.Services, this.GraphicsDevice.Viewport.TitleSafeArea, true);
                        this.mState = GameState.Game;
                        break;
                    case 2:
                        //Quit
                        this.Exit();
                        break;
                }
            }
            else if(mState == GameState.Game)
            {
                if (mWildness.Direction == Directions.None)
                {
                    mWildness.Update(gameTime, state);
                }
                else
                {
                    Point newPoint;
                    switch (mWildness.Direction)
                    {
                        case Directions.North:
                            newPoint = mWildness.UniversalPosition;
                            newPoint.Y -= 1;
                            mWildness = new Wilderness(this.Services, newPoint, this.GraphicsDevice.Viewport.TitleSafeArea, false);
                            break;
                        case Directions.South:
                            newPoint = mWildness.UniversalPosition;
                            newPoint.Y += 1;
                            mWildness = new Wilderness(this.Services, newPoint, this.GraphicsDevice.Viewport.TitleSafeArea, false);
                            break;
                        case Directions.East:
                            newPoint = mWildness.UniversalPosition;
                            newPoint.X += 1;
                            mWildness = new Wilderness(this.Services, newPoint, this.GraphicsDevice.Viewport.TitleSafeArea, false);
                            break;
                        case Directions.West:
                            newPoint = mWildness.UniversalPosition;
                            newPoint.X -= 1;
                            mWildness = new Wilderness(this.Services, newPoint, this.GraphicsDevice.Viewport.TitleSafeArea, false);
                            break;
                    }
                }
            }
            base.Update(gameTime);
        }