Game Development Community

QuickQuestion : Getting a single Tile

by NEOK · in Torque Game Builder · 12/29/2005 (12:15 am) · 5 replies

I found this thread about what I want.

I guess ActiveTile features could do similar things but couldn't find related resources. Maybe it is not implemented yet.

Can anyone reply to this?

#1
12/29/2005 (3:25 am)
Neok, what are you trying to do?

if you just want a single 'tile' then just make a t2dsceneobject.

if you mean getting to a single tile within a t2dTileMap/t2dTileLayer, i dont think you really can (from script) right now.

I mentioned (in the thread you linked) that i filed a bug on ActiveTile not inheriting from SimObject, and melv said that he was going to fix this, but it doesnt look like this has been done in 1.1 yet.

but... what are you trying to do? if you wanted to "change" the tile then you could call
clearTile() or setStaticTile() or setActiveTile() etc (all members of t2dTileLayer) depending on what you want to do.

in fact, now that i know that you can do these functions, i dont really see why ActiveTile really needs to be exposed to script at all. (melv kept it light for performance reasons i'm told)
#2
12/29/2005 (3:29 am)
Or to answer the question posed in the thread title, you can use t2dTileLayer.pickTile()
#3
12/29/2005 (7:00 am)
Just for your information, I posted to the thread referenced above.

- Melv.
#4
12/30/2005 (8:53 am)
Quite understandable. Thank you guys for the explanation.
I tried to play(or change) another animatedTile using t2dTileLayer::setAnimatedTile() on the specific single tile where a player collide with and replace it with the original animation when the changed animation is ended. To do this, I need to use t2dAnimatedSprited::onAnimationEnd(), but clearly, I can't, because tTileObject is referencing only animation datablock as Melv said.

Actually, what I want to with t2d tiles is not the background tile map but several animated objects moving across the screen. It's moving right to left from out of the screen repeatedely. I had done this having several t2dAnimatedSprites mounted on a single t2dSceneObject. Then I could move the single object across the screen but I found it was a dirty method since I have to check whether the object has reached to the final destination and put it back to the original start position, moreover, it popped out of desired screen if camera zoom out.
cfs4.blog.daum.net/upload_control/download.blog?fhandle=MDRLV0lAZnM0LmJsb2cuZGF1bS5uZXQ6L0lNQUdFLzAvMi5qcGcudGh1bWI=&filename=2.jpg
I found t2dTileLayer is great to do this with t2dTileLayer::setWrap().
cfs3.blog.daum.net/upload_control/download.blog?fhandle=MDRLV0lAZnMzLmJsb2cuZGF1bS5uZXQ6L0lNQUdFLzAvMC5qcGcudGh1bWI=&filename=0.jpgMore than that, It's cool t2dTileLayer::setAutoPan() does repeating images.
I can't resist using these features.
Then, could you give me any idea about how to apply or implement clipping(setWrap()) and repeating(setAutoPan()) method on t2dSceneObject?
#5
12/31/2005 (5:38 am)
Neok,

Well, originally the world-limit had a "WRAP" mode which moved the object from one world-limit edge to the other automatically; this would give you the effect your are looking for.

This mode was causing so much confusion when people were using rotation because as the object moved from one edge to the other, the object rotated and caught the new edge which cause it to flip back again. Objects were getting stuck and there was no easy way to solve this apart from moving a considerable distance from one edge. In the end, the mode was removed.

It might be good to add this back in and spend a little time resolving the issue. I've therefore added an issue#1024.

In the meantime, I'd recommend adding the world-limit for these objects, setting them to the mode "NULL" (which doesn't do anything) and using the callback feature and put in some code which places them back to where you want (left-hand side). This way, you can get this effect with a single call and a callback for these objects. It'd probably be best to put in a dynamic-field against each object that identifies them so you can check in the callback that they are the objects you are looking for. Don't forget that the "onWorldLimit()" callback also provides you with which limit was hit so you can also check for "right" to make sure it's that edge you're getting. Also, you'll probably want to extend the left, top, bottom a little way outside of your play.

Hope this helps,

- Melv.