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 / Object collision question

Author
Message
haXor
21
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 27th Jun 2003 20:59
Well i was working on the basic of basic AI, which is the enemy(cube) looks at the player (shpere) and chases it down and when it catches it starts puching it. Now, i did all this fine, but the question actualy comes in the collision. The collision works, i use the Set object collision to spheres and cubes command. Now this may always happen, but when the vube catches up to the sphere, it will always push towards 0,0,0, or the point which the camera and objects always appear before they are positioned. I put the code in below. does anyone see somthing wringe with it? thanks
~haXor

PS: no media required, made for DBPro
Sup Kids
Xeridox
21
Years of Service
User Offline
Joined: 19th May 2003
Playing: Scrap Mechanic
Posted: 28th Jun 2003 03:18
Take a look at everything before this line:

If Object collision(10,0)>0 then position object 10,X#-5,y#,z#-5

and you will see there is no previous statements defining what x#,y#, and z# are, so they will always be equal to 0

you need something like X#=object position x(object #) and so on for Y# and Z#

IRC Channel: #darkbasic on server irc.uk-net.org Ports 6667 or 6668. Helpers and game serves welcome!
haXor
21
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 28th Jun 2003 03:27
o i have those for a dif part of code, sry i forgot to mention that. That isnt the prob. can any1 else figure it out? thanks
~haXor

Sup Kids
Xeridox
21
Years of Service
User Offline
Joined: 19th May 2003
Playing: Scrap Mechanic
Posted: 28th Jun 2003 05:18
Ahh OK now I see the problem.
The line I described earlier is the problem though, but not as I had spoke of before. You need to re-do your code something like this:

- Get x,y,and z (like old_X#=X#, etc)
- make object movements
- if collision, restore object to old x,y,and z.

Unless you're trying to get the enemy to push you around, then you could try rotating your player object to the same as the enemy by using rotate object (not point object). Then just move the player forward with move object by however many steps the enemy moves.

Hope that clears things up a bit!

Cheers,
--Xeridox

IRC Channel: #darkbasic on server irc.uk-net.org Ports 6667 or 6668. Helpers and game serves welcome!

Login to post a reply

Server time is: 2024-09-20 13:29:56
Your offset time is: 2024-09-20 13:29:56