Looping using For

Non-platform specific questions.

Looping using For

Postby jazz_e_bob » Thu Oct 30, 2003 3:49 am

Why doesn't this code create 100 big rocks?

int t;
int TotalBigRocks = 100;
for (t = 1; t < 100; t++)
{
CreateActor("rockBig", "rockBig", "no parent", "no path", 0, 0, false);
}
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Thu Oct 30, 2003 11:32 am

It is creating all in the same position 0, 0
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jazz_e_bob » Thu Oct 30, 2003 7:00 pm

I thought so too but each rock has a random angle and directional velocity. I imagined they would fan out from the one position.

Maybe I should be using a timer as a loop instead?
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Thu Oct 30, 2003 8:32 pm

New bug here...
It is very strange, it happens when calls CreateActor in loop like for or while.

Try use a timer: Periodic, 12ms, 100 times
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jazz_e_bob » Fri Oct 31, 2003 2:52 am

Yes, I tried the timer method. Works well. :)
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest