# Tag Info

3

You need to implement some sort of a timer. A basic implementation could work like the following: start by calculating the next time when a block should move, which might look something like nextMoveTime = SDL_GetTicks() + 200;. Then, each frame/update cycle, you would check if enough time has passed and if so, move the block. So something simple like if (...

2

It s a bit unclear what you are asking, in particular what you mean by "gametic". A computer game re-paints the screen repeatedly. Between two re-paints you have a delta time T, typically 0.01...0.03 s. Say it is 0.02 s this time - note however that it fluctuates. Then you can calculate the physics & movement over a single calculation, to which you ...

1

This is called arrival. It's a steering behavior. The basic concept is: Apply an acceleration towards the target position (alternatively, you can simply set the velocity if you're not using acceleration) When within a defined range of the target object, start applying acceleration away from the object, this acceleration is scaled based on the distance to ...

1

I havent done much on these lines. But every object should recive (time_elapsed) and calculate new position accordingly. They should check for possible collision with static objects, and react (change of direction / state). As far as other closer moving objects, you will have to do some hack (either treat the slower one as static, or get its ...

1

In nutshell your a movement would look something like this: speedX speedY for vertical and horizontal speed. You have a velocityX and velocityY for example. Lets say its a top down game. And you have your positions like posX and posY. Every tick you update your positions: posX += speedX; posY += speedY; You assing a value to velocity like 0.2. In you ...

Only top voted, non community-wiki answers of a minimum length are eligible