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.

Newcomers DBPro Corner / help with enemy AI

Author
Message
battleman100
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 27th Jun 2003 01:10
Hello there! I'm trying my best to make a kind of 'cat & mouse' game in 3D using DBPro. I've created a game 'zone' (a simple matrix), my character (a 3D object 'stuck' to the camera - 3D person perspective style) and an enemy (a 3D object).

However - I want to get it so my enemy, who starts at the opposite end of the zone (don't worry no walls/objects in the way ) , 'chases' me.

I think I need to make it so the enemy rotates until it points in my direction and then moves at the same pace towards me until we 'collide'. Therefore, if I make a circling motion, the enemy does the same.

I've tried my best to create something, but my attempts have all failed Please, please help!
Uriel The Ignoble
21
Years of Service
User Offline
Joined: 13th Jun 2003
Location: In a tiny box in the attic
Posted: 27th Jun 2003 04:36
you could try using something like
set object to object orientation catobjectnumber, player object number
then move catobjectnumber, speed

as long as you already have the object set to only move along the matrix it should probally work.. if you dont you have to use something like..
x = newvalue(cats_oldspot_x,cats_object_angle_y,speed)
z = newvalue(cats_oldspot_z,cats-object_angle_y,speed)
y = get ground height(matrixnumber,cat_x_position,cat_z_position)
position object catnumber,x,y,z

but u still have to point the cat object at the mouse object

Uriel The Ignoble
21
Years of Service
User Offline
Joined: 13th Jun 2003
Location: In a tiny box in the attic
Posted: 27th Jun 2003 04:38
oops.. ignore the 1st part.. set object to object orientation will make the cat object face the same direction as the mouse object :-p

use point object catnumber, mouse_x,mouse_y,mouse_z

i hope that helps

battleman100
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 27th Jun 2003 23:31 Edited at: 28th Jun 2003 03:18
Well it's not perfect, but it sure helped out a lot! Thank you!

EDIT: Managed to get it working - just needed to add a line telling the 3D model to fix itself to a point. Interesting side effect tho' - as it checks both X and Z axis '1-by-1' it creates a kinda jaggy diagonal 'homing' effect that actually makes the cat look even more clever than it really is - cheers v. much for your help!

Login to post a reply

Server time is: 2024-09-20 13:32:04
Your offset time is: 2024-09-20 13:32:04