Page 1 of 1
random animation
Posted:
Tue Mar 21, 2006 10:03 pm
by frodo
I want to have a background that has two animations, a hill and a forest.
When I create my background actor, I want to choose randomly between the forest and the hill.
THANKS A BUNCH!
Posted:
Wed Mar 22, 2006 3:27 am
by Fuzzy
Is the background actor tiled infinitely? If so, It may not be possible.
If you are placing the background tiles by hand, then in the create actor event, do this
pick a random number... then use that to set the animation in script editor
- Code: Select all
factor = rand(amount);
switch(factor)
{
case 0: { do something here}
case 1: { do something else }
case 2: { factor = 3;}
case 3: { will cause this line to activate}
case x: { dont forget to include a case for each possible value}
}
Posted:
Wed Mar 22, 2006 3:34 am
by frodo
sorry, be more specific!
Posted:
Wed Mar 22, 2006 4:11 am
by Fuzzy
ok. how are you placing the actors?
Posted:
Wed Mar 22, 2006 4:14 am
by frodo
I just have one actor, with my two animations. I want to have a random animation come up when the actor is created.
Posted:
Wed Mar 22, 2006 4:35 am
by Fuzzy
Do you want them to all be the same at the same time, or all different?
That is, is the animation a full scene, or is it just a hill or tree that your want to use to build a scene with, and are you using the infinite setting for tiling?
Posted:
Wed Mar 22, 2006 2:03 pm
by frodo
I have just one actor... no clones, no tiles, no infinite. I just want my actor to have a random animation (still picture) when it is created. like, sometimes the hill, and sometimes the forest.
Thanks
Posted:
Wed Mar 22, 2006 6:21 pm
by Novice
On create actor
- Code: Select all
int i;
i= round(rand(1));
if (i==0) Change Animation (Hils.......);
else if (i==1) Change Animation (Trees.....);
I think this is what you need.
Posted:
Wed Mar 22, 2006 6:49 pm
by makslane
Posted:
Wed Mar 22, 2006 7:19 pm
by frodo
THANKS NOVICE! You're great!
Posted:
Sat Apr 08, 2006 6:12 am
by DilloDude
You could also use
- Code: Select all
ChangeAnimation("Event Actor", getAnimName(round(rand(numberofanimations))), FORWARD);