public void reSetGame()
        {
            livesList.Clear();
            for (int i = 0; i < 3; ++i)
            {
                int offset = 10 + i * 40;
                livesList.Add(new AutomatedSprite(
                                  Game.Content.Load <Texture2D>(@"images\threerings"),
                                  new Vector2(offset, 35), new Point(75, 75), 10,
                                  new Point(0, 0), new Point(6, 8), Vector2.Zero,
                                  null, 0, .5f));
            }


            player = new UserControlledSprite(
                Game.Content.Load <Texture2D>(@"Images/threerings"),
                new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2,
                            GraphicsDevice.PresentationParameters.BackBufferHeight / 2),
                new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(3, 3));
            spriteList.Clear();

            enemySpawnMinMilliseconds = 1000;
            enemySpawnMaxMilliseconds = 2000;
        }
Exemple #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Load the player sprite
            player = new UserControlledSprite(
                Game.Content.Load <Texture2D>(@"Images/uncle_move"),
                new Vector2(70, 330), new Point(60, 116), 20, new Point(0, 0),
                new Point(6, 0), new Vector2(3, 3));


            base.LoadContent();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Loadsound
            //SoundEffect sound11= Game.Content.Load<SoundEffect>(@"Audio\boltcollision");
            //sound1 = sound11.CreateInstance();
            //SoundEffect sound22 = Game.Content.Load<SoundEffect>(@"Audio\fourbladescollision");
            //sound2 = sound22.CreateInstance();
            //SoundEffect sound33 = Game.Content.Load<SoundEffect>(@"Audio\pluscollision");
            //sound3 = sound33.CreateInstance();
            //SoundEffect sound44 = Game.Content.Load<SoundEffect>(@"Audio\skullcollision");
            //sound4 = sound44.CreateInstance();
            //SoundEffect sound55 = Game.Content.Load<SoundEffect>(@"Audio\threebladescollision");
            //sound5 = sound55.CreateInstance();
            player = new UserControlledSprite(
                Game.Content.Load <Texture2D>(@"Images/threerings"),
                new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2,
                            GraphicsDevice.PresentationParameters.BackBufferHeight / 2),
                new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(3, 3));


            // Load player lives list
            for (int i = 0; i < ((Game1)Game).NumberLivesRemaining; ++i)
            {
                int offset = 10 + i * 40;
                livesList.Add(new AutomatedSprite(
                                  Game.Content.Load <Texture2D>(@"images\threerings"),
                                  new Vector2(offset, 35), new Point(75, 75), 10,
                                  new Point(0, 0), new Point(6, 8), Vector2.Zero,
                                  null, 0, .5f));
            }

            base.LoadContent();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Load the player sprite
            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/threerings"),
                Vector2.Zero, new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(6, 6));
             base.LoadContent();
        }
        private void PlayerActionCheck(UserControlledSprite Player)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Right))
            {
                if (GetPlayerOriginalFrame() != playerRunFramePoint)
                {
                    ChangeState(Game.Content.Load<Texture2D>(@"Images/character"), playerRunFramePoint, playerRunSheetSize, false, Player);
                }
            }

            if (Keyboard.GetState().IsKeyUp(Keys.Right) && prevKeyboard.IsKeyUp(Keys.Right) == false)
            {
                if (GetPlayerOriginalFrame() != playerIdleFramePoint)
                {
                    ChangeState(Game.Content.Load<Texture2D>(@"Images/character"), playerIdleFramePoint, playerIdleSheetSize, false, Player);
                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Left))
            {
                if (GetPlayerOriginalFrame() != playerRunFramePointRight)
                {
                    ChangeState(Game.Content.Load<Texture2D>(@"Images/character2"), playerRunFramePointRight, playerRunSheetSize, true, Player);
                }
            }

            if (Keyboard.GetState().IsKeyUp(Keys.Left) && prevKeyboard.IsKeyUp(Keys.Left) == false)
            {
                if (GetPlayerOriginalFrame() != playerIdleFramePointRight)
                {
                    ChangeState(Game.Content.Load<Texture2D>(@"Images/character2"), playerIdleFramePointRight, playerIdleSheetSize, true, Player);
                }
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && bulletTimeSinceLastSpawnChange > bulletCreateMilliseconds)
            {
                bulletTimeSinceLastSpawnChange = 0;
                BulletsCreate();
                prevKeyboard = Keyboard.GetState();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.O))
            {
                ChangeBullet(Player.Bullet1);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.P) && Player.HadBullet2)
            {
                ChangeBullet(Player.Bullet2);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.L) && Player.HadBullet2)
            {
                ChangeBullet(Player.Bullet1);
                Player.HadBullet2 = false;
                Player.ResetSpeed();
                Vector2 position = new Vector2(Player.Position.X-100,Player.Position.Y-100);
                Vector2 speed = Player.Speed*(-1);
                spriteList.Add(
                        new EvadingSprite(Game.Content.Load<Texture2D>(@"images\plus"),
                           position, new Point(75, 75), 10, new Point(0, 0),
                            new Point(6, 4), speed, "pluscollision", chasingSpritePointValue, this, 0.2f, 100));

            }
        }
        private void CheckCollisionsForBoards(GameTime gameTime, UserControlledSprite player)
        {
            Boolean hit = false;
            BroadsSprite b = broadsList[1];
            //change the players rectangle to a bigger one
            Rectangle forPlayer = new Rectangle(player.collisionRect.X - 10, player.collisionRect.Y - 10,
                player.collisionRect.Width + 20, player.collisionRect.Height + 20);

            for (int i = 0; i < broadsList.Count; i++)
            {
                BroadsSprite b1 = broadsList[i];
                if (b1.collisionRect.Intersects(forPlayer))
                {
                    if (player.FrameSize.Y >= b1.Position.Y - player.Position.Y && b1.Position.Y > player.Position.Y + 50)
                    {
                        hit = true;
                        b = b1;
                    }
                }
            }
            if (hit)
            {
                player.DownSpeed = 0;
                if (Keyboard.GetState().IsKeyDown(Keys.Up) && GetPlayerPosition().Y == b.Position.Y - player.FrameSize.Y + 1)
                {
                    player.JumpSpeed = 10;
                    player.JumpState = true;

                }
                else if ((player.JumpSpeed < 0 || player.JumpSpeed == 10) && player.FrameSize.Y >= b.Position.Y - player.Position.Y && b.Position.Y > player.Position.Y + 50)
                {
                    player.Position = new Vector2(player.Position.X, b.Position.Y - player.FrameSize.Y + 1);
                    player.JumpSpeed = 10;
                    player.JumpState = false;
                }

            }
            else
            {
                if (!player.JumpState)
                {
                    if (player.Position.Y < Game.Window.ClientBounds.Height - player.FrameSize.Y)
                    {

                        player.DownSpeed = player.DownSpeed - 0.8f;
                        player.Position = new Vector2(player.Position.X, player.Position.Y - player.DownSpeed);
                    }
                }
            }
            hit = false;
        }
 private void ChangeState(Texture2D Texture, Point FramePoint, Point sheetSize, Boolean right, UserControlledSprite Player)
 {
     Player.TextImage = Texture;
     Player.GetOriginalCurrentFrame = FramePoint;
     Player.SheetSize = sheetSize;
     Player.IsRightCheck = right;
     prevKeyboard = Keyboard.GetState();
 }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //load smoke image
            smokeflakes = Game.Content.Load<Texture2D>(@"images/smoke");

            //create initial borads
            int x = 100, y = 100;
            for (int i = 1; i < broadCount; i++)
            {
                if (i == 5)
                {
                    x -= 30;
                }
                broadsList.Add(new BroadsSprite(
                    Game.Content.Load<Texture2D>(@"Images/broad"),
                    new Vector2(x, y), new Point(100, 30), 0,
                    new Point(0, 0), new Point(1, 1), Vector2.Zero,
                    null, 0, 0.5f));

                broadsList.Add(new BroadsSprite(
                    Game.Content.Load<Texture2D>(@"Images/broad"),
                    new Vector2(Game.Window.ClientBounds.Width - x, y), new Point(100, 30), 0,
                    new Point(0, 0), new Point(1, 1), Vector2.Zero,
                    null, 0, 0.5f));

                x += 120;
                y += 80;

            }

            //load bullet image
            TextureForBullet1 = Game.Content.Load<Texture2D>(@"Images/skullball");

            //create players
            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/character"),
                new Vector2(Game.Window.ClientBounds.Width / 2,
                    Game.Window.ClientBounds.Height - 64),
                new Point(64, 64),
                10,
                playerIdleFramePoint,
                new Point(9, 1),
                new Vector2(6, 6),
                30,
                false,
                "", 0);
            player2 = new User2ControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/user2character"),
                new Vector2(20,
                    Game.Window.ClientBounds.Height - 64),
                new Point(64, 64),
                10,
                playerIdleFramePoint,
                new Point(9, 1),
                new Vector2(6, 6),
                30,
                false,
                "", 0);

            //Life icon
            for (int i = 0; i < ((Game1)Game).NumberLivesRemaining; ++i)
            {
                int offset = 10 + i * 40;
                livesList.Add(new AutomatedSprite(
                    Game.Content.Load<Texture2D>(@"images\threerings"),
                    new Vector2(offset, 35), new Point(75, 75), 10,
                    new Point(0, 0), new Point(6, 8), Vector2.Zero,
                    null, 0, .5f));
            }
            for (int i = 0; i < ((Game1)Game).NumberLivesRemaining2; ++i)
            {
                int offset = 950 - i * 40;
                livesList2.Add(new AutomatedSprite(
                    Game.Content.Load<Texture2D>(@"images\threerings"),
                    new Vector2(offset, 35), new Point(75, 75), 10,
                    new Point(0, 0), new Point(6, 8), Vector2.Zero,
                    null, 0, .5f));
            }
            base.LoadContent();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Loadsound
               //SoundEffect sound11= Game.Content.Load<SoundEffect>(@"Audio\boltcollision");
               //sound1 = sound11.CreateInstance();
               //SoundEffect sound22 = Game.Content.Load<SoundEffect>(@"Audio\fourbladescollision");
               //sound2 = sound22.CreateInstance();
               //SoundEffect sound33 = Game.Content.Load<SoundEffect>(@"Audio\pluscollision");
               //sound3 = sound33.CreateInstance();
               //SoundEffect sound44 = Game.Content.Load<SoundEffect>(@"Audio\skullcollision");
               //sound4 = sound44.CreateInstance();
               //SoundEffect sound55 = Game.Content.Load<SoundEffect>(@"Audio\threebladescollision");
               //sound5 = sound55.CreateInstance();
            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/threerings"),
                new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2,
                    GraphicsDevice.PresentationParameters.BackBufferHeight / 2),
                new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(3, 3));

            // Load player lives list
            for (int i = 0; i < ((Game1)Game).NumberLivesRemaining; ++i)
            {
                int offset = 10 + i * 40;
                livesList.Add(new AutomatedSprite(
                    Game.Content.Load<Texture2D>(@"images\threerings"),
                    new Vector2(offset, 35), new Point(75, 75), 10,
                    new Point(0, 0), new Point(6, 8), Vector2.Zero,
                    null, 0, .5f));
            }

            base.LoadContent();
        }
        public void reSetGame()
        {
            livesList.Clear();
            for (int i = 0; i < 3; ++i)
                             {
                                 int offset = 10 + i * 40;
                                 livesList.Add(new AutomatedSprite(
                                     Game.Content.Load<Texture2D>(@"images\threerings"),
                                     new Vector2(offset, 35), new Point(75, 75), 10,
                                     new Point(0, 0), new Point(6, 8), Vector2.Zero,
                                     null, 0, .5f));
                             }

             player = new UserControlledSprite(
             Game.Content.Load<Texture2D>(@"Images/threerings"),
             new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth / 2,
             GraphicsDevice.PresentationParameters.BackBufferHeight / 2),
             new Point(75, 75), 10, new Point(0, 0),
             new Point(6, 8), new Vector2(3, 3));
             spriteList.Clear();

             enemySpawnMinMilliseconds = 1000;
             enemySpawnMaxMilliseconds = 2000;
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Load the player sprite
            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/threerings"),
                Vector2.Zero, new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(6, 6));

            //Load several different automated sprites into the list
            spriteList.Add(new BouncingSprite(
                Game.Content.Load<Texture2D>(@"Images/skullball"),
                new Vector2(150, 150), new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(1,1)));
            spriteList.Add(new BouncingSprite(
                Game.Content.Load<Texture2D>(@"Images/plus"),
                new Vector2(300, 150), new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 4), new Vector2(1,0)));
            spriteList.Add(new BouncingSprite(
                Game.Content.Load<Texture2D>(@"Images/plus"),
                new Vector2(150, 300), new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 4), new Vector2(0,1)));
            spriteList.Add(new BouncingSprite(
                Game.Content.Load<Texture2D>(@"Images/skullball"),
                new Vector2(600, 400), new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(-1,-1)));

            base.LoadContent();
        }
Exemple #12
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            //Load the player sprite
            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/uncle_move"),
                new Vector2(70, 330), new Point(60, 116), 20, new Point(0, 0),
                new Point(6, 0), new Vector2(3, 3));

            base.LoadContent();
        }
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            player = new UserControlledSprite(
                Game.Content.Load<Texture2D>(@"Images/threerings"),
                new Vector2(Game.Window.ClientBounds.Width / 2,
                    Game.Window.ClientBounds.Height / 2),
                new Point(75, 75), 10, new Point(0, 0),
                new Point(6, 8), new Vector2(6, 6));

            // Load player lives list
            for (int i = 0; i < ((Game1)Game).NumberLivesRemaining; ++i)
            {
                int offset = 10 + i * 40;
                livesList.Add(new AutomatedSprite(
                    Game.Content.Load<Texture2D>(@"images\threerings"),
                    new Vector2(offset, 35), new Point(75, 75), 10,
                    new Point(0, 0), new Point(6, 8), Vector2.Zero,
                    null, 0, .5f));
            }

            base.LoadContent();
        }