Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 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 | chip programmers | 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