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 / Multiple Collision plz some help >.<

Author
Message
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 13th Jun 2007 19:00
I\'m making a game for school, yet i have stumbled on a problem :\'(

At the moment i\'m putting Collisions in the game, though i can\'t do: If Object Collision (x,0)... because then i can\'t seem to move...
So i was trying multiple Collision codes...
DB only seems to act acording to the first Collision line of code :S

With this object 99 only stops when hitting 22...
It just goes trough 28 and 29... :S
Does any1 know how to fix this?
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 14th Jun 2007 17:56
I have tried:

Though it still only makes me stop when i hit object 22

http://forum.thegamecreators.com/?m=forum_view&t=85387&b=10
I've also tried the suggest made here, but it doesnt seem to work for me

Does anyone know how to do it? or will i have to use very difficult pieces of code to determin where an object is, plus that the charrecter can't walk there?
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 14th Jun 2007 20:58
Did you try


Did you get the object number correct?

Try

somewhere in your do loop.

If that fail you should post more of your code becouse we can't help you much with this

Don't look at my sig!
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 15th Jun 2007 08:39
These are my full lines of code:

As far as i know the object numbers are correct
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Jun 2007 00:18
I haven't raked through all of your code so this may be in there - any and every object that you want collidible has to have it's collision set to either boxes, spheres or polygons before it is used in collision. While you can still get collision detection without having set them, it becomes unpredictable and will detect sometimes and other times it won't.

Ok looked through it now - The not moving problem has to do with the two spheres stacked on top of each other. The way you have things set up, if you test for collision with code such as

if object collision(99,x) or object collision(98,x)

Your object won't move because the two objects are colliding with each other (the head of the snowman and the body of the snowman) and your code says if there is collision, position the object a x,y,z which is where it is standing at that moment.

You can correct this by turning off the collision for object 98 and 99 (the head and the body) and putting an invisible collision box around them - or (making sure collision is off for object 98 and 99)create an object such as a cube, box, sphere or whatever, set this object's collision on (to boxes ,spheres or whatever) hide this object, and position it with your main player object. Use collision detection for this newly created invisible object. This way you avoid the constant collision between the two objects that is making up you main character.

Enjoy your day.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 16th Jun 2007 03:10
Hallo Mit surugi ....try something like this:



oh my god
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 16th Jun 2007 12:13
Latch i've tried what u said, moved the head up so they wouldnt hit eacht other, by changing this:


But still could move trough object 29 :S

@Chafari
about to try your idea
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 16th Jun 2007 13:04
@ Latch
I've raised the head so they dont collide, the put this line of code in:
If Object collision(99,0)>0 then position object 99,X#,0,Z#
[/Code]
And found out the head was making me stop here ^^ tnx

Tough i still wonder why it wont read multiple line of Code with Collision, because i wanted to be able to pick up the bricks, and since it only acts towards the first line of Collision i can't think of an other way of pickin them up :S

@Chafari
Now i can walk trough everything xD, Oh well tnx though
Mit surugi
19
Years of Service
User Offline
Joined: 13th Jun 2007
Location:
Posted: 17th Jun 2007 13:19
To simplefy things, i've reduced the code to only neccesarry things (by copying the Tutorial collision text)

Why wont this code work to full potential?:

It only stops me at 1 box, box number 1...
(thats basicly what i've been asking for those just jumping in)

Login to post a reply

Server time is: 2026-07-06 01:20:15
Your offset time is: 2026-07-06 01:20:15