diff --git a/main.cpp b/main.cpp index 7b553c1..17b5b7b 100644 --- a/main.cpp +++ b/main.cpp @@ -33,6 +33,7 @@ float speed = 0.0f; float max_speed = 200.0f; float rspeed = 200.0f; +float bobbing = 0.0f; float dt; @@ -318,6 +319,9 @@ int main(int argc, char *argv[]) dt = float(SDL_GetTicks() - millis)/1000.0f; millis = SDL_GetTicks(); + bobbing += dt*1000.0f; + height = 32 + SDL_sinf(bobbing*DEG_TO_RAD)*(speed/100.0f); + while (SDL_PollEvent(&e)) { if (e.type==SDL_EVENT_QUIT) { should_exit=true; break; }