AIs x and y set to 0 though still moving

You must understand the Game Editor concepts, before post here.

AIs x and y set to 0 though still moving

Postby savvy » Sat Sep 11, 2010 8:02 pm

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.
Attachments
game.zip
(466.22 KiB) Downloaded 109 times
Last edited by savvy on Mon Sep 13, 2010 4:21 pm, edited 1 time in total.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

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

Postby skydereign » Sat Sep 11, 2010 10:39 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

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

Postby savvy » Sun Sep 12, 2010 8:46 am

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
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

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

Postby skydereign » Sun Sep 12, 2010 9:23 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: TOPIC CLOSED

Postby savvy » Sat Sep 18, 2010 10:49 am

i used xscreen yscreen instead, it was a GE glitch with the x y coordinates.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: TOPIC CLOSED

Postby skydereign » Sat Sep 18, 2010 8:27 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest

cron