X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=blobdiff_plain;f=main.c;h=880f14e180254bd0b25212210b9f08f989ccb175;hp=097969c09eeadd7ac3ba9d41433e61edb866ee85;hb=e9eaa65259d7c35d5a9b08aba9016145fa8f118d;hpb=5c8f059629c2127848ce4051296d2f5897bf5c0f diff --git a/main.c b/main.c index 097969c..880f14e 100644 --- a/main.c +++ b/main.c @@ -66,7 +66,7 @@ struct bangdots bdot[MAXBANGDOTS], *bdotptr = bdot; char topline[1024]; char *initerror = ""; -struct ship ship = { SHIP_SPRITE, NULL, XSIZE/2, YSIZE/2, SCREENDXMIN, 0.0 }; +struct ship ship = { SHIP, NULL, XSIZE/2, YSIZE/2, SCREENDXMIN, 0.0 }; float screendx = SCREENDXMIN, screendy = 0.0; float xscroll, yscroll; @@ -510,7 +510,11 @@ draw() { } if(state == GAMEPLAY) { - bang = collides(SPRITE(&ship)); + Sprite *r = collides(SPRITE(&ship)); + if(r) { + bounce(r, SPRITE(&ship)); + } + collisions(); } ms_frame = SDL_GetTicks() - ms_end; @@ -532,6 +536,12 @@ draw() { return bang; } +void +do_collision(Sprite *a, Sprite *b) +{ + bounce(a, b); +} + int gameloop() { Uint8 *keystate = SDL_GetKeyState(NULL);