Reputation: 1
My game is pretty simple, it consists in avoiding some falling objects. When the player collides with the object three times, a message appears saying "Game Over". And here comes my problem, I want to add a restart button, but I don't understand how to actually restart the game.
I've tried using scenes, but I don't understand how they work, can someone explain them to me?
Since the game is a single level, I've also tried avoiding them, and almost succeed, but I was unable to stop the collision detection. Is there a real alternative to scenes to restart the game?
Can someone please help me? Any tip is appreciated
Upvotes: 0
Views: 125
Reputation: 28940
To my knowledge there is no generic restart functionality in Solar2d.
You'll need to reset the state of your game to the beginning. How to do that and what to reset mainly depends on your game.
A good way would probably to remove and then add the scene again. You should make yourself familiar with the Composer library.
https://docs.coronalabs.com/guide/system/composer/index.html
I've tried using scenes, but I don't understand how they work, can someone explain them to me?
No. What particular aspect of Understanding Scenes have you not understood? Please don't expect us to rewrite a manual for you guessing what you might have trouble with.
Upvotes: 0