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.

Newcomers DBPro Corner / Collisions always perplexing me.... -NGC-

Author
Message
Indie Rock 13
20
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 16th Nov 2004 17:49
I'm using DarkBASIC Pro and the Nuclear Glory Collision .dll to build a bit of a 3D platformer thats on a 2D plane. Everythings gone quite well except one thing... something that everyone always takes for granted in games. When I hit the side of my object with my character I want him to slide down as if gravity is still working as normal, even if the player continues to hold down the direction key.

In my code, the object will proceed into the collision box slightly, causing the fall to stop while it slowly slides back outside the collision box until its not colliding and can fall to the ground. If the player holds the direction into the box he's colliding with then the object falls slowly to the ground. I've tried making my speed variable 0.0 when there's collision, but the object always goes slightly into the box...

I'm pretty sure a good deal of the problem with my gravity is that the main character object is constantly going from colliding with the object to being pushed back, therefore not touching it. When the leftkey is held it continues switching back and forth so the gravity variable can't keep building up but rather keeps starting over.... I can't think of any way to fix this though.

Is there any way to remedy these problems?

Thanks



Neeeeeeeewom!
Ali M Oldboy
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location: England, UK
Posted: 17th Nov 2004 00:55 Edited at: 17th Nov 2004 01:23
Don't use it!

I get stuck with it really, just use original collision!
Better than nothing!

-ALI-

P.S. Beep!

N U K E S O F T :: DANGER! EXPLOSIVE GAMES :: [href]http://www.geocities.com/nukesoft0[img]
Indie Rock 13
20
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 17th Nov 2004 04:55
I had the problem with the original collision only more pronounced . Thats why I switched... and it still exists. Oi!

Neeeeeeeewom!
Ali M Oldboy
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location: England, UK
Posted: 19th Nov 2004 05:03
LOL! Well err...Which error do you have with it?

-ALI-

N U K E S O F T :: DANGER! EXPLOSIVE GAMES :: [href]http://www.geocities.com/nukesoft0[img]
Indie Rock 13
20
Years of Service
User Offline
Joined: 1st Sep 2004
Location:
Posted: 19th Nov 2004 19:31 Edited at: 20th Nov 2004 04:07
It just slides into the object its colliding with slowly instead of stopping at its edge. This sucks cuz my controls won't work while its stuck inside the box. Someone suggested that it may be because It's colliding with both the ground and the box at the same time thats causing it, but that can't be it, cuz it happens when the object is jumping also....

I think its because I position it at object position y(1)+speedr#-speedl#... since the speed still goes up when the button is pressed it moves it that slight amount even if its y position isn't moving.

I've tried making speedl#=0.0 when the object collides with some success... but then my gravity problem rears its head. Sliding collision moves it back so its not colliding over and over, so I can't say if obj=3 then gravity=gravity-0.01, because then gravity will keep resetting to zero each cycle since the sliding collision keeps pushing it back...

So what I really need to know is how to make the gravity number not reset, like maybe somehow tell that it collided recently in the past couple of cycles and continue the gravity number adding to itself. This doesn't seem possible though...

*EDIT* Ahh, I finally figured it out. I was calling the gravity#=gravity#-0.01 both when there are no collisions detected and when it was colliding with my wall, and thats why it kept resetting. Now that I fixed it I have another problem though... as usual. Lemme try to figure this one out....

Neeeeeeeewom!

Login to post a reply

Server time is: 2024-09-23 05:27:30
Your offset time is: 2024-09-23 05:27:30