Question about velocity udpate

Since velocity is set to:velocity -= 10; when we press the spacebar, and this itself is inside the while loop, does this mean that the velocity would keep accelerating if we repeatedly pressed the spacebar?

while
{
    if (IsKeyPressed ( KEY_SPACE ))
   {
        velocity -= 10;
   }
}
1 Like

With the way the code is, that is correct! We’ll show you how to limit it to one press within a few lectures.

2 Likes

Thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms