Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Game development stories & opinions
Just wondered what a good way to create a simple on off button would be?
Develop games in your browser. Powerful, performant & highly capable.
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.
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.