Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mrosswa on November 24, 2013, 10:13:04 AM
-
I have a very simple JS script that looks like this:
var objectisvisible = false;
function Update(){
if(renderer.isVisible){
objectisvisible = true;
}
else
{
objectisvisible = false;
}
}
I'd like to pass that boolean out of the script and into playmaker so it can activate a state when it's true. It looks like it should be simple according to the tutorial videos but I've never done any real programming beyond ActionScript and I can't figure it out. What do I need to do to make this script pass out that variable (I assume with Get Property)?
-
Get Property should work.
-
Hi,
You need to make your property public, that's the key to expose it inside the "Get Property" action.
also, I would actually recommand you fire a playmaker global event from your scripts when you detect a change of that visibility, it's better imo.
PlayMakerFSM.BroadcastEvent("my event");
you need to declare the use of playmaker at the top of your script as well
using HutongGames.PlayMaker;
Bye,
Jean