Hello all,
Just wondered what a good way to create a simple on off button would be?
Regards
It depends, there some ways
Global Variable = 0 means Off, 1 means On
For instances, create an instance variable and select Boolean, you can set true or false in event.
Create the item you want to use as the button (the button object or a sprite for example) Give it an instance variable called ONOFF (could be anything you want) and set it as BOOLEAN. Then on clicked with the mouse use the TOGGGLE BOOLEAN option. This will switch the FALSE (default value) to TRUE. Clicking again will switch it back ... and so on.
You just need to test for the value of the instance boolean variable.
Easier to show that describe so I knocked this up :) Hope it helps.
CAPX
DEMO
Develop games in your browser. Powerful, performant & highly capable.
Mouse Right Click : Insert New Object /// Form Controls | Button
As Easy as this ...
Thank you all that has worked a charm, never knew about inverting.