I’m creating a module that needs to show or hide different score trackers depending on the game mode that is being used. There is a default game mode which needs to show certain scores but no others, and a button (Global Key Command) toggles between modes. I have tried to use an Invisibility trait for the pieces that represent the score trackers, but a key stroke is required to activate it.
I think I cannot use layers since there is a Text Label in the pieces which also needs to be invisible depending on the game mode used.
Can anyone think of a workaround for this problem? I would really appreciate it!
Thanks in advance!
Layers are one of the best options for this, as the invisibility or mask traits will be tied to one player who has to send the command to toggle them.
For the Text Label, a simple trick is to make it show a dynamic property, put the text you want in said property, and then give the dynamic property two commands. One will set it to the exact same text, and one will set it to be blank.
A blank Text Label is an invisible Text Label, so the two commands can be used to toggle its visibility.
Alternatively, you could make your text an image and then put it in another Layer.
Reddeblu’s recommendation for the text label displaying a dynamic value is spot on as is his recommendation for using layers. However, there is a way to forgo using the invisibility property and thereby not having to invoke a global key comand to get the same effect of invisibility.
For the layer in the game piece, make it as always active and then select the checkbox of “Levels follow expression value?”
Then create an expression that tests for the Game Mode global property.
Create a BLANK level that corresponds to that test.
I have created a sample module for you to see how it works.
The module is simple. Pull the single game piece off the palette and place it on the game map and then change the game mode by the button on the tool bar. I’ve added a VP global property, too, so you can increment and see it disappear based on game mode.
Enjoy and good luck with your game.
Wow! Thank you so much for your detailed answers!
I’ll definitely try both approaches. With you guys it’s easy to learn!