コード例 #1
0
ファイル: Program.cs プロジェクト: DagonGD/Game3
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1(args))
     {
         game.Run();
     }
 }
コード例 #2
0
        public void Update(Player player, KeyboardState oldKeyboardState, KeyboardState newKeyboardState, Game1 game)
        {
            player._framesSinceJump = 0;

            if (newKeyboardState.IsKeyDown(Keys.D))                // move right
            {
                player.HorizontalSpeed += player._runAcceleration; // increase player's speed based on acceleration

                if (player.HorizontalSpeed > player._maxSpeed)
                {
                    player.HorizontalSpeed = player._maxSpeed; // cap speed to player's max
                }
                player.FacingRight = true;                     // make the player face right
            }

            if (newKeyboardState.IsKeyDown(Keys.A))                // move left
            {
                player.HorizontalSpeed -= player._runAcceleration; // decrease player's speed based on acceleration

                if (player.HorizontalSpeed < 0 - player._maxSpeed)
                {
                    player.HorizontalSpeed = 0 - player._maxSpeed; // cap speed to player's max
                }
                player.FacingRight = false;                        // make the player face left
            }

            // Stand
            if (!newKeyboardState.IsKeyDown(Keys.A) && !newKeyboardState.IsKeyDown(Keys.D))
            {
                player.State = player.States.standing;
            }

            // Jump
            if (newKeyboardState.IsKeyDown(Keys.J) && !oldKeyboardState.IsKeyDown(Keys.J))
            {
                player.VerticalSpeed -= player._jumpSpeed;
                player.State          = player.States.jumping;
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: saniainf/TestMonoGame
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }
コード例 #4
0
 static void Main()
 {
     using (var game = new Game1())
         game.Run();
 }