sleep() ??
by Dan Pereira · in iTorque 2D · 04/07/2009 (5:18 pm) · 5 replies
Hey all,
Is there an iTGB command that performs a wait or a sleep. For example, I want to display four explosions like - pow...pow...pow...pow without using schedule. Is there a sleep or wait command? Using schedule doesn't seem to work very well with complex objects and recursive method calls in loops with changing parameters so I need a simple **pause for a moment** type of command. Any ideas? I thought I read something about timers, but it wasn't documented well enough for my feeble brain to absorb.
Thanks,
Dan
#2
04/08/2009 (2:52 pm)
Thanks for the response, but that isn't going to work in this case. I need a sleep() function, or I need to rework my code. This is in a recursive path-finding function that calls itself if it determines that it can move in four degrees of freedom. I think there is an issue with calling schedule recursively because the engine crashes with no error in the log when I call schedule from the recursive function. If I put the call outside the recursion, it works fine.
#3
04/08/2009 (11:31 pm)
Tower Defense game Dan?
#4
04/09/2009 (12:08 am)
Nope, a cool little puzzle game. I use pathfinding to determine which moves are legal and if any legal moves are left on the game board. This game is also accelerometer driven so rotating the device in different directions adds an element to the game. My kids say it's fun and addicting so I hope peeps on the app store think so too. I've got the core game logic working fine, but I want to add embellishments to make the game more fun, yet I'm finding that to be harder than I thought. It's easy to tumble sprites around a game board, but when I try to make them pop or spin in a certain order with a predefined rhythm my mastery of iTGB really falls short. Schedule doesn't work for what I want to do because it schedules the task and then keeps on going and I need it to just wait until the scheduled task is complete. I haven't figured out how to accomplish this yet. I'm sure I'm missing something.
#5
Sleep / Pause does not exist, Schedule is all you have
04/09/2009 (12:43 am)
Well then you have to rework your code.Sleep / Pause does not exist, Schedule is all you have
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
TGB by definition has no pause / sleep capability.
What you need to do is take the rest of the function, create a new function from it and schedule it to run "in a moment" or whenever you want the rest to continue.
Thats a bit troublesome especially as it potentially can mean a fair amount of data passing on, but actually the way to go.