Fix a few things

This commit is contained in:
Miloslav Číž 2018-09-08 15:58:32 +02:00
parent f6cdc77a59
commit e48bbee4f4

View file

@ -17,6 +17,8 @@ Player player;
#define SPRITES 3 #define SPRITES 3
#define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE #define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE
#define JUMP_SPEED 500
Sprite sprites[SPRITES]; Sprite sprites[SPRITES];
/// For each level square says the texture index. /// For each level square says the texture index.
@ -693,7 +695,8 @@ int main()
sprites[0] = Sprite(sprite1,10,5,1,100); sprites[0] = Sprite(sprite1,10,5,1,100);
sprites[1] = Sprite(sprite1,14,5,1,100); sprites[1] = Sprite(sprite1,14,5,1,100);
sprites[2] = Sprite(sprite1,15,19,1,100); sprites[2] = Sprite(sprite2,15,19,1,150);
sprites[2].mHeight -= UNITS_PER_SQUARE / 2;
pokitto.display.persistence = 1; pokitto.display.persistence = 1;
pokitto.setFrameRate(FPS); pokitto.setFrameRate(FPS);
@ -706,17 +709,14 @@ uint32_t dt;
{ {
if (pokitto.update()) if (pokitto.update())
{ {
draw();
uint32_t timeNow = pokitto.getTime(); uint32_t timeNow = pokitto.getTime();
dt = timeNow - previousTime; dt = timeNow - previousTime;
previousTime = timeNow; previousTime = timeNow;
draw();
int16_t horizontalStep = (dt * PLAYER_SPEED) / 1000; int16_t horizontalStep = (dt * PLAYER_SPEED) / 1000;
const int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000; int16_t rotationStep = (dt * PLAYER_ROTATION_SPEED) / 1000;
Vector2D d = angleToDirection(player.mCamera.direction); Vector2D d = angleToDirection(player.mCamera.direction);
@ -795,7 +795,7 @@ previousTime = timeNow;
if (player.mCamera.height - CAMERA_COLL_HEIGHT_BELOW - if (player.mCamera.height - CAMERA_COLL_HEIGHT_BELOW -
floorHeightAt(camX,camY) < 2) floorHeightAt(camX,camY) < 2)
player.mVericalSpeed = 500; // jump player.mVericalSpeed = JUMP_SPEED; // jump
} }
player.mVericalSpeed -= (dt * GRAVITY_ACCELERATION) / 1000; // gravity player.mVericalSpeed -= (dt * GRAVITY_ACCELERATION) / 1000; // gravity