Game Development Community

Tilelayer callback script?

by Patrick Shaw · in Torque Game Builder · 06/27/2006 (7:12 am) · 3 replies

Hi all,
I am trying to build my game from within the level editor as much as possible. The level builder supports tilelayers, but not tilemaps. At the moment, I have one tilelayer for graphics and a seperate one for collision. I would like to add a third layer that hosts spawn points for the player and enemies. The tutorials I've seen for spawn points have used the onTileScript callback. However, this callback only works for tilemaps, not tilelayers.

Is there a way to trigger a tile's script from the layer? Or do I need to switch from using the level builder to directly loading a tilemap? Thanks!

#1
06/29/2006 (12:27 am)
And it would be cool if the level editor would support both, single layers AND maps. :)

And by the way: What is that dummy tilemap in the scenegraph for? The engine crashes on me when I delete it from the console.
#2
06/30/2006 (6:44 am)
Hey,

First off -- I haven't messed around with tileScripts *at all* yet. So there might be a much better way to do this.

With that said... I created a t2dSceneObjectDatablock for my layer and assigned the class Layer to it. So I can just use the callback Layer::onAdd(%this){} to init whatever needs to be done.

Again, dunno if this helps, but there ya go.
#3
06/30/2006 (7:32 am)
Spencer,
Hmm, that's close to what I need. The onTileScript is called when the tile enters the camera area, not when the tilemap is created. I could setup a class function to test every tile every frame to see if it falls within the camera view area and that would replicate this callback. However, this seems rather messy.