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 Game Collision

Author
Message
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 4th Apr 2004 21:44
How do I use collision to:
If you land on an object you then stay at the same height

and

If you walk into the same object you can't go through it?
Doing just one of the two is easy but I can't do both.
It is so damn frustrating!

Current Projects: 'Level Editor 3D' and 'Animation Package v2.0'
aneale5@orange.esinet.org.uk
Chunkie Lover
20
Years of Service
User Offline
Joined: 16th Mar 2004
Location:
Posted: 4th Apr 2004 21:54
in the loop before you change movement variables take the current x,y,z and name them like oldx#,oldy#,oldz#. Then in the collision detection statement (which i assume you have working) set the x=oldx#
y=oldy#
z=oldz#

All things are possible the impossible just takes longer.
Dan Brown
Digital Fortress
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 5th Apr 2004 01:49 Edited at: 5th Apr 2004 01:49
Here's something I programmed awhile back taht does that. The only problem is that it is s....o.... v.....e.....r....y.... s....l....o...w..... .



"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 5th Apr 2004 04:47
I've done some work on this in a retro game remake I am coding - I split the screen into "cells" and use an array to calculate whether the player can move through a cell or not - I give each cell a numberic value.

See my thread in the Work In Progress forum on "Bruce Lee" - if the demo works like you want it let me know and I will post code snippets on how I did it - I'd rather we did it this way than me post reams of code that doesn't achieve what you want

TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 5th Apr 2004 16:40
I should have metioned this is 3D.

Current Projects: 'Level Editor 3D' and 'Animation Package v2.0'
aneale5@orange.esinet.org.uk
Chunkie Lover
20
Years of Service
User Offline
Joined: 16th Mar 2004
Location:
Posted: 6th Apr 2004 02:09
Ok if it's 3d and you fall through objects you must have a variable for gravity. before you set movement and the gravity is subtracted from the y run a check if it's touching and set gravity to zero

All things are possible the impossible just takes longer.
Dan Brown
Digital Fortress
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 6th Apr 2004 18:33 Edited at: 6th Apr 2004 18:34
At the moment I am uisng something like:


Current Projects: 'Level Editor 3D' and 'Animation Package v2.0'
aneale5@orange.esinet.org.uk

Login to post a reply

Server time is: 2024-11-26 12:46:30
Your offset time is: 2024-11-26 12:46:30