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 / Platform Collision Help

Author
Message
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 14th Oct 2005 17:50
I am making a game where you are a cube, and you jump from platform to platform, and try to get all the way to the top (there will be different types of platforms later). At the moment, you can jump through the bottom of the platforms, and it bugs me slightly, is there any simple way to fix this?

My Code:


Am I dead yet?
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 15th Oct 2005 04:59 Edited at: 15th Oct 2005 05:00
I personally dont like using collision boxes for collision checking so here's what I'd use:



Replace StartingPlatformNumber with the first platform number, and EndPlatformNumber with the last platform number. Replace Object with the users object, and replace CollisionCheckPosition with the position you want to check for collision with (for cubes I recommend half of the cubes height, so basically you could either manually enter half of the cubes y size, or subsitute CollisionCheckPosition with OBJECT SIZE Y(Object)/2 .

INTERSECT OBJECT returns intersection data, it checks if there are any objects intersecting with the object you specify as the first variable, if so it returns a distance. We're checking for intersection between the objects position and their top, so if theres any intersection at all it means their top is hitting something solid.

I recommend looking the command up in the DBP help file for further information on the use and syntax of the command, and experimenting with it a lot since it's a very useful command.

Hope it helps, kind of a big subject so feel free to ask any questions.

P.S: For some big lag reduction, use collision boxes to check if the user is even close enough to the platform to collide with it, this can cancel out a lot of unneeded checks giving you that few (or sometimes loads of) extra frames to help your game run efficiently.


Login to post a reply

Server time is: 2024-11-27 16:36:12
Your offset time is: 2024-11-27 16:36:12