Page 1 of 1

need help with Loops

Posted: Wed Apr 27, 2016 10:55 pm
by sesco
ok so i have 2 Sprites (Sprite1, Sprite2) and I have a loop routine working with Sprite1 fine but I also want Sprite2 to run the same loop as well.
How do get Sprite 2 routine going at the same time as Sprite 1 on the screen since Sprite 1 loop has " Repeat/ WaitEvent/ Forever" to make it work continuously.

Re: need help with Loops

Posted: Wed Apr 27, 2016 11:55 pm
by sesco
lol ok played around and put loop2 inside the loop1 and all ok :D

Re: need help with Loops

Posted: Thu Apr 28, 2016 8:48 am
by Bugala
If you want more control, possibility to control both sprites separately, you could look at "SetInterval" command.

Idea with SetInterval is that you can make a loop that is being executed while "WaitEvent" is waiting for something to happen.

You can set several intervals, for example, one for each sprite loops, and then you can turn these intervals (=loops) on and off as you wish, making it possible to run only one of the loops, both of the loops at same time or neither of them as you wish.

Re: need help with Loops

Posted: Thu Apr 28, 2016 10:52 pm
by sesco
@ Bugala

thanks for the tip :)