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 / Pickup object and get points

Author
Message
TylerTheLizard
2
Years of Service
User Offline
Joined: 26th Sep 2016
Location:
Posted: 2nd Nov 2016 14:01
So I have been trying to figure out a way to pickup a sphere and make it vanish and add x amount of points to the player's overall score on contact. So far I have been able to figure out that I can do something along the lines of

If collision (1)=2
delete object
endif

However beyond that I have no clue what to do. Anyone able to help?
LBFN
11
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 7th Nov 2016 04:12 Edited at: 7th Nov 2016 04:44
[EDIT} I am sorry, this is written for Dark Basic Professional (DBP) and will not work with Dark Basic Classic. I tried to re-write it for DBC, but I can't get the collision to work. If you are using DBP and just posted in the wrong forum, it should work for you.

Typically, you will only delete an object if you are not going to use it anymore. In the quick example below, I made a sphere to represent the enemy and a cube to represent the player. You can use the arrow keys to rotate and move. The 'player' is right in front of the camera and moves with the camera. You collide with the enemy and it hides the enemy object for two seconds and re-positions it. The score and FPS are printed at the top of the screen, using the Debug function. Hope this is helpful.




LB



So many games to code.....so little time.
Silverman
11
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 13th Nov 2016 17:37 Edited at: 13th Nov 2016 17:39
hi

For DBC, you need sparky_DBCcollisions_v1.05 to make that. See attachement.

Enjoy!
DirectX 9.0c (February 2010)/ DBClassic v1.20

Microsoft Windows XP Professionnel Version 2002 Service Pack 3
AMD Phenom(tm)II X4 965 processor 3.42GHz, 3.25 Go de RAM
GeForce GTX 560 Ti

Attachments

Login to view attachments
LBFN
11
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 22nd Nov 2016 03:28
Thanks for that dll Silverman



So many games to code.....so little time.

Login to post a reply

Server time is: 2018-12-13 20:34:13
Your offset time is: 2018-12-13 20:34:13