diff --git a/app_debug.c b/app_debug.c index 4464371..6b307c2 100644 --- a/app_debug.c +++ b/app_debug.c @@ -17,11 +17,17 @@ void app_DebugText(App *app, vector_Vector *vec_string) { } else { snprintf( buf, sizeof(buf) - 1, - "Player:\n Pos: [%.4lf, %.4lf], Vec:[%.4lf, %.4lf]\n", + "Player:\n" + " Pos: [%.4lf, %.4lf]\n" + " Vec:[%.4lf, %.4lf]\n" + " OnGround: %s\n" + " JumpCount: %d\n", player->super->position->position.x, player->super->position->position.y, player->super->position->velocity.x, - player->super->position->velocity.y); + player->super->position->velocity.y, + (player->onGround ? "true" : "false"), + player->jumpCount); PUSH_STRING(buf); } diff --git a/physics.c b/physics.c index b6375c7..53c4f30 100644 --- a/physics.c +++ b/physics.c @@ -86,7 +86,7 @@ static inline void _physics_AdvanceEntity(System_Physics *sys, Entity *e, Durati } -static double gravity = 30; +static double gravity = 1000; void physics_Advance(System_Physics *sys, Duration deltaTime) { for (tree_Node *i = tree_FirstNode(sys->pos); diff --git a/player.c b/player.c index 5a9325e..d1e7323 100644 --- a/player.c +++ b/player.c @@ -46,7 +46,7 @@ void player_DeleteEntity(System_Player *sys, uintptr_t id) { } -static double walkSpeed = 200.0, jumpSpeed = 500.0; +static double walkSpeed = 300.0, jumpSpeed = 500.0; static int airjumpCount = 1; void player_Advance(System_Player *sys, Duration deltaTime) { @@ -61,25 +61,19 @@ void player_Advance(System_Player *sys, Duration deltaTime) { targetVecX += -walkSpeed; if (input_IsPressed(input->keys[input_Key_Right])) targetVecX += walkSpeed; - - double targetVecY = 0.0; - if (input_IsPressed(input->keys[input_Key_Up])) - targetVecY += -walkSpeed; - if (input_IsPressed(input->keys[input_Key_Down])) - targetVecY += walkSpeed; - sys->player->super->position->velocity.x = targetVecX; - sys->player->super->position->velocity.y = targetVecY; + if (sys->player->onGround) sys->player->jumpCount = 0; // Jump if (sys->super->input->keys[input_Key_Jump] == JustPressed) { - if (sys->player->onGround || sys->player->jumpCount < airjumpCount) + if (sys->player->onGround || sys->player->jumpCount < airjumpCount) { sys->player->super->position->velocity.y = -jumpSpeed; - if (!sys->player->onGround) // Took the second clause, airjumped - sys->player->jumpCount++; + if (!sys->player->onGround) // Took the second clause, airjumped + sys->player->jumpCount++; + } } // Check OnGround again diff --git a/render_util.cpp b/render_util.cpp index 876aaa3..ca3043e 100644 --- a/render_util.cpp +++ b/render_util.cpp @@ -20,12 +20,10 @@ void render_DrawText(int x, int y, const char *str) { vector_Clear(tbuf); int len = strlen(str); - printf("%s, len=%d\n", str, len); - int i = 0; + int i = 0; while (i < len) { if (str[i] == '\n') { vector_Push(tbuf, &zero); - printf("outtext: \"%s\"\n", vector_Data(tbuf)); outtextxy(cx, cy, (LPCTSTR)vector_Data(tbuf)); cy += TEXTHEIGHT;