This site requires JavaScript, please enable it in your browser!
Greenfoot back
OgresHaveLayers
OgresHaveLayers wrote ...

2019/4/18

Animal Sound Board game

OgresHaveLayers OgresHaveLayers

2019/4/18

#
Anyone able to help me with my code on my sound board game, need help specifically for playing a sound then pausing for 1 second then playing the next sound and repeating this another 8 times. I also need help with tallying up the points when you click the correct animal. Help would be very much appreciated.
danpost danpost

2019/4/18

#
OgresHaveLayers wrote...
need help specifically for playing a sound then pausing for 1 second then playing the next sound and repeating this another 8 times. I also need help with tallying up the points when you click the correct animal.
You can list the sounds, or name of the sounds (which will still require a GreenfootSound field for the currently playing sound) in an array and add an int field to track which one is playing (index pointer for array), plus another int field to run the delay timer. That way, either a sound is playing or the timer is running. If timer is running (value greater than zero) and when decreased hits zero, bump the index and play the sound it points to. If no sound is playing and timer is zero, set the timer to start the delay (60 usually works for close to a one second delay).
You need to login to post a reply.