From fc3032135f4da3662d6b727c70f22049d6e09231 Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Sat, 14 Dec 2024 12:08:02 +0300 Subject: Update - Finish animation system - Fix bug where leftward/upward movement was slightly faster than downward/forward movement --- Week1-Pacman/src/pacman.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Week1-Pacman/src/pacman.h') diff --git a/Week1-Pacman/src/pacman.h b/Week1-Pacman/src/pacman.h index b56e95d..e1610af 100644 --- a/Week1-Pacman/src/pacman.h +++ b/Week1-Pacman/src/pacman.h @@ -3,20 +3,23 @@ #include #include "animation.h" +#include "demo.h" enum facing { - FACING_UP, + FACING_RIGHT, FACING_DOWN, FACING_LEFT, - FACING_RIGHT + FACING_UP }; struct pacman { - int xpos; - int ypos; + /* + * Coolest bug I have ever seen in my life + */ + float xpos; + float ypos; enum facing facing; - float frame_time; /* One for each face */ struct animation animations[4]; @@ -24,6 +27,6 @@ struct pacman { void handle_pacman_input(SDL_Event* e, struct pacman* pacman); void update_pacman(struct pacman* pacman, float dt); -void draw_pacman(SDL_Renderer* ren, const struct pacman* pacman); +void draw_pacman(struct demo* demo, const struct pacman* pacman); #endif // PACMAN_H_ -- cgit v1.2.3