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 / collisions

Author
Message
BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 31st Mar 2006 19:43
hi i am making a game where if the sphere hits the box it will hide the box iam having as problem witht the engine though, i can make the sphere detect the cube, and if i know the object number then i can hide the cude or whatever, is there a way basic can find the cube number that the sphere has detected and then delete it



abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 31st Mar 2006 20:00 Edited at: 31st Mar 2006 20:02
yes there is a way, it all depends on how you code it

If per say you had 50 box's and your collistion code was something like

The following code will not work, but is the basic structure of what u need


BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 31st Mar 2006 20:06
thanks, i just figured out how to do it just before you posted was about to post my code here it is:


what i needed to do was think from the box's perspective rather than the spheres

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 31st Mar 2006 21:58
just found another problem javascript:smiley(':\'(')
cry when the sphere hides the object, the points are added but unfortunately, they keep getting added and added until the sphere is away from the square and if the sphere goes back to the place where the square WAS it keeps going up also. heres the code what i did



i want it so that you can only get one pointe for every square you go over how can i do this any ideas?

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 31st Mar 2006 22:01 Edited at: 31st Mar 2006 22:02
your only hiding the object, it will still b adding the points if it is in the same position, try hiding the box AND moving it to somewhere the player cannot go like,



BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 1st Apr 2006 00:47 Edited at: 1st Apr 2006 00:53
hi, tried that one, it works for the first one, then if i go to the second box, the points keep climbing, and dont stop even if i move away from where the box WAS, i dnt really understand why that is?

here is my first rough copie of the code, any ideas?



[edit] just realised, you used "move" fuinction i used position object, the move function you used was the wrong syntax for DBC it just wants and integer then a real so i did the following


didn't even know that it was a function, cheers m8 [/edit]

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Apr 2006 00:57 Edited at: 1st Apr 2006 00:57
You need a new dim, example c(50), and some code similar to this...
but it might need a little editing.



BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 1st Apr 2006 01:33
what does it do? im looking and its doesnt seem to do anything that the other code didnt, could you emplain it a bit further, im a n00b lol

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Apr 2006 01:45 Edited at: 1st Apr 2006 01:47
It does the points just once, by setting a flag to say that there has been a collision, and it waits for the collision to end before it allows any more points to happen.... I hope. I haven't tested it.

BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 1st Apr 2006 01:50
kk, i tried it:

"array is accessed outside of bounds"
and then the program freezes

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 1st Apr 2006 15:41 Edited at: 1st Apr 2006 15:42
Type Dim c(50) As Integer at the very top of the code before the loop



The number 50 is changable obviously, thus allowing you to calculate it for more box's or less... blah blah hope you understand

BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 1st Apr 2006 17:00 Edited at: 1st Apr 2006 17:00
hi, i just tried that, it doesnt work in DBC

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Apr 2006 17:18
Just put Dim c(50)

Anyway, you will still have to move the object somewhere that the player cannot go, so my code doesn't make any difference. I was thinking more of repeated keystrokes etc, which doesn't apply to this situation.

BENOJ
19
Years of Service
User Offline
Joined: 17th Mar 2006
Location: UK
Posted: 1st Apr 2006 18:23
lol kk, i did try the dim c(50) at the top, this was when i was getting the error message

abit fatal1ty an8 sli mobo, ati radeon 1800 XT, 1.5GB RAM
250GB SATA HDD, AMD Athlon 64 x2 4200 (overclocked further)

Login to post a reply

Server time is: 2025-05-23 21:08:40
Your offset time is: 2025-05-23 21:08:40