Game Development Community

Displaying the same tileLayer twice?

by Lennart Steinke · in Torque Game Builder · 03/24/2005 (2:25 am) · 5 replies

Hi!

How would I display the same tile layer at different sizes at different positions?
Besides showing a part of the tile layer in my main playing area, I also want to have an overview on the map at the right of the screen.
How would I do that? Should I create another map with the same datablock? Create a 2nd instance of the tileLayer?

My main problem is that I'm not sure where the actual data is held and how I can position 2 objects sharing the same data,

-Lenny

#1
03/24/2005 (3:04 am)
If you're not changing the tile-layer in any way then you could quite easily just load-up another one. If the layer is part of a more complex map e.g. lots of layers and you only want one specific layer then you could hack it by temporarily saving the tile-layer to disk and reloading that layer into a new layer you create. We'll be creating a ".clone()" option at a later date allowing duplication of objects in memory to make this easier.

If the tile-layer is dynamically changing e.g. its tiles are being changed or perhaps it's quite large and you don't want to duplicate it or just for any other reason then the only way to render the same object would be to do the following...

Create another fxSceneWindow2D (GUI) window and position this for your overview map. If you didn't already know it, you can use "fxSceneWindow2D::setRenderMasks()" to select specific layers/groups to render which can be really handy. Note that you can also change this dynamically. You'd only then need to ensure that your object(s) (in this case a specific layer) can be uniquely identified by a layer/group mask.

Now, when that window renders, it will only render objects that meet the layer/group criteria. Also note that just because objects are not rendering, doesn't mean that you can't reference objects in the window. What this means is that you can still get the new window to mount to the invisible player or any other object.

This new window has its own camera system as well which can be very handy if you need to change the overview somehow.

Hope this helps,

- Melv.
#2
03/24/2005 (4:05 am)
The tiles will vanish (think down scrolling arkanoid like map) and the overview should show some of the screens to come. The map itself won't be that large I guess. Since it's only 8 tiles wide and just a single layer even 10 screens shouldn't be that large.

Quote:Create another fxSceneWindow2D (GUI) window and position this for your overview map. If you didn't already know it, you can use "fxSceneWindow2D::setRenderMasks()" to select specific layers/groups to render which can be really handy

I'm still fighting a bit with the gui, so don't be suprised if I post some follow-up questions :)

Quote:Hope this helps,
It helped. Thanks a lot!

-Lenny
#3
03/24/2005 (5:15 am)
Ok, I have the 2nd view showing, the problem is just that it seems like I can't position it corrctly. It appears always at the same physical position and now matter how I set the sizing paramters, neither size nor position change in different resolutions.
I'm pretty sure I'm missing something very basic, but was is it? :)
#4
03/24/2005 (6:00 am)
Have you been through some of the GUI docs? The GUI can be a bit of a pain sometimes.

You can use the relative settings so that it stays in the same relative position if that's what you want.

- Melv.
#5
03/24/2005 (6:20 am)
I had both size menu buttons set to relative. but it didn't change a thing.
And yes, I went through the gui totorial for t3d and the physics engine tut. I'm just not sure what I am missing here.. the scene object doesn't have that many options, and I thought setting both width and height to relative should do the trick :(

-Lenny