Пример #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Пример #2
0
 public override void Update(Game1 game)
 {
     spritePosition.X += spriteSpeed;
     if (spritePosition.X > Game1.SCREEN_WIDTH + 200)
     {
         active = false;
     }
     base.Update(game);
 }
Пример #3
0
 public override void Update(Game1 game)
 {
     if (!Die)
     {
         spritePosition.Y -= spriteSpeed;
         if (spritePosition.Y < (0 - spriteTexture.Height))
         {
             spritePosition.Y = Game1.SCREEN_HEIGHT;
         }
     }
     base.Update(game);
 }
Пример #4
0
 public new virtual void Update(Game1 game)
 {
     if (Die)
     {
         if (alphaLevel <= 0.0f)
         {
             active = false;
             game.Score += ScoreValue;
         }
         alphaLevel -= .05f;
     }
     base.Update(game);
 }
Пример #5
0
        public void Update(GamePadState currentGamePadState, GamePadState previousGamePadState, KeyboardState currentKeyboardState, KeyboardState previousKeyboardState, Game1 game)
        {
            float stickY = currentGamePadState.ThumbSticks.Left.Y;
            spritePosition.Y -= stickY * spriteSpeed;

            if(currentKeyboardState.IsKeyDown(Keys.W))
            {
                spritePosition.Y -= spriteSpeed;
            }
            if (currentKeyboardState.IsKeyDown(Keys.S))
            {
                spritePosition.Y += spriteSpeed;
            }

            if (spritePosition.Y <= 0)
            {
                spritePosition.Y = 0;
            }
            else if (spritePosition.Y >= Game1.SCREEN_HEIGHT - spriteTexture.Height)
            {
                spritePosition.Y = Game1.SCREEN_HEIGHT - spriteTexture.Height;
            }

            if (currentGamePadState.IsButtonDown(Buttons.A) && previousGamePadState.IsButtonUp(Buttons.A))
            {
                if (Ammo > 0)
                {
                    arrows.Add(new Missile(arrowTexture, new Vector2(this.spritePosition.X, this.spritePosition.Y + 13), 8.0f));
                    Ammo--;
                }
            }

            List<Missile> newArrowList = new List<Missile>();

            foreach(Missile arrow in arrows)
            {
                arrow.Update(game);
                if (arrow.getActive())
                {
                    newArrowList.Add(arrow);
                }
            }

            arrows = newArrowList;
        }
Пример #6
0
 public override void Update(Game1 game)
 {
     base.Update(game);
 }
Пример #7
0
 public virtual void Update(Game1 game)
 {
 }