Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Face me and shoot!

Author
Message
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 7th Oct 2003 01:51
hello people,
can some one show me how to make an enemy face my direction and shoot at me where ever my direction is in a certain position?
thankx

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)
PoHa!84
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 7th Oct 2003 02:10
You would first have to set the players position (x,y, and z) to variables. Then, when you want the enemy to look at you, then point the enemy's object towards the player using the previous variables. Then have him shoot. Or do you not know how to do that either?

Helpful?

Destroy you with my mind, I could!
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 7th Oct 2003 04:19
angle = wrapvalue(atanfull(x1-x2,z1-z2))

That should give you the angle between to characters. X2,Z2 are the coordinates of the character you want to rotate towards the other point.
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 9th Oct 2003 00:58
hi guys,
Phaelax i didnt get ur method, but i found a way, i think there might be a slight problem, the enemy faces me where ever i go, but faces me with his back!
here's the code, help me out!

this is an enemy gaurding a wall, coming and going, when i enter his parameters he raises his gun at me.

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Oct 2003 05:06
If his back is towards you, then he must rotate another 180 degrees to face you, right? So just add 180 to the enemy's rotation.
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 10th Oct 2003 04:16
thankx alot!

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)
Beta 1
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 10th Oct 2003 16:14
Or it could be your model is facing the wrong way in which case load it into you rmodelling program and turn it round. alternatively after loading the model YROTATE OBJECT n,180:FIX OBJECT PIVOT n where n is the number of the object.
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 10th Oct 2003 17:40
yea, i figured that out thankx guyz!

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)

Login to post a reply

Server time is: 2025-05-20 13:55:46
Your offset time is: 2025-05-20 13:55:46