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

2011/3/6

A challenge...?

m.legere1323 m.legere1323

2011/3/6

#
Can anyone think of a simple way to sort through some array or string such that.... lets say you get a value 1, which corresponds to Object x...so then add that object x to the world, wait a certain amount of time, then look at the next value in the array or string and etc...?
JL235 JL235

2011/3/6

#
I don't quite follow your issue. Is it that you have an array of objects and you want to add the objects one at a time every couple of frames?
m.legere1323 m.legere1323

2011/3/6

#
Yes, that's right..sorry I admit that wasnt quite clear
davmac davmac

2011/3/7

#
Sounds like two items of state: 1. An index into the array 2. A counter to measure how much time (how many act() cycles) have elapsed So, you declared these as fields. Then in your act() method you check the counter, and see whether the required time has elapsed: if (counter == 0) { .... If the time has elapsed then you do whatever you want with the appropriate item in the array. If that doesn't help, I guess you need to make your question more specific :)
You need to login to post a reply.