- Implementat el head bobbing

This commit is contained in:
2025-09-26 14:56:39 +02:00
parent 2a147fb7f8
commit 9ba4751170

View File

@@ -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; }