random animation

Game Editor comments and discussion.

random animation

Postby frodo » Tue Mar 21, 2006 10:03 pm

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!
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby Fuzzy » Wed Mar 22, 2006 3:27 am

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}
}
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby frodo » Wed Mar 22, 2006 3:34 am

sorry, be more specific!
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby Fuzzy » Wed Mar 22, 2006 4:11 am

ok. how are you placing the actors?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby frodo » Wed Mar 22, 2006 4:14 am

I just have one actor, with my two animations. I want to have a random animation come up when the actor is created.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby Fuzzy » Wed Mar 22, 2006 4:35 am

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?
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby frodo » Wed Mar 22, 2006 2:03 pm

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
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby Novice » Wed Mar 22, 2006 6:21 pm

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.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby makslane » Wed Mar 22, 2006 6:49 pm

makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby frodo » Wed Mar 22, 2006 7:19 pm

THANKS NOVICE! You're great!
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score

Postby DilloDude » Sat Apr 08, 2006 6:12 am

You could also use
Code: Select all
ChangeAnimation("Event Actor", getAnimName(round(rand(numberofanimations))), FORWARD);
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest