creating actor,changing animation immediately - doesnt work?

Game Editor comments and discussion.

creating actor,changing animation immediately - doesnt work?

Postby sonicfire » Sat Jun 30, 2007 9:45 pm

hi folks! :D

another little problem here that i cant fix and dont know why:

i have an "explosion"-actor. it holds 10 animations of little explosions. i assigned the first one to it.

now, i create this actor somewhere in a game when i hit a certain object. no problems so far. trouble starts here:

i use a simple
Code: Select all
temp = floor(rand(9));
if (temp = 0)
{
    ChangeAnimation("Event Actor", "bluexeplo1_", FORWARD);
}
if (temp = 1)
{
    ChangeAnimation("Event Actor", "bluexeplo2_", FORWARD);
}

(...) and so on ....


in the Actor Create-Event. So hopefully you get the picture.

The problem is however, it simply doesn´t change its animation. Am i thinking totally wrong? I though immediately after the actor has been created it should have "become" a new animation ... :(
Sadly, it always just plays the animation that i´ve selected in GE itself....

Fun thing is: I tried the same using Sounds (to play random explosion-sounds and this DOES work!

Can anybody enlighten me, please? :oops:
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby sonicfire » Sat Jun 30, 2007 9:49 pm

Wait a minute ... could it be because of the "Event Actor"? :shock:
Since its only created ... um, does that cound as an event? I mean... damn, hard to explain in english :oops: :lol:

EDIT: The Creator-Actor that creates THIS explosion-actor is the Event Actor in this very moment?! Could that be my mistake?
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby d-soldier » Sat Jun 30, 2007 9:52 pm

Try this in the create-actor script:

int n;
n=rand(30);
if (n<=10 && n>=0)
{
//INSERT CHANGEANIMATION SCRIPT HERE
}
if (n<=20 && n>=10)
{
//INSERT CHANGEANIMATION SCRIPT HERE
}
if (n<=31 && n>=20)
{
//INSERT CHANGEANIMATION SCRIPT HERE
}

Be sure that the actor has all these different animations you under it's ANIMATION drop-down button, and modify the "//INSERT" part to be a "CHANGEANIMATION SCRIPT" applying a different animation (animindex) for each of 'em. see if that works better then your other code.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby sonicfire » Sat Jun 30, 2007 10:16 pm

thanks again!
will give it a go! :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Postby Kodo » Sat Jun 30, 2007 10:50 pm

sonicfire, there are problems with your conditional statements!

if (temp = 0)
{
ChangeAnimation("Event Actor", "bluexeplo1_", FORWARD);
}
if (temp = 1)
{


should be written

Code: Select all
if (temp == 0)
{
    ChangeAnimation("Event Actor", "bluexeplo1_", FORWARD);
}
if (temp == 1)
{

Note that == should be used when comparing values, = on its own just assigns the value. So what you are actually doing with your code is just assigning values and not testing them!
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Postby sonicfire » Sat Jun 30, 2007 11:32 pm

Oops! :shock: I did it again :lol: Sorry for this! My fault, thanks very much!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron