This site requires JavaScript, please enable it in your browser!
Greenfoot back
h123n
h123n wrote ...

2013/5/30

Delay for objects

h123n h123n

2013/5/30

#
I've been working on a game where you have lots of challenges and have to go round collecting gems. I want to make an animation type of thing for my game to show the story so far, I thought if I had something to delay just one object, I could move let's say an arm, wait for about 5 seconds then move again. I know there is a greenfoot.delay method but that delay's the entire game. Could I do it in a way so that it doesn't do this? Thanks.
Gevater_Tod4711 Gevater_Tod4711

2013/5/30

#
Greenfoot.delay will always pause the execution of the whole game. The only way to let one actor pause for a certain time is to add a delay counter to the object. Like an int that counts down to 0 and then the execution goes on.
h123n h123n

2013/5/30

#
But how would I be able to do that? Ints go down almost immediately and don't cause much delay.
Gevater_Tod4711 Gevater_Tod4711

2013/5/30

#
Im currently programming a super class for delays. If you give me about 15 minutes I can upload this superclass and post the link.
h123n h123n

2013/5/30

#
Ok, thanks!
Gevater_Tod4711 Gevater_Tod4711

2013/5/30

#
I'm sorry it took a bit longer but now here the demo is: link
h123n h123n

2013/5/30

#
Ok thank you for the demo =D I am going to look into it now.
You need to login to post a reply.