Pages: 1
I'm looking for a way to do the following action:
When (action key) is pressed
play this (sound)
stop, don't repeat until (action key) is released
What happens when I set this up as:
when [space v] key pressed play sound [meow v]is that the sound keeps looping the whole time the action key is held down. I only want the sound to play once while the key is pressed, and if it is held down it won't keep looping. But if you release the key, then repress it, it will play the sound again once, and wait until it is released and pressed again.
Offline
Yes you are headed in the right direction.
when gf clicked set [sound v] to (0) when key [space v] pressed if <(sound) = (0)> play sound [sound v] set [sound v] to (1) end set [sound v] to (0)Good luck on this project!
Last edited by powerpoint56 (2012-11-12 17:00:22)
Offline
powerpoint56 wrote:
Yes you are headed in the right direction.
when gf clicked set [sound v] to (0) when key [space v] pressed if <(sound) = (0)> play sound [sound v] set [sound v] to (1) end set [sound v] to (0)Good luck on this project!
That wouldn't wok because when you press space, yes, the sound will start playing, but then sound will get reset to 0, the script will run again, sound will get played again, and the problem won't be solved. Instead, after moving/changing a few blocks, you could get something that works:
when gf clicked set [sound v] to (0) when key [space v] pressed if <(sound) = (0)> set [sound v] to (1) play sound [sound v] until done set [sound v] to (0) endAnyway, I hope that this helps!
Offline
when gf clicked set [sound v] to (0)
when key [space v] pressed if <(sound) = (0)> set [sound v] to (1) play sound [sound v] until done wait until <not <key [space v] pressed?>> set [sound v] to (0) end
Last edited by BoltBait (2012-11-12 18:03:19)
Offline
Hi!
I don't know if you're already done and dusted with this, but there's a much simpler way to do this!
when gf clicked forever if <key [space v] pressed?> play sound [meow v] until done wait until <not <key [space v] pressed?>> end end
Offline
Pages: 1