Game Development Community

tileMap.onCollision?

by Kevin James · in Torque Game Builder · 07/27/2010 (5:57 pm) · 2 replies

I use this to turn on collision for each tile:
%this.setTileCollisionActive(%x,%y,true);

And this gives me the echo when the player bumps into the tilemap:
function wallLayer::onCollision(%srcObj, %dstObj, %srcRef, %dstRef, %time, %normal, %contactCount, %contacts)
{
   echo("wallLayer::onCollision: "@%srcObj.class);
}

But, how do I know which individual tile is triggered?

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
07/27/2010 (6:46 pm)
It helps to go back over the tutorials:
docs.torquepowered.com/tgb/official/content/documentation/Tutorials/Feature/Tile...

"Note that the onCollision function automatically passes tile locations in the %srcRef and %dstRef arguments."

Doh! I should note that I used the standard Google search engine to find this...

#2
07/27/2010 (7:16 pm)
I'm HUGE on the Google search.

As a tip for everybody, if you search in google with

<KEYWORDS> "torque game builder" site:torquepowered.com

you will get infinitely better search results than using the "Search forums".

I even have this hotkey'd in my browser.