Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (AndrewAMD), 14,661 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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