Page 1 of 1

Creating 425 actors

PostPosted: Sun Feb 25, 2007 11:57 am
by Troodon
Hi,
How can I make the 'create actor' make for example 425 actors?
I'm working on a graphic effect and I need to have big amounts of different actors created randombly in the screen. However I don't know how to make many actor at once without typing 400 lines of code.
:wink: Please help.

PostPosted: Sun Feb 25, 2007 1:30 pm
by Sgt. Sparky
how big is the screen?
for a 800x600 screen use:
Code: Select all
CreateActor("Particle", "particleAnimation", "(none)", "(none)", rand(800), rand(600), false);

:D
and if you Game is 30fps,
it will create 30 actors a second :D

PostPosted: Sun Feb 25, 2007 2:06 pm
by Troodon
Sparky, I don't want to have 30 actors in second, I want to have n amount of actors in one event once.

For example think that you are making a game where you are on a planet. You want to have in the beginning of the game a random nature (trees, stones etc). You think that the island looks natural when it has 80 trees in random position. It would look pretty weird if your actor should avoid trees growing everywhere every second, wouldn't it? :wink:

PostPosted: Mon Feb 26, 2007 12:02 am
by Sgt. Sparky
okay,
on the create actor Event do that 425 times....
I do no know any other way :(

PostPosted: Mon Feb 26, 2007 12:21 am
by makslane
Try this:

Code: Select all
int i;

for(i = 0; i < 425; i++)
{
  CreateActor("Particle", "particleAnimation", "(none)", "(none)", rand(800), rand(600), false);
}

PostPosted: Mon Feb 26, 2007 1:49 pm
by Troodon
It works like a new cow! Thanks! :D :D