From cf5167fba7e04f08fb9f5feda9e18d643e0e479e Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Wed, 19 Feb 2020 14:59:17 -0500 Subject: [PATCH] Player: tweak constants, track jump hangtime. GitOrigin-RevId: 868003a32664b89212cdb4cf082d96016c5529f9 --- Shared/Player.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Shared/Player.cs b/Shared/Player.cs index 5faa608..2cdab96 100644 --- a/Shared/Player.cs +++ b/Shared/Player.cs @@ -10,7 +10,7 @@ namespace SemiColinGames { private const int moveSpeed = 180; private const int jumpSpeed = -600; - private const int gravity = 2400; + private const int gravity = 1600; // Details of the sprite image. // player_1x is 48 x 48, yOffset=5, halfSize=(7, 14) @@ -23,7 +23,7 @@ namespace SemiColinGames { // Position is tracked at the Player's center. The Player's bounding box is a rectangle // centered at that point and extending out by halfSize.X and halfSize.Y. - private Point position = new Point(64, 16 * 13); + private Point position = new Point(64, 16 * 12); private Vector2 halfSize = new Vector2(11, 24); private Vector2 eyeOffsetStanding = new Vector2(7, -14); private Vector2 eyeOffsetWalking = new Vector2(15, -7); @@ -34,6 +34,7 @@ namespace SemiColinGames { private int swordSwingNum = 0; private const int swordSwingMax = 6; private float ySpeed = 0; + private double jumpTime = 0; public Player() { } @@ -118,6 +119,11 @@ namespace SemiColinGames { jumps = 1; ySpeed = -0.0001f; // Debug.AddRect(Box(position), Color.Cyan); + double jumpElapsed = Clock.ModelTime.TotalSeconds - jumpTime; + if (jumpElapsed > 0.2) { + Debug.WriteLine("jump time: " + jumpElapsed); + } + jumpTime = Clock.ModelTime.TotalSeconds; } else { jumps = 0; // Debug.AddRect(Box(position), Color.Orange);