I want to make a game like chrome://dino using SDL, but i don't know how to make dino run.
I think it has something to do with switching between the two photos, but i can't find any SDL tutorials about this situation. Can someone help me?
Asked
Active
Viewed 26 times
0

HolyBlackCat
- 78,603
- 9
- 131
- 207

Boris5581
- 1
- 2
-
First, you need an [update function](https://gafferongames.com/post/fix_your_timestep/) that's called a fixed amount of times per second, and a counter that is incremented every update. Then, in your rendering function, you take something like `counter / n % 2` (which will give you `0` or `1`, which image to draw) and use it to decide what image to draw. Most of this is straightforward, so can you tell us what part you don't understand? – HolyBlackCat Jun 20 '23 at 05:59
-
I'm a newbie about SDL, thank you for providing the information. I'll come back if i have any question. – Boris5581 Jun 21 '23 at 09:13