Page 3 of 3

Re: damn!

PostPosted: Tue Apr 24, 2007 3:40 am
by Sgt. Sparky
d-soldier wrote:... So I re-rendered my walker... For some reason I cant even get the new version to do what I want... The rotating top piece is parented to the legs, and should rotate around and follow the player (tried both 180 and 360 angles for this)... Anyone?!?

if the top piece has 2 animations(left and right)
and each animation is 1 frame, use this code on its draw actor event,
Code: Select all
if(player.x < x)ChangeAnimation("Event Actor", "your_animation_for_left", FORWARD);
if(player.x >= x)ChangeAnimation("Event Actor", "your_animation_for_right", FORWARD);

:D

....

PostPosted: Tue Apr 24, 2007 7:35 am
by d-soldier
Man... figured it out, I was saying "animpos" when my brain was thinking "animindex" ... man I was getting frustrated... anyway, for anyone else reading this to accomplish the same goal here. It's:

(In the enemy draw actor script: In this case animindex0 is the animated enemy walking right, and animindex1 is him walking left.)

if(animindex == 0 )dir = 0;
if(animindex == 1 )dir = 1;

(This in the event that causes the enemy to shoot, in this case a timer)

if(dir == 0 && player.x > x) {
CreateActor("Rocket", "Rocket360", "(none)", "(none)", 25, -42, false);;
}
if(dir == 1 && player.x < x) {
CreateActor("Rocket", "Rocket360", "(none)", "(none)", -25, -42, false);;

}
Thanks Sparky

PostPosted: Tue Apr 24, 2007 4:14 pm
by Sgt. Sparky
you're welcome. :D

PostPosted: Tue Apr 24, 2007 11:59 pm
by Game A Gogo
Code: Select all
if(animindex == 0 )dir = 0;
if(animindex == 1 )dir = 1;


Can be replaced by

Code: Select all
dir=animindex;

PostPosted: Wed Apr 25, 2007 1:23 am
by Sgt. Sparky
Yes, xD
I orrigonally gave him the code so he could use it with velocity then
it got switched it around to animindex. :D