Page 1 of 1

AIs x and y set to 0 though still moving

PostPosted: Sat Sep 11, 2010 8:02 pm
by savvy
for some reason the AIs respond to where the character is in relation to 0, not themselves. idk why, can someone pls help.
i can tell theyre responding to 0 because of the change direction from left to right thing.
they change when the player passes through 0 (<0 or >0).
PLEASE solve this otherwise my game is screwed for simple AIs.

Re: AIs x and y set to 0 though still moving

PostPosted: Sat Sep 11, 2010 10:39 pm
by skydereign
Actually it doesn't look like they have any code at all. The actor is following its animation, so it repeats making it look like it is changing direction. You would need to add a draw event to the actor, also ChangeAnimationDirection on the create. I can implement it where the actor is facing the player, perhaps aiming as well, but not quite sure how you have structured this.

Re: AIs x and y set to 0 though still moving

PostPosted: Sun Sep 12, 2010 8:46 am
by savvy
i have added that, look on the chainsawer_body actor, its in there.
it was originally a follow the player thing, but i changed it to the thriller left right thing to test the problem

paste:
Code: Select all
angle=direction(x,y,gunarm.x,gunarm.y);animpos=(angle/360)*100;

into the chansawer_bodys draw actor, and delete whats already in there.
then jump around where 0 is and youll see what i mean

Re: AIs x and y set to 0 though still moving

PostPosted: Sun Sep 12, 2010 9:23 am
by skydereign
Use this code instead.
Code: Select all
angle=direction(x,y,gunarm.x-parent.x,gunarm.y-parent.y);
animpos=(angle/360)*100;


Since the actor is parented to the legs, the chainsawer_body's xy coordinates are relative to the parent. By subtracting the parent's xy, it resets it to normal xy coordinates.

Re: TOPIC CLOSED

PostPosted: Sat Sep 18, 2010 10:49 am
by savvy
i used xscreen yscreen instead, it was a GE glitch with the x y coordinates.

Re: TOPIC CLOSED

PostPosted: Sat Sep 18, 2010 8:27 pm
by skydereign
No actually that is how parent influences x and y. They become relative, using xscreen yscreen does the same thing as what I did, just slightly differently.