Example #1
0
        public void CreateWall()
        {
            MobileObject wall;

            wall = new MobileObject();
            wall.UpdateBounds();

            wall.randomX  = randomPos.Next(265, 530);
            wall.startX   = wallPosition;
            wall.position = new Vector2(wall.startX, 380);
            wall.size     = new Vector2(44, 50);
            wall.origin   = new Vector2();
            wall.rotation = 0f;
            wall.scale    = 1f;
            wall.speed    = 2;
            wall.texture  = wallTexture;

            wall.origin = new Vector2(wall.texture.Width / 2, wall.texture.Height / 2);
            wall.SetSize(new Vector2(wall.texture.Width, wall.texture.Height));
            wall.UpdateBounds();

            walls.Add(wall);

            wallPosition += wall.randomX;
        }
Example #2
0
        public bool checkEnemyMoneyCollisions(MobileObject Money)
        {
            bool result = AABBCollisionCheck(Money);

            if (result)
            {
            }

            return(result);
        }
Example #3
0
        public bool checkWallCollisions(MobileObject wall)
        {
            bool result = AABBCollisionCheck(wall);

            if (result)
            {
            }

            return(result);
        }
Example #4
0
        public void CreateMoney(GameTime gameTime)
        {
            TimeSpan timeSincelastShot = gameTime.TotalGameTime - lastShot;

            if (timeSincelastShot > shotCoolDown && player.health > 0)
            {
                MobileObject money = new MobileObject();
                money.position      = player.position;
                money.texture       = newmoney;
                money.size          = new Vector2(100, 50);
                money.scale         = 1f;
                money.rotation      = 0;
                money.rotationDelta = 0;
                money.velocity      = new Vector2(-17, 0);
                money.origin        = new Vector2(money.texture.Width / 2, money.texture.Height / 2);
                money.UpdateBounds();

                Missles.Add(money);

                lastShot       = gameTime.TotalGameTime;
                player.health -= 5;
            }
        }
Example #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            player = new PlayerObject();

            player.UpdateBounds();
            player.position  = new Vector2(graphics.PreferredBackBufferWidth / 2, 400);
            player.size      = new Vector2(265, 139);
            player.origin    = new Vector2();
            player.rotation  = 0f;
            player.scale     = 0.5f;
            player.speed     = 1;
            player.jumping   = false;
            player.jumpspeed = 0;
            player.startY    = player.position.Y;
            player.health    = 500;

            money = new MobileObject();
            money.UpdateBounds();
            money.position      = player.position;
            money.velocity      = new Vector2(5, 0);
            money.size          = new Vector2(100, 50);
            money.origin        = new Vector2();
            money.rotation      = 1f;
            money.rotationDelta = 0;
            money.scale         = 1f;
            money.speed         = 5;
            Missles             = new List <MobileObject>();
            MisslesToRemove     = new List <MobileObject>();
            RandNum             = new Random();

            lastShot     = new TimeSpan(0, 0, 0, 0, 0);
            shotCoolDown = new TimeSpan(0, 0, 0, 0, 250);

            enemy = new GameObject();
            enemy.UpdateBounds();
            enemy.position = new Vector2(5, 300); //player.groundHeight
            enemy.size     = new Vector2(140, 196);
            enemy.origin   = new Vector2();
            enemy.rotation = 0f;
            enemy.scale    = 1f;

            background1          = new MobileObject();
            background1.position = new Vector2(0, 0);
            background2          = new MobileObject();
            background2.position = new Vector2(0, 0);
            background3          = new MobileObject();
            background3.position = new Vector2(0, 0);

            LosePos = new Vector2(0, 0);
            timer   = 0;

            centre = new Vector2(player.position.X - player.origin.X, player.position.Y - player.origin.Y);

            //Default State
            gameState         = GameState.MENU;
            menuBackgroundPos = new Vector2(0, 0);
            //menuDinoPos = new Vector2(250, graphics.PreferredBackBufferHeight / 2);

            //Menu Button Int
            StartButtonPosition = new Vector2((graphics.PreferredBackBufferWidth / 2) - 50, 200);
            ExitButtonPosition  = new Vector2((graphics.PreferredBackBufferWidth / 2) - 50, 250);

            //LevelSelect Int
            Level1ButtonPosition = new Vector2(100, graphics.PreferredBackBufferHeight / 2);
            Level2ButtonPosition = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2);
            Level2Unlocked       = true;
            Level3ButtonPosition = new Vector2(600, graphics.PreferredBackBufferHeight / 2);
            Level3Unlocked       = true;

            //Mouse Click
            mouseState         = Mouse.GetState();
            previousMouseState = mouseState;



            base.Initialize();
        }