Setting visible/invisible?
sparker
Member Posts: 47
Hi guys,
trying to make an actor only visible when an attribute is of a certain value. Initially it is set to be not visible and that part works well. I have a rule created within the actor which says if the attribute equals what I want it to: (have tried both of these)
self.graphics.visible
and
self.graphics.visible = 1
Also curious, what syntax would I use to make it not visible again (as in via an action of the game, what would I set attribute rule to?
Sam
trying to make an actor only visible when an attribute is of a certain value. Initially it is set to be not visible and that part works well. I have a rule created within the actor which says if the attribute equals what I want it to: (have tried both of these)
self.graphics.visible
and
self.graphics.visible = 1
Also curious, what syntax would I use to make it not visible again (as in via an action of the game, what would I set attribute rule to?
Sam
Comments
The Visible Attribute cannot be changed at runtime.
So set the Actor's Alpha to 0 for invisible, or 1 for visible
Create a new attribute (an integer) called (graphic.visibiltiy) .. or something like that.
Then within an actor doesn't have to be the actual one you want made invisible, setup a rule,
if attribute graphic.visibility = 1 change attribute of your chosen graphic, alpha = 1
create another rule
if attribute graphic.visibility = 0 change attribute of chosen graphic, alpha = 0
Then to make it work with a button for example (a sort of toggle on off button)
Have another rule, put onto the button, if mouse button down, and mouse position inside. change attribute, graphic.visibility to (graphic.visibility+)%2
This way each time the button is pressed the graphic.visibility integer value will change from 1 and 0.
Hope that makes some sort of sense, only learning my way round GS still, but have been using lots of buttons in my first app idea so far.
Sam
Edit: oh, I guess to toggle invisibility temporarily while editing only, I suppose.
---------------------------------------------------------------
Spiral Gyro Games
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps