Need help with small Soundboard project
Hi,
I am new here and have now a few days a look on GameSalad and tried my first project.
I create a Soundboard with 12 buttons. I set a rule for each button to play a soundfile when touching the button and change the button so that the user see, that this sound will be player currently.
So the soundboard doesn't work correctly. The change of the image does work with all buttons fine. But play the music of the soundfile does only work for the last button!
Also while I add each button, also only the last has worked. Did you have an idea?
My Rule:
if touched pressed (for the button), play music / change image.
If touched outside (for the button), stop music / change image.
I am new here and have now a few days a look on GameSalad and tried my first project.
I create a Soundboard with 12 buttons. I set a rule for each button to play a soundfile when touching the button and change the button so that the user see, that this sound will be player currently.
So the soundboard doesn't work correctly. The change of the image does work with all buttons fine. But play the music of the soundfile does only work for the last button!
Also while I add each button, also only the last has worked. Did you have an idea?
My Rule:
if touched pressed (for the button), play music / change image.
If touched outside (for the button), stop music / change image.
Answers
the outside from all the other buttons kills the music when you touch the button you want to play
You will likely have to add a stop music button or do something like putting your stop music and change images into the otherwise section of the touch is pressed rule.
I tried to put the stop music and chance image into the "Otherwise"section, but then nothing happes. In my try, the button changed again into the outgoing image - as it should be. But only there is no sound, than that from the latest button is be played.
I didn't want to make a stop music button.
Any other ideas?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
so each button would look like this
When touch is pressed
--Change game.musicnumber to 1
When game.musicnumber = 1
--Change image to button down
Otherwise
--change image to button up
You will need that for each button with a unique value for the button
Then in the scene have a controller actor or you could even just put this in the background actor
When game.musicnumber = 1
--Stop Music
--Timer after 0.1 sec
---PlayMusic
Otherwise
--When game.musicnumer = 2
----Stop Music
----Timer after 0.1 sec
-----PlayMusic
Otherwise
Etc…….
Ace
@tenrdrmer: It do it, but without the "Stop Music" and "Time after..." and it worked good.
So the board is almost complete, but I want it, that a click on the current played sound (where the button is marked) the sound stops to play and also the button change into the startbutton.
I tried several ways (for example to have a new attribute =2, when touching again) but it doesn't work.
I didn't know how and where to handle it, that this current touched button can touched again. I've tried it with "pressed" or "inside", but both is no correct.
Also I've worked with the tutorial and the cookbook and now much more is clear. But with this question my theory isn't working
http://forums.gamesalad.com/discussion/678/help-making-a-toggle-switch
In my mind came a few seconds ago: Set all attributes at start on 0. Then when touched is pressed set attribute to 1 and when touched ist outside set attribute to 2.
Then if button is 0 = stop sound, change into standard-image
Then if button is 1 = play sound, change image
Then if button is 2 = stop sound, change image
Could this work? I'll try...
Which method should I use for hitting again the button?
"Inside" doesn't work
Could you upload your project file? There have been many solutions given to you.
Regards,
Jack McGraw
Or should I promt the two main files?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Button 1 (image = 1) has the code:
----
Rule
All
Actor receives event => touch is pressed
Change Attribute "game.sound1" to "1"
-
Rule
All
Actor receives event => touch is outside
Change Attribute "game.sound1" to "0"
-
Rule
All
Attribute "game.sound1" = "1"
Change Image to "1a"
-
Rule
All
Attribute "game.sound1" = 0
Change Image to "1"
----
Button 2 (image = 2) has almost the same code:
----
Rule
All
Actor receives event => touch is pressed
Change Attribute "game.sound2" to "1"
...
====
An invisible Actor in the board has the code:
----
Rule
All
Attribute "game.sound1" = 1
Play Music "1"
Otherwise
Rule
All
Attribute "game.sound2" = 1
Play Music "2"
...
----
I've tried several things, but I didn't know how to check if the button was pressed again. If I hit another button, everything works fine (current Music stops, new button will be changed and new Music will be player). But if hit the same, then the music starts new, but it should stop and the button should be as unpressed.
BEst
As was mentioned above, if you want to toggle a button (on/off), you can see http://forums.gamesalad.com/discussion/678/help-making-a-toggle-switch.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If touch first button, everything works. If touch again, music stops, button changed. This works with all buttons. Good. But if don't touch the current playing button again and hit another one, then sometimes no new sound was played, but the button changing is correct. But also sometimes it works.
I've tried also to set the attribute to 0 if the button was touched outside, without success.