Player: tweak constants, track jump hangtime.

GitOrigin-RevId: 868003a32664b89212cdb4cf082d96016c5529f9
This commit is contained in:
Colin McMillen 2020-02-19 14:59:17 -05:00
parent 90b003e0b0
commit cf5167fba7

View File

@ -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);