- Implementat el head bobbing
This commit is contained in:
4
main.cpp
4
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; }
|
||||
|
||||
Reference in New Issue
Block a user