I was just wondering, is there a way to put an end to an endless runner gamemod? And how can I do this?
Yes and depends what you want to achieve.
You basically need two things.
- A condition after which the level ends. This can be a amount of tiles that were generated, the distance your character moved, the amount of coins collected or whatever.
- “Level Finished” behavior. What should happen once your level is done? A level selection screen? Simple restart? Just a small options window to select between those two.
After your condition is met just call a function which runs your “Level Finished” behavior and your done.
How can I set a amount of tiles generation?
You will have to count it and implement that logic by yourself.
Sure, but at the moment my tiles spawn in loop, what I put in his place?
Oooh, I get it, thanks for the help
All possible tiles at once? If so then you have a none issue. You just have to make sure the last one has some kind of routine which finishes the level.