How do you make a sound effect play one time after you touch the screen.

jobeijobei Member Posts: 39
edited June 2012 in Working with GS (PC)
The way my game is set up, I just want to touch on an item and hear the sound effect go off one time. after that if you touch on the same item you dont hear the sound effect anymore. I dont want it to repeat everytime you touch the screen. How do you make this happen?

Best Answers

  • gyroscopegyroscope I am here.Posts: 6,598
    edited June 2012 Accepted Answer

    Hi, @jobei

    You really don't need a video for this: if you're not even sure how to make an attribute, you'd best work through some basic training via the Cookbook, I'd advise. :-)

    Firstly, with respect to @bjandthekatz his solution isn't correct (you don't need a timer every 5 seconds to change an attribute, for instance).

    @tshirtbooth solution is correct.

    • In the Scene Editor, make sure Game is selected and click on the Attributes button.

    • click the + button and choose boolean

    • name it playsound and check the checkbox (to make it true)

    • In the actor that you press, put TSB's solution in the editor:

    Rule:
    When touch is pressed AND game.playsound is true
    play sound
    change attribute game.playsound to false

    Hope that sorts it finally for you.

    PS THere are some excellent videos on the GameSalad channel on YouTube; I haven't got the address to hand but another member might let you know before I check it out...


    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Posts: 6,598
    edited June 2012 Accepted Answer

    Hi again @jobei
    I think I almost got it, what do TSB's stand for?
    That's my shortened version of tshirtbooth's name!


    something new pop up for me, when I use the change attribute I get the two boxes set: and to: but inside my set box it say "self.playsound" It don't say "game.playsound" What am I doing wrong?
    OK, so you're seeing "self.playsound" and "game.playsound" in the Attribute Browser: "game.playsound" is the correct one in this case, as this is the global attribute you set. By the sound of it, you also made what could be called a local attribute in the actor prototype (the one in the Actor Library) and called it the same. Just delete this one so you don't get confused.

    Actually, a local attribute would work just as well in this case but it's probably a good idea to make all your attributes as game attributes to begin with, until you fully understand the difference.

    I hope that's explained it well enough for you and I haven't confused you more - I get the idea you're new to GameSalad - the more you use the GameSalad Creator and work through examples and tutorials, the more it'll all click into place for you.

    The best of luck with it... :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • jobeijobei Member Posts: 39

    just to let you know I have the sound working , i just need to know how to not make it repeat when you touch on the screen again and again
  • jobeijobei Member Posts: 39
    Hi there

    make a game attribute game.playsound (boolean) set to true

    rule
    if game.playsound is true and touch is pressed
    play sound
    change attribute game.playsound to false


    that should do it

    cheers
    I'm a little lost, should I start by going to Behaviors then conditions and pick Attribute? or should I go to action and pick change attribute?




  • jobeijobei Member Posts: 39
    This is what I'm trying to do , inside my game there's a empty table with nothing on it. Now in my game when you touch a part of the table a lil monster pops up and you can "hear him laugh" then he fade away. My problem is if you touch the same area the laughing sound still play even tho the monster is gone. I cant get the sound to stop playing when you touch that part of the screen.

    I hope that helps
  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    edited June 2012
    This is what I'm trying to do , inside my game there's a empty table with nothing on it. Now in my game when you touch a part of the table a lil monster pops up and you can "hear him laugh" then he fade away. My problem is if you touch the same area the laughing sound still play even tho the monster is gone. I cant get the sound to stop playing when you touch that part of the screen.

    I hope that helps
    make an integer attribute=0

    for sound actor do
    when touch is pressed change attribute Integer to 1
    when Integer attribute=1 play sound
    Timer, every (ex. 5 seconds) change attribute Interger=0

    hope this helped.

  • jobeijobei Member Posts: 39
    This is what I'm trying to do , inside my game there's a empty table with nothing on it. Now in my game when you touch a part of the table a lil monster pops up and you can "hear him laugh" then he fade away. My problem is if you touch the same area the laughing sound still play even tho the monster is gone. I cant get the sound to stop playing when you touch that part of the screen.

    I hope that helps
    make an integer attribute=0

    for sound actor do
    when touch is pressed change attribute Integer to 1
    when Integer attribute=1 play sound
    Timer, every (ex. 5 seconds) change attribute Interger=0

    hope this helped.


    I think i need to see a video, is there any videos on here or youtube that come close to what I'm trying to do, that i can learn from?

    Thanks for trying, when it comes to this Im really slow lol

  • jobeijobei Member Posts: 39
    I think I almost got it, what do TSB's stand for?

    something new pop up for me, when I use the change attribute I get the two boxes set: and to: but inside my set box it say "self.playsound" It don't say "game.playsound" What am I doing wrong?
  • jobeijobei Member Posts: 39

    Hi again @jobei
    I think I almost got it, what do TSB's stand for?
    That's my shortened version of tshirtbooth's name!


    something new pop up for me, when I use the change attribute I get the two boxes set: and to: but inside my set box it say "self.playsound" It don't say "game.playsound" What am I doing wrong?
    OK, so you're seeing "self.playsound" and "game.playsound" in the Attribute Browser: "game.playsound" is the correct one in this case, as this is the global attribute you set. By the sound of it, you also made what could be called a local attribute in the actor prototype (the one in the Actor Library) and called it the same. Just delete this one so you don't get confused.

    Actually, a local attribute would work just as well in this case but it's probably a good idea to make all your attributes as game attributes to begin with, until you fully understand the difference.

    I hope that's explained it well enough for you and I haven't confused you more - I get the idea you're new to GameSalad - the more you use the GameSalad Creator and work through examples and tutorials, the more it'll all click into place for you.

    The best of luck with it... :-)

    I DID IT!!!!! I GOT IT TO WORK!!! It feel like I won the superbowl lmao Thank gyroscope, tshirtbooth, bjandthekatz

    Yeah, I had to play around with all the info you guys gave me , so I'll see you all the next time I'm lost,...
  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    , so I'll see you all the next time I'm lost,...

    ok you can pm me or email. (my signature)

Sign In or Register to comment.