diff --git a/demo1.cpp b/demo1.cpp index d3c885e..6c07843 100644 --- a/demo1.cpp +++ b/demo1.cpp @@ -17,6 +17,8 @@ Player player; #define SPRITES 3 #define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE +#define JUMP_SPEED 500 + Sprite sprites[SPRITES]; /// For each level square says the texture index. @@ -693,7 +695,8 @@ int main() sprites[0] = Sprite(sprite1,10,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.setFrameRate(FPS); @@ -706,17 +709,14 @@ uint32_t dt; { if (pokitto.update()) { - -uint32_t timeNow = pokitto.getTime(); -dt = timeNow - previousTime; -previousTime = timeNow; - - - draw(); + uint32_t timeNow = pokitto.getTime(); + dt = timeNow - previousTime; + previousTime = timeNow; + 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); @@ -795,7 +795,7 @@ previousTime = timeNow; if (player.mCamera.height - CAMERA_COLL_HEIGHT_BELOW - floorHeightAt(camX,camY) < 2) - player.mVericalSpeed = 500; // jump + player.mVericalSpeed = JUMP_SPEED; // jump } player.mVericalSpeed -= (dt * GRAVITY_ACCELERATION) / 1000; // gravity