Game Development Community

Tile Map Collisions

by David Taylor · in Torque Game Builder · 07/20/2006 (7:31 am) · 8 replies

Hi there. I've set up a tile map in the tile map editor. It's very simple, and consists of two types of tiles - a path tile and an obstacle tile. I used the tutorial, and have set up every single obstacle tile with the collision brush, (so there is a green square around each one of these tiles), but when I run the game, there are no collisions. I have a player sprite that moves over these obstacles with disconcertingly wild abandon!

I have put an onCollision call into this sprite's class with an echo command, but nothing is being echoed. I have also set all of the player sprite's collision options to active, (send/receive, etc, as well as callback).

Can anyone suggest what I am to do to get the player sprite colliding with the obstacle tiles?

#1
07/25/2006 (5:22 pm)
I had the same problem and I fixed it by enabling send/recieve physics on both the player and tilemap (You may have forgotten to enable recieve collisions on the tilemap, Dave, that's why you don't get an echo).
#2
07/25/2006 (7:23 pm)
And just like that, it works. Thanks, Kevin! :D
#3
07/26/2006 (7:10 pm)
No problem at all, Dave. ^_^
#4
08/01/2006 (3:10 pm)
I'm not sure about this, but I remember hearing that tile layers can only receive collisions (i.e. can't send).
#5
08/01/2006 (3:36 pm)
Thomas is right. Your tile layer won't send collision. You can show this by setting it's status to "$map.setCollisionActive(true, true)". In the console you'll see an error message saying that "Send collision is not allowed for this object" (or something along those lines).
#6
08/01/2006 (6:23 pm)
Funny though that layers can receive physics.
#7
08/01/2006 (9:03 pm)
I'm pretty sure that's by design, Kevin.
#8
08/02/2006 (1:18 pm)
:P

Indeed