Page 1 of 1

actor changes animation at a special score...

PostPosted: Tue Jul 25, 2006 12:03 pm
by Diana Kennedy
Hi

This is what I want to make:

The actor "reiter2" should change its animation if the score reaches a certain value. What would be the best way to vdo this? I thought in "drawing actor, script editor:



Code: Select all
if (score.textNumber>=-150)
changeAnimation...there I don't know how to continue...


Any idea would be greatly apreciated!

PostPosted: Tue Jul 25, 2006 2:06 pm
by makslane
Use the 'variables/funciton' list, select the ChangeAnimation and put the values in the panel.

PostPosted: Tue Jul 25, 2006 6:32 pm
by irblinx
I try to keep use of draw actor to a minimum, I've read here of a big performance hit for this.

In any case I think that your code would be better placed wherever you update the score from so that once you update the score use an "if" statement to check if it equals the required amount and then change the anim on your actor.

PostPosted: Mon Oct 16, 2006 9:38 pm
by Diana Kennedy
makslane wrote:Use the 'variables/funciton' list, select the ChangeAnimation and put the values in the panel.


Hm, I am afraid, I did not understand quite well. In which actor should I open the script editior? The score, the character who wil have to change its animation or in global code?

Is this code right?:

Code: Select all
if (score.textNumber>=-150);
ChangeAnimation("reiter2", "faint01", FORWARD);


At least, this in the global code doesn't work :(

PostPosted: Mon Oct 16, 2006 10:07 pm
by makslane
Remove the ; after the if command:


Code: Select all
if (score.textNumber>=-150)
{
  ChangeAnimation("reiter2", "faint01", FORWARD);
}


You can put this code in the actor thats change the score value

PostPosted: Wed Oct 18, 2006 9:37 pm
by Diana Kennedy
You can put this code in the actor thats change the score value


Well, that will be very tricky, because several actors change the score: There are the swords that change the score when colliding with the ghosts and the Ghost change it when collide with the horseman:

Image

Isn't there a global and easy way to make things happen when a certain score is reached?

This would be very helpful in any case.

PostPosted: Wed Oct 18, 2006 9:45 pm
by makslane
You can put in the 'Draw Actor' event of some actor

PostPosted: Thu Oct 19, 2006 6:55 pm
by Diana Kennedy
I tried several actors, but everytime the same thing happens: The rider (the actor that should change the animation at the certain score) remains "fixed" on he first frame of the said animation, without that the score is reached. :-(

PostPosted: Thu Oct 19, 2006 11:55 pm
by makslane
Are you updating the 'score.textNumber' variable?

PostPosted: Fri Oct 20, 2006 12:55 am
by DilloDude
This would probably be because you are continually checking the score and changing the animation. You should check another variable (such as an animindex to find the animation) or disable the draw actor event to stop checking.