1 decade ago by davidx
Hi,
I have a simple game, sprite travels forward at set speed. Hold the mouse down and it accends, release the mouse and it falls again.
I want to introduce a replay button when the level ends, my thought is to create an array in the sprite entity and push a 1 every time the mouse is down else a 0. The when replay is pressed, POP the value from the array every update iteration and accend if 1 else nothing.
Does this sound like a good approach? I think that even if the frame rate changes during replay, i.e. is different than game play, this should still work as the x position will only change on the update call anyway?
Or is there a better way to achieve this? Btw, I have no enemies to consider.
Thanks.
I have a simple game, sprite travels forward at set speed. Hold the mouse down and it accends, release the mouse and it falls again.
I want to introduce a replay button when the level ends, my thought is to create an array in the sprite entity and push a 1 every time the mouse is down else a 0. The when replay is pressed, POP the value from the array every update iteration and accend if 1 else nothing.
Does this sound like a good approach? I think that even if the frame rate changes during replay, i.e. is different than game play, this should still work as the x position will only change on the update call anyway?
Or is there a better way to achieve this? Btw, I have no enemies to consider.
Thanks.