Game Development Community

A minimap question (2nd scenewindow)

by Christian · in Torque 2D Beginner · 01/17/2014 (12:00 am) · 6 replies

Hey, I've just created a minimap, similar to the MultiWindowToy.

new SceneWindow(minimap)
    {
        Profile = GuiDefaultProfile;
        Position = "340 20";
        Extent = "150 150";
    };
    minimap.setCameraPosition(20, 20);
    minimap.setCameraSize(20, 15);
    minimap.setCameraZoom(0.1);

My character is mounted to the camera like so:
mySceneWindow.mount($player_1,"0 0",0,1,false);

and I have a smaller character that follows the main character mounted to the minimap in the same way (so both cameras follow the character, since both cameras can't follow one character as far as I know).

My question is, is there a way to create an image on the minimap window that won't show up on the main window (basically a way to see on the characters position easily on the minimap, right now it's tiny since the minimap zooms out so far).

Thanks

#1
01/17/2014 (7:01 am)
Add a GUI element over the center of the second scene window? I mean, if the camera is following the player shouldn't the player always be at the center?

Otherwise I'm not sure - would have to experiment with it a bit.
#2
01/17/2014 (8:06 am)
The MultiWindow toy hints at this kind of use - you can use the SceneWindow method setRenderGroups or setRenderLayers.

Say, you put all your minimap objects in layer 20. You could have your main SceneWindow render all layers except 20 and your minimap window only render layer 20.
#3
01/17/2014 (11:22 am)
@Mike that works well, thanks.

This is what the code looks like:
minimap.mount($minimap_arrow,"0 0",0,1,false);
minimap.setRenderLayers("20 28");
mySceneWindow.setRenderLayers("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 30 31");
With $minimap being the map arrow that always follows the player around, they just don't see it on the main screen because it's scenelayer 20.

It took me a sec to realize you had to enter every scenelayer you wanted on the window instead of a range.


#4
01/17/2014 (11:38 am)
Actually now that I'm doing this mounted/moving camera system, I realize that any GUI elements I have are moved off screen when my character moves out of range. Is there a way to create a sprite that will stay in it's location and isn't effected by the camera moving?
#5
01/17/2014 (1:47 pm)
Using the multi-scene approach, you can add another scene window that overlays your main game scene window and acts as a gui - Mitch has posted a dozen tutorials on this spanning various versions of T2D, shouldn't be hard to find one.
#6
01/17/2014 (1:51 pm)
oh that's a neat idea, basically the same size as the main window but it only will show 1 scenelayer specific to GUI?

That's a great idea.