Looping the game
I made this game but when the game ends, I need to restart every game each time. How can I loop it so I can play another game right after
15 Replies
The best way to loop a piece of code, is to... use a loop
A
do...while loop works well for this purpose
Or a basic while loopokay
a while (true) works ?
Sure
As long as you remember to
break out of it to end the game
Otherwise it will just run foreverso I can make an option to continue the game or to stop it with this ?
ye
I'll try
just to know if the player still wants to play what do I do
I do a return; ?
That should work, yeah
Or
break, seeing how you're in a loop
Ah
On "yes" just don't do anything
Just don't have that
else ifok
so if yes then nothing happens
and it will continue
Yep
it's working
thanks!
:Ok: