Tagged Questions
2
votes
2answers
349 views
How to slow down a sprite that updates every frame?
I am going through a Allegro 5 tutorial which has a game loop.
There is also a variable "active" which determines if a key is being held down. Thus if the left key is being held down active is on and ...
0
votes
1answer
137 views
Passing elapsed time to the update function from the game loop
I want to pass the time elapsed to the update() method as this would make easy to implement the animations and time related concepts.
Here's my game-loop.
public void gameLoop(){
boolean running ...
5
votes
1answer
389 views
When to detect collisions in game loop
My game loop uses a fixed time step to do "physics" updates, say every 20 ms. In here I move objects. I draw frames as frequently as possible. I work out a value between 0 and 1 to represent the ...
4
votes
2answers
260 views
How to store the state of the world for a fixed time step?
Most of the posts on fixed time steps say something like this:
State previous;
State current;
while ( !quit )
{
double newTime = time();
double frameTime = newTime - currentTime;
if ( ...