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 / Need to make multiple random pickups with collisions.

Author
Message
laser_beam
16
Years of Service
User Offline
Joined: 29th Jun 2010
Location:
Posted: 24th Jul 2010 16:47
(i first make a sphere for a pickup)
rem Make pickup
make object sphere 1000, 0.2
position object 1000, 5, 1, 5

(then set object collision)
rem Collision
if object collision (1000, 1)
hide object 1000
score = score+1
endif
------------------------------------
How can i make this for multiple pickups and collisions to be set for the ammount of pickups i specify. Please help.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 24th Jul 2010 18:00
First duplicate the "pickup" by either using clone object or instance object. Since you are using a sphere, you can just make object.
Second you can either make a loop to test each object against one another or you can get a .dll like sparky's to do it for you. Considering you are using spheres, I would simply use DBP's internal collision detection:
In the help, go to "Commands" "Basic 3D" "COLLISION COMMANDS". That's a good place to start.

The fastest code is the code never written.
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 25th Jul 2010 05:11
Use a FOR/NEXT loop to cycle through your pickup objects. For example, say your pickup objects were objects number 1000 to 2000. You would check each one like this:




Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2026-07-25 07:02:25
Your offset time is: 2026-07-25 07:02:25