Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Can you repeat a loop?

Author
Message
FrankieV
14
Years of Service
User Offline
Joined: 10th Jun 2010
Location:
Posted: 25th Jun 2010 21:52
Is it possible to conditionally restart a loop from within itself?

Running a game loop, and I want to restart after a sprite collision.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 25th Jun 2010 22:45 Edited at: 25th Jun 2010 22:49
you can do anything
it depends on your code's structure, we cant tell you how to do this because there are unlimited ways to create an application, we can't just guess how your code looks like

pseudo code is enough to show the structure tho

but in general, it would be like this (in gdk):
reset all the variables if you have any -in some cases you don't want to reset some variables, like a variable that counts how many times the loop repeated, you probably dont want to reset it-
reset all (objects/sprites/whatever)'s location/rotation/scale/whatever, same as above, you might not want to reset some specific objects
use "continue" keyword, it just go to the beginning of a loop (for/do/while)

Login to post a reply

Server time is: 2024-07-04 10:36:45
Your offset time is: 2024-07-04 10:36:45