Platform game collision

BlitzMax Forums/BlitzMax Programming/Platform game collision

_JIM(Posted 2009) [#1]
Not sure if this is the right section, since this is a generic programming question.

I need to make a platform game that has some overlapping "platforms". You know, those kind that you "pass through" until you jump higher, then you land on them.

The problem is I'm not sure exactly how to do this. I was thinking of just enabling the collision with a platform once you are "above it".

However, I still want to have ceilings.

Should I work a bit to tweak this idea? Or is there a better way to do this?

Thanks in advance.


GaryV(Posted 2009) [#2]
Download Jill of the Jungle source from here:

http://eiksoft.com/eik/games5.htm

Should show you exactly what you need.


_JIM(Posted 2009) [#3]
Thanks, GaryV, but I find it kind of hard to follow the code.

Also, my game will be far from tile-based. The maps are going to be drawn almost entirely by hand, with little or no tiling, and I'm going to use a physics engine for realistic collision behavior.

I'd really appreciate if you could post some hints or guidelines. I'm interested in understanding the logics behind the thing.


Warpy(Posted 2009) [#4]
Only check for collision on floors when you're moving downwards, and ceilings when you're moving upwards.


_JIM(Posted 2009) [#5]

Only check for collision on floors when you're moving downwards, and ceilings when you're moving upwards.



Hm... good idea, but I'm not sure this will work, as my "platforms" aren't exactly flat. Furthermore, I'd need to change the insides of the physics engine in order to make this work.

That's why I think it's a tough problem to solve. :-s


Dabhand(Posted 2009) [#6]

Hm... good idea, but I'm not sure this will work, as my "platforms" aren't exactly flat. Furthermore, I'd need to change the insides of the physics engine in order to make this work.



Use pixel checking, I use it alongside tilemaps and it works a charm! :)

http://www.syntaxbomb.com/ftp/dabz/Dizzy.zip

Dabz


GaryV(Posted 2009) [#7]
If Dabz doesn't have an answer, you don't have a problem ;)


Nate the Great(Posted 2009) [#8]
try having a list for platforms and a list for ceilings


cielings are always active so no bother there.
when looping through the platform list check to see if a platform is below you. If so then set it to active. Then do the physics stuff.

thats how I would do it


_JIM(Posted 2009) [#9]
That sounds like a good idea, Nate. I'll give it a go and see what I end up with :)