View Full Version : memory game

cool denny
01-30-2003, 08:07 PM
I need help.
If I have a few instances on my scene, that, when clikcked play a sound (say five of them), could you tell me how to keep track of the ones being clicked so that I may play the sounds back to the user when they finish selecting the sounds they want? Similar to simon says but this is for my drum machine.

01-31-2003, 02:34 AM
Howdy... Welcome to the club... :)

I'd keep add the new numbers into the array so that you can scroll through the array when needed...

01-31-2003, 05:01 AM
Yeah definately an array, use this simple routine

//default variables
function resetKeySave(){
if (keyArray.length > 0){
delete keyArray
keyArray = new Array()
keyCurrent = 0

function saveKey(keyNum){
function playNextKey(){
return keyArray[keyCurrent]
//dunno how you are making the sounds, but just adapt this
function makeSound(){
this["sound" + playNextKey()].play()


when you make a sound call saveKey(), sending the number of the sound you are playing, when you want to play the sounds, set up a routine to call playNextKey.

you could send the name of the sound, rather than just a number to reference it, and tell make sound to play that as well.

hope that works??