Only happening when button is being pressed


#1

Hey there !

Here is my problem : I added a “plain button” to my game, and when the player presses on it, I would like my main character to start laughing. But when the player doesn’t press the button anymore, then I would like my character to get back to normal. The thing is, I really don’t see how that could be possible. The only solution I found so far is to add two buttons : one that makes the character start laughing when you press on it, and the other one that makes him go back to normal. It’s not very convenient for what I would like to do though. Do you have any idea how and if I could even solve this problem ?

For more details, I would like to make something similar to these “kiss when noone is watching” games (like “Kiss Me Quickly”), except that it wouldn’t be about kissing this time.

Thank you in advance !


#2

Hi @Winx! Try this method:
1)Add the counter behavior for the your object
2)Create the new events:
1):

 Button/Sensing/Touch Down
 Player/Counter/Set Value/0

 Player/Sound/MySound/Start Playing
 Player/Counter/Set Value/1 (This is to ensure that playback does not start again indefinitely.)

2):

 Button/Sensing/Touch Up

 Player/Sound/MySound/Stop Playing
 Player/Counter/Set Value/0

#3

It works ! Thanks a bunch !


#4

…No problem :wink: