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 Professional Discussion / Detecting object number?

Author
Message
Zeus
20
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 14th Sep 2010 23:52
Alright, there are multiple objects that I do not know the object number for due to it being loaded from a level editor which I made. I need to detect collision with those unknown object numbers. How do I detect the object number so I can detect collision between the player and that object? Will I have to set up an array or what?

Thanks!
Zeus
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 15th Sep 2010 00:23
Yup, there are a few ways to think about it.

It would be useful either way to have an array of objects which you load, each of which contain the object number and any other information. Furthermore, you should have an array of levels, which contains, amongst other things, the first and last object of the level. If the current level is 3, check between objects Levels(3).first and Levels(3).last. If you don't know about Types, look them up.

"everyone forgets a semi-colon sometimes." - Phaelax
Zeus
20
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 15th Sep 2010 00:27
How would I set up the collision code? I got as far as the arrays that know the object numbers but I couldn't quite check to see if they were colliding.
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 15th Sep 2010 00:35
have you checked out sparky's collision? http://forum.thegamecreators.com/?m=forum_view&t=74762&b=5


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Zeus
20
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 15th Sep 2010 00:39
Yes but I am trying to get by this with just native DBP commands and I would prefer not too.
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 15th Sep 2010 01:11 Edited at: 15th Sep 2010 01:12
well in that case, the quickest command i can think of would be


but that is very inaccurate and i think it only goes by OBB, and if so it's unusable to detect collision against the world. there's also

which you can use creatively to suit your needs, especially when colliding with the world.

but srsly, these commands can get slow when used a lot and don't offer much, and there's no shame in using addons.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 15th Sep 2010 17:28
Quote: "Yes but I am trying to get by this with just native DBP commands"


Why?

Login to post a reply

Server time is: 2026-07-22 12:41:34
Your offset time is: 2026-07-22 12:41:34