Game Development Community

Tile collisions in one direction

by Jacob Vann · in Torque Game Builder · 03/12/2006 (4:06 pm) · 0 replies

I messed up posting this topic the first time, so if you saw junk, I apologize.

I'm getting kick out of playing with all the new features in the 1.1 Beta. The stock collisions are just what I needed! The platform game tutorial has been invaluable. However, I'm having some stumbling blocks ...

Basically, I want to enable tiles that the player can collide with only from the top, and not the sides or bottom.

Currently, I have ground tiles that the player collides with on all sides using CLAMP response, and it works great!

The player collision code:
...
   %sprite.setCollisionResponse(CLAMP);
   %sprite.setCollisionActive(true, true);
   %sprite.setCollisionPhysics(true, false);
   %sprite.setCollisionCallback(true);
...

And the ground tile layer is set up as such:
...
   %tileLayer.setCollisionActive(false, true);
   %tileLayer.setCollisionPhysics(false, false);
...

Now, I want another type of tile that the player collides with only when falling down through it, and not jumping up through it (a platform that the player can jump up through, like in countless mario style games).

When I create another tile layer, the player CLAMPs against it if any part of setCollisionActive is true. I'm assuming the CLAMPing is happening as part of the physics engine, and I understand that since the player has CollisionPhysics send turned on, it trumps whatever settings the tile layers have (i.e., the tile layer can't selectively ignore a physics collision).

I want to handle this type of collision in the onCollision callback, but I DON'T want the tilelayer to receive or send physics collisions. In other words, the engine should do nothing but generate a call to onCollision.

I can't seem to make this work on a particular tilelayer without breaking the current collisions with the ground.

Anyone have any luck or anecdotes with having tiles that only collide one way? I've seen other people mention trying to set this up, but I have yet to see a successful solution. I'm kind of stuck until I can suppress physics collisions for a particular tile layer and not the others.

Any help would be appreciated. Thanks!