is there anyway to make a button toggle on and off without having to use different keys to do it? so say for example if i have a sound sprite and i want it so when i click it it turns on and off like a switch. i cant get this to work and im having to use 2 different keys to do it. ex M for music and then O to turn it off. so yeah. idk how to explain it much clearer than that so hopefully you understand what i mean. hope you guys can help me! thanks!
Offline
try this:
when gf clicked forever if < key [toggle v] pressed? > //make the toggle key any key you like if < (toggle) = [on] > set [toggle v] to [off] //if it's on, it will turn off else set [toggle v] to [on] // if it's not on, it will turn on end wait until < not < key [toggle v] pressed ? > > endThis should work.
Last edited by AgentRoop (2012-05-06 20:46:33)
Offline
when key [m v] pressed set [music v] to (((music)+(1)) mod (2)) // 1 for on, 0 for off set volume to ((100)*(music)) %
Offline
This is a bit cryptic:
when [sprite v] clicked next costume set volume to (((2) - (costume #)) * (100)) %But it should work nicely if you give the sprite two costumes. That way you get a visual indication whether it's on or off for free.
Offline
when gf clicked switch to costume[sound on] set{on?} to (1) when [Sprite1] clicked next costume set{on?} to < [-1] * (on?) > if < (on?) = [1] > set volume to [100] % end if <on?> = [-1] > set volume to [0] % end when gf clicked play sound [any music] until done
Offline
selenamarte wrote:
when gf clicked switch to costume[sound on] set{on?} to (1) when [Sprite1] clicked next costume set{on?} to < [-1] * (on?) > if < (on?) = [1] > set volume to [100] % end if <on?> = [-1] > set volume to [0] % end when gf clicked play sound [any music] until done
when gf clicked switch to costume [sound on] set {on?} to (1) when [Sprite1] clicked next costume set {on?} to < [-1] * (on?) > if < (on?) = [1] > set volume to [100] % end if <on?> = [-1] > set volume to [0] % end when gf clicked play sound [any music] until donethis one
Offline
the set on? to 1 is the variable.
Offline