Hiding Static Sprites in TGB
by Julian Liebl · in Torque Game Builder · 09/02/2011 (8:13 am) · 5 replies
Okay that's a feature we really need. Before we change the source I wanted to ask if that kind of feature is somewhere already integreated or we just don't see the a good workaround.
We have several StaticSprites that we use in the Background that we don't need in the visual Editor (TGB) because we generate the Level with a small tool written by us. Is there a way to not let them show up as Static Sprites? Would be awesome!
Also when designing several levels with different Sprites it would be great if some sprites would only show up when we load the specific scene. Is that possible without creating a project or each level and the using them?
Regards,
Julian
We have several StaticSprites that we use in the Background that we don't need in the visual Editor (TGB) because we generate the Level with a small tool written by us. Is there a way to not let them show up as Static Sprites? Would be awesome!
Also when designing several levels with different Sprites it would be great if some sprites would only show up when we load the specific scene. Is that possible without creating a project or each level and the using them?
Regards,
Julian
About the author
#2
Perhaps I should explain my problem in more detail:
Our Designers make a Level Design in Photoshop that is about this resolution: 25600 x 6144 px
Then when the design is final I split this huge image into 512 x 512 blocks. In that case that would mean 50 x 12 = 600 images.
Then a self written Application generates a resource pack with all the images needed and a generated level where all the images are already placed like they should.
Now I have 600 images for each resource pack. After 3 levels TGB will need 1 Minute to load 1800 images in the visual editor and will be a bit sluggish. So not the best way to make 50 Levels.
What I need is a field in the t2dImageMapDatablock where I can say that it should not show up in the create button.
In the level itself I don't have any problems with it since I just can disable certain layers.
09/04/2011 (6:06 am)
Thank you very much for the idea. Yet I think your solution is something different from what I need. Still I will think about that in the future because we might need it for levels with heavy grafics load.Perhaps I should explain my problem in more detail:
Our Designers make a Level Design in Photoshop that is about this resolution: 25600 x 6144 px
Then when the design is final I split this huge image into 512 x 512 blocks. In that case that would mean 50 x 12 = 600 images.
Then a self written Application generates a resource pack with all the images needed and a generated level where all the images are already placed like they should.
Now I have 600 images for each resource pack. After 3 levels TGB will need 1 Minute to load 1800 images in the visual editor and will be a bit sluggish. So not the best way to make 50 Levels.
What I need is a field in the t2dImageMapDatablock where I can say that it should not show up in the create button.
In the level itself I don't have any problems with it since I just can disable certain layers.
#3
Put the exec line at the place where you want to load in the extra datablocks.
exec("game/gameScripts/extra_datablocks.cs");
and in extra_datablocks.cs you put the datablocks for the 600 images.
09/06/2011 (2:50 am)
You can load them with a separate datablock while playing. Then you don't need to have them inside the editor at all.Put the exec line at the place where you want to load in the extra datablocks.
exec("game/gameScripts/extra_datablocks.cs");
and in extra_datablocks.cs you put the datablocks for the 600 images.
#4
Thank you!
09/06/2011 (3:30 am)
Awesome! Very simple but effective solution. I will try that. I guess I won't see the images in editor then. Still need to set the collisions, but that wouldn't be that kind of a problem since I can enable and disable the resource as I need.Thank you!
#5
09/07/2011 (3:06 pm)
If you want them to be present but not visible, just set the .visible field to false. They will be present in your project Object Tree and editable, just not visible.
Torque Owner Justin Proffitt
function SimSet::initializePosition( %this ){ for(%i = 0; %i < %this.getCount(); %i++){ //Firstly, if the sub objects shouldn't be enabled, disable them if(%this.Enabled $= "0") %this.getObject(%i).Enabled = "0"; //Then initialize the objects, and log their parents for GUI scripts %this.getObject(%i).initializePosition(); %this.getObject(%i).ParentMenu = %this; } } function t2dSceneObject::initializePosition( %this ){ %this.setPosition(%this.getPosition()); } function SimSet::setEnabled( %this, %state ){ for(%i = 0; %i < %this.getCount(); %i++) %this.getObject(%i).setEnabled(%state); %this.Enabled = %state; //Good for checking }Now, if you group your objects together in simsets (like t2dSceneObjectGroup) and then add "Enabled" as "0" to that group in its level file, they will need to be explicitly enabled to show up, which you can do simply by calling "setEnabled" on the group like you would any object. So far I love this system, it makes it really easy to make sceneobject GUIs and what not : )
As for your second question, I'm not sure! ^^;;
I hope this helps though!