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 / darkbasic pro collision on randomly generated objects

Author
Message
Allcreator007
12
Years of Service
User Offline
Joined: 28th Oct 2013
Location:
Posted: 28th Oct 2013 18:16
how do i set collision boxes on randomly generated objects

richard G
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 28th Oct 2013 19:18 Edited at: 28th Oct 2013 19:21
Use the make object collision box command to make your own collision boxes around objects!
Hope that helps
Also, careful with the multipost
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 30th Oct 2013 19:44
Any generated object should come with a collision box and sphere.

Use the command SHOW OBJECT BOUNDS to see them.

D.D.
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 4th Nov 2013 17:26
i am doing the same thing but when i set the object collision box i keep going through the object can anyone help me plz

Hasty
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 4th Nov 2013 17:26
i am doing the same thing but when i set the object collision box i keep going through the object can anyone help me plz

Hasty
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 4th Nov 2013 21:52
Can you show us the code you're using please, Jon? We'll try to help you
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Nov 2013 22:58
Hi there

We , old programmers , can somehow help all beginers, but I don't know the reason, most beginers are afraid showing their little piece of code....others just ask and go to take a nap...or whatever they do ,without realizing that if we do not answer right away, it doesnt mean that we don't like questions, or that we are not polite with beginers...

Please, don't be afraid asking but from time to time we would like to figure out if our answers were worth to partly solve your problems...mmmmm Now I look like an old grumpy with my grandchildren

I'm not a grumpy grandpa
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 5th Nov 2013 00:18
you still need to manage collisions between objects, it's not enough to create collision boxes.

Somewhere in your code you need something like this:

if object collision(object_a, object_b)=1 then ....
you need to write what happens when two objects collide

Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 5th Nov 2013 23:55
I will post the code because the code is at my school and all my computers at home is mac but I think the coding was something like this

Make object cube 89898,100
Make object collision box 89898
Set collision box on

It was something like this but I do not remember it but I will show u guys the code as soon as I can the cube had the textures any the positions

Hasty
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Nov 2013 11:21
Jon We & Allcreator007

Take a look how the command works...as Brendy boy comented



Cheers.

I'm not a grumpy grandpa
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 6th Nov 2013 17:12
if object collision(object 89898,object 1)=1 then goto endsection
i put this but it said could not detemine parameter type of object 89898
thats what i put and it didnt work

Hasty
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 6th Nov 2013 17:12
if object collision(object 89898,object 1)=1 then goto endsection
i put this but it said could not detemine parameter type of object 89898
thats what i put and it didnt work

Hasty
Allcreator007
12
Years of Service
User Offline
Joined: 28th Oct 2013
Location:
Posted: 6th Nov 2013 18:12
thanks for the help everyone. and Im sorry I reposted I just wasn't sure on how the website worked

richard G
SamKM
17
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 7th Nov 2013 00:12
@allcreator007 You're welcome, we're here to help
@jon wu Jon, you might want to make a thread about this in the DBPro newcomer's section... But to answer why you're getting that error, it's because you don't write 'object' then the object number, you just put the object number (like this: if object collision(89898, 1) = 1 then goto endsection). When the editor says things like 'object collision(object1, object2), what it means is insert the number of object 1 where it says object1, and insert the number of object 2 where it says object2!
Good luck with this!
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 7th Nov 2013 05:18
I appreciate the help Sam and I fixed that but another problem is that it won't go to the end section also whenever I put it into a do loop the whole game crashes

Hasty
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 7th Nov 2013 05:18
I appreciate the help Sam and I fixed that but another problem is that it won't go to the end section also whenever I put it into a do loop the whole game crashes

Hasty
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th Nov 2013 11:38
@jon wu
showing your code will help a bit

I'm not a grumpy grandpa
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 7th Nov 2013 12:43
This thread has popped up on my RSS Feed about a zillion times the past day or so, and figured I might as well follow it for now...

And yes Get that code on a memory stick in case their systems crash and bring a copy home and open it in a TEXT EDITOR on your BigMacBurger and paste the code here ... Woops I mean Mac...

Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 7th Nov 2013 17:04
make object cube 89898, 100 : Rem Cone
color object 89898,rgb(255,0,255)
position object 89898, 300,object size(89898)*.75,500
set object collision on 89898 : Rem Check the Player Cube
do
show object bounds 89898
make object collision box 89898, -100,-100,-100, 100,100,100, 1
if object collision(89898,1)=1 then goto endsection
loop
here it is appreciate the help

Hasty
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 7th Nov 2013 17:04
make object cube 89898, 100 : Rem Cone
color object 89898,rgb(255,0,255)
position object 89898, 300,object size(89898)*.75,500
set object collision on 89898 : Rem Check the Player Cube
do
show object bounds 89898
make object collision box 89898, -100,-100,-100, 100,100,100, 1
if object collision(89898,1)=1 then goto endsection
loop
here it is appreciate the help

Hasty
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 7th Nov 2013 19:32
@Jon wo
It is better to start walking than running. I say it to you, as I say it to my grandson.

start with something like this:



Then add your objects





Then you need to have at least ,one more object to make a collision between both

You will need to have at least , the posibility of moving your player object with arrowkeys or other key

Take a look again to the example I showed above, and when you have a functional piece of code, try to add some other condition.


Always trying to help.

I'm not a grumpy grandpa
Jon wu
12
Years of Service
User Offline
Joined: 4th Nov 2013
Location:
Posted: 8th Nov 2013 00:42
I figured it out and thank you to everyone who helped me I really appreciate it and thx again

Hasty

Login to post a reply

Server time is: 2026-07-07 11:21:34
Your offset time is: 2026-07-07 11:21:34