summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/main.c
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2024-12-30 18:46:31 +0300
committerBoredGuy <osome3717@gmail.com>2024-12-30 18:46:31 +0300
commit6f7d1bb16ff266f4126a46c6acb132dd9f80cd86 (patch)
tree126fc32cfae7dc53f3f4b1769453ff1b1fb336b4 /Week1-Pacman/src/main.c
parent6f3fe42d5888e70fe195b6bbf32b7bdd4059415b (diff)
Smoother Movement
Tis all
Diffstat (limited to 'Week1-Pacman/src/main.c')
-rw-r--r--Week1-Pacman/src/main.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/Week1-Pacman/src/main.c b/Week1-Pacman/src/main.c
index 90e085b..041dfb8 100644
--- a/Week1-Pacman/src/main.c
+++ b/Week1-Pacman/src/main.c
@@ -10,7 +10,6 @@
#define WINDOW_HEIGHT 600
int main() {
- int counter = 0;
SDL_Init(SDL_INIT_EVERYTHING);
struct demo demo = {0};
@@ -64,6 +63,8 @@ int main() {
}
});
pacman.facing = FACING_DOWN;
+ pacman.xpos = 100;
+ pacman.ypos = 200;
int then = SDL_GetTicks();
@@ -81,26 +82,11 @@ int main() {
then = now;
SDL_RenderClear(demo.ren);
- update_pacman(&pacman, dt);
+ update_pacman(&pacman, dt, &map);
update_demo(&demo);
draw_map(&demo, &map);
draw_pacman(&demo, &pacman);
SDL_RenderPresent(demo.ren);
-
- SDL_Rect r = {
- .x = pacman.xpos,
- .y = pacman.ypos,
- .w = 40,
- .h = 40
- };
-
- for(int i = 0; i < map.collider_count; i++) {
- if(is_colliding(&r, &map.colliders[i])) {
- printf("%d: Collision!\n", counter);
- counter++;
- break;
- }
- }
}
SDL_DestroyRenderer(demo.ren);