Gamestudio Links
Zorro Links
Newest Posts
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
Camera always moves upwards?
by NeoDumont. 11/14/25 16:32
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
Alpaca Plugin v1.4.0
by TipmyPip. 10/20/25 18:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 8,527 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Enemy turns always to player (code change?) #327662
06/07/10 19:00
06/07/10 19:00
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Hi I got a code for an enemy, which allows him to turn himself always where the player is. My question is: How can I change the code, so that the enemy will not turn up when I jump. I just want that he only turns into horizontal direction of the player not additionally into vertical.

Here is my code snippet that I use:
Code:
vec_set(temp, player.x); 
vec_sub(temp,my.x); 
vec_to_angle(my.pan, temp); // Turn towards player




1338, beyond leet.
Re: Enemy turns always to player (code change?) [Re: h34dl4g] #327667
06/07/10 19:11
06/07/10 19:11
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Code:
ANGLE temp_ang;
...
vec_set(temp, player.x); 
vec_sub(temp,my.x); 
vec_to_angle(temp_ang.pan, temp); // Turn towards player
my.pan = temp_ang.pan;



Re: Enemy turns always to player (code change?) [Re: Widi] #327677
06/07/10 19:42
06/07/10 19:42
Joined: May 2010
Posts: 23
Germany
h34dl4g Offline OP
Newbie
h34dl4g  Offline OP
Newbie

Joined: May 2010
Posts: 23
Germany
Oh, I thought the wrong way...
I'll try it and give feedback after that.
Thanks for the code.

EDIT: Thank you, it worked great. I had never used "ANGLE" before...


Last edited by h34dl4g; 06/07/10 19:54.

1338, beyond leet.
Re: Enemy turns always to player (code change?) [Re: h34dl4g] #327687
06/07/10 20:50
06/07/10 20:50
Joined: Jun 2008
Posts: 428
Rasch Offline
Senior Member
Rasch  Offline
Senior Member

Joined: Jun 2008
Posts: 428
You could also use this.

VECTOR temp;

vec_set(temp, player.x);
vec_sub(temp,my.x);
vec_to_angle(my.pan, temp);

my.tilt = 0;


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1