So... I was making a Math game by using " Smart Penguin's " math node . BTW : this is a 2D explore game , small map with little shop , can walk in and buy stuff. Now , I want a button (let call button A) with 2 function, one is buy (+) and one is sell (-) , of course it won't work with only button , so I make it as (+) in the first place . Now I try to do a button (let call button B) that can switch the button A from (+) to (-) . Here's the node part - All the node thing in button A - button B only send the signal to button A to switch (+) to (-) I want the function , like button A when I press it , it +1 then I press it again +1 and keep +1 ++++1 . Now , now , this button B switch the button A to -1 and when this button turn on , the button there will be -1 and -1 and so on ... Until it turn off , it switch it back to +1 All asset was in 2D world not UI screen Can anyone help me just code a little bit on the switch or there was a better way to do it ?
Its a very simple task Make script node add two input connections and two out put connections 1st input for getting the input from A btn Other for getting input from B Btn. Inside script add variable on top for example let cs=true; Then in signal function do this For example your 1st input name was abtn If(name=="abtn" && value) { If(cs==true) { this.emitSignal("positive",true); } else { this.emitSignal("negative",true); } } Lets switch values when b btn is pressed Lets say 2nd input was bbtn Again below in signal function do this If (name=="bbtn"&&value) { If(cs==true) { cs=false; } else { cs=true; } }