diff options
Diffstat (limited to 'Week1-Pacman/src/main.c')
-rw-r--r-- | Week1-Pacman/src/main.c | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/Week1-Pacman/src/main.c b/Week1-Pacman/src/main.c index 66e1278..6ae2fde 100644 --- a/Week1-Pacman/src/main.c +++ b/Week1-Pacman/src/main.c @@ -40,38 +40,12 @@ int main(int argc, char** argv) { keyboard = SDL_GetKeyboardState(NULL); - for(int i = 0; i < 4; i++) - init_animation(&pacman.animations[i], &(struct animation_init){ - .ren = demo.ren, - .spritesheet = "assets/Sprites/sprites.png", - - .initial_angle = 90.0 * i, - .initial_frame_count = 3, - .initial_frame_times = (float[]){0.05, 0.05, 0.05}, - .initial_frames = (SDL_Rect[]) { - { - .x = 0, - .y = 285, - .w = 180, - .h = 195 - }, - { - .x = 240, - .y = 285, - .w = 180, - .h = 195 - }, - { - .x = 465, - .y = 285, - .w = 195, - .h = 195 - } - } - }); - pacman.facing = FACING_DOWN; - pacman.xpos = 100; - pacman.ypos = 200; + load_pacman_spritesheet(&demo); + init_pacman(&pacman, &(struct pacman_init) { + .initial_xpos = 100, + .initial_ypos = 200, + .initial_facing = FACING_DOWN + }); int then = SDL_GetTicks(); |