Compare commits

...

3 Commits

Author SHA1 Message Date
Ulysse Cura d214571ef9 Time passes correctly now. 2026-07-22 13:00:45 +02:00
Ulysse Cura dfd1811009 Corrected walk animation name and frames. 2026-07-22 13:00:33 +02:00
Ulysse Cura 54604db0c7 Modified debug options. 2026-07-22 13:00:11 +02:00
4 changed files with 6 additions and 6 deletions

4
.vscode/launch.json vendored
View File

@ -8,10 +8,10 @@
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/build/2D_Engine",
"program": "${workspaceFolder}/build/2D_Engine",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",

View File

@ -8,7 +8,7 @@
#define PLAYER_DEFAULT_SPEED 80.0f // px / s
#define PLAYER_DEFAULT_IDLE_ANIMATION_SPEED 250.0f // ms / frame
#define PLAYER_DEFAULT_RUN_ANIMATION_SPEED 160.0f // ms / frame
#define PLAYER_DEFAULT_WALK_ANIMATION_SPEED 160.0f // ms / frame
typedef enum player_state_t {
PLAYER_IDLE = 0x00, // 00000000

View File

@ -65,8 +65,8 @@ static inline void player_system_set_animation(player_system_data_t *system_data
if((system_data->state & PLAYER_RUNNING) && !(system_data->last_state & PLAYER_RUNNING))
{
animation_system_data->frame_delay_ms = PLAYER_DEFAULT_RUN_ANIMATION_SPEED;
animation_system_change_animation(animation_system_data, "player_run_sheet", 6);
animation_system_data->frame_delay_ms = PLAYER_DEFAULT_WALK_ANIMATION_SPEED;
animation_system_change_animation(animation_system_data, "player_walk_sheet", 4);
}
else if(!(system_data->state & PLAYER_RUNNING) && (system_data->last_state & PLAYER_RUNNING))
{

View File

@ -44,7 +44,7 @@ void game_handle_event(void)
static inline void update_time(void)
{
clock_t last_clock_state = clock();
static clock_t last_clock_state = 0;
clock_t start_clock = clock();
game.delta_time_ms = (float)(start_clock - last_clock_state) * 1000.0f / CLOCKS_PER_SEC;
last_clock_state = start_clock;