Page 1 of 1
Trouble with switches
Posted: Sat Aug 15, 2020 12:56 am
by ocean77
So, I have a couple of flip switches that are set up like this:
On mouseclicking the buttons I want them to flip 'on' and add their respective values to a variable, and also subtract their values when flipped 'off'.
I was thinking I could use the same button image for both the 'on' and 'off' positions, but I'm too dumb to figure out how apparently.
Doesn't seem to be possible to have two conditions on the same event. Is that correct?
Also, how does the "Skip Events" thing work?
Thanks.

Re: Trouble with switches
Posted: Sat Aug 15, 2020 9:45 pm
by airsoftsoftwair
Don't know what you mean because the screenshot is missing

Re: Trouble with switches
Posted: Sun Aug 16, 2020 9:12 am
by jPV
The image link seems to be a dropbox link and doesn't show as embedded then. Here's the URL to it for easier viewing:
https://www.dropbox.com/s/o7u3nrv827c6r ... 6.png?dl=0
Re: Trouble with switches
Posted: Sun Aug 16, 2020 9:22 pm
by airsoftsoftwair
@jPV: Thanks.
@ocean77: You don't need to use "Skip events" for what you want to do. Just add the non-selected and selected switch images to the page at the very same position. Make the selected switch image invisible. Then, add the following events to the non-selected image for "On mouse up":
1) Hide object: non-selected switch image
2) Show object: selected switch image
Now when the user clicks the image, the non-selected switch will be hidden and the selected one will be shown which will create the effect of activating the switch.
Alternatively, you could also import the two switch images into an animation object and then show frame 2 (= switch on) when the mouse button is down and frame 1 (= switch off) when it is up...
There are lots of ways to do what you want...
Re: Trouble with switches
Posted: Mon Aug 17, 2020 1:08 am
by ocean77
Ok.
I guess what I was asking is if there was a possible visual way to add an else-if statement to the same graphic element, so I wouldn't have to have two.
Probably best to use code for these type of instances anyway(?)
Thanks.
Re: Trouble with switches
Posted: Mon Aug 17, 2020 4:51 pm
by airsoftsoftwair
Do you mean that you only want to use one object for the switch instead of two? That is possible by creating the switch as an animation object with the first frame being the off switch and the second frame the on switch... or vice versa.
Re: Trouble with switches
Posted: Mon Aug 17, 2020 11:23 pm
by ocean77
airsoftsoftwair wrote: ↑Mon Aug 17, 2020 4:51 pm
Do you mean that you only want to use one object for the switch instead of two? That is possible by creating the switch as an animation object with the first frame being the off switch and the second frame the on switch... or vice versa.
Got it! Thank you!