Tile hits
by Bucko · in Torque Game Builder · 04/03/2005 (8:24 am) · 5 replies
When our sprite hits a tile with collision polygon my onCollision callback gets called as expected. We want to do different things to different tiles, some tiles should be removed ie changing to my collpoly less background frame, some tiles should change state ie changing their image or possibly even switching to an animation.
We do something like this:
%tileType = $skyLayer.getTileType(%dstRef);
%frame = getWord(%tileType,2);
and depending on the value of %frame we do various things.
How do we change the frame of the tile?
Or how do I setup an animation in the tile?
Right now all that seem to work is
$skyLayer.clearTile(%dstRef);
but that removes the tile, exposing the background.
(BTW Is it possible to have layers with holes in them ie how do you clear images in the tileeditor, yes I know I could use a frame with 100% alpha to achieve this)
We do something like this:
%tileType = $skyLayer.getTileType(%dstRef);
%frame = getWord(%tileType,2);
and depending on the value of %frame we do various things.
How do we change the frame of the tile?
Or how do I setup an animation in the tile?
Right now all that seem to work is
$skyLayer.clearTile(%dstRef);
but that removes the tile, exposing the background.
(BTW Is it possible to have layers with holes in them ie how do you clear images in the tileeditor, yes I know I could use a frame with 100% alpha to achieve this)
About the author
#2
(How I managed to miss them in the docs is beyond me, perhaps I really should buy that brain upgrade they offer me ;)
The final question about was weather there was a way INSIDE TILEEDITOR to clear a painted tile?
I know I can do it in code but I would like to do the clearing in the tileeditor if at all possible.
(I want my daughter to be able to test her tilesets without coding from me)
04/03/2005 (3:17 pm)
Well the functions are there but they seem to randomly crash the engine (see my bug report about it).(How I managed to miss them in the docs is beyond me, perhaps I really should buy that brain upgrade they offer me ;)
The final question about was weather there was a way INSIDE TILEEDITOR to clear a painted tile?
I know I can do it in code but I would like to do the clearing in the tileeditor if at all possible.
(I want my daughter to be able to test her tilesets without coding from me)
#3
04/03/2005 (3:34 pm)
Quote:The final question about was weather there was a way INSIDE TILEEDITOR to clear a painted tile?Right-clicking a square will clear it of any tiles, if that's what you mean. =)
#4
05/04/2005 (5:33 pm)
Quote:When our sprite hits a tile with collision polygon my onCollision callback gets called as expected.Is there a callback for the tile itself? I can't seem to find any notion of an individual tile object, only tile maps and tile layers. I don't want to handle tile behaviors in other objects' collision callbacks. Hrmmm.
#5
05/04/2005 (6:38 pm)
Well, on my wild journey of self discovery, I've determined that for efficiency the tile layer probably manages the tiles by proxy, ergo, no tile objects per se. Anyway, I found a way to handle what I need to do thanks to custom data. :)
Associate Melv May
$skyLayer.setStaticTile( myImageMap );
$skyLayer.setAnimatedTile( myAnimation );
What is it you want to do here?
Use the above syntax you quoted.
The above questions seem a little strange and so I'm assuming you mean something else here; could you elaborate a little so I can better answer your questions?
- Melv.