stimulateme
January 18th, 2003, 09:15 PM
This is my first actionscript thingy and I’ve started to make a simple game using actionscript and I’m having trouble with a little problem. The game is supposed to be a guess which cup the coin is under type of game. Everything pretty much works except that I cant make the cups move up.
The game first puts one coin randomly behind one of the 3 cups. Then on click of one of the 3 buttons it checks if the coin is there and then displays the appropriate msg.
I have tried to make the cup move up by using a motion tween but I don’t know how to make this play or link to it on release of a button. Here is the code I have so far.
------------------------------------------------
randomize();
function randomize() {
_root.coina._visible = false;
_root.coinb._visible = false;
_root.coinc._visible = false;
_root.win._visible = false
_root.lose._visible = false
_root.buttonrandom._visible = false
_root.buttoncupa._visible = true
_root.buttoncupb._visible = true
_root.buttoncupc._visible = true
a = 1;
b = 2;
c = 3;
randnum = random(3)+1;
if (a == randnum) {
_root.coina._visible = true;
d = 1
} else if (b == randnum) {
_root.coinb._visible = true;
} else if (c == randnum) {
_root.coinc._visible = true;
}
}
buttonrandom.onRelease = function() {
randomize();
};
buttoncupa.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUP. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUPA FOR THE MOTION TWEEN.
if (_root.coina._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
buttoncupb.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUPB. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUP FOR THE MOTION TWEEN.
if (_root.coinb._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
buttoncupc.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUPC. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUP FOR THE MOTION TWEEN.
if (_root.coinc._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
--------------------------------------------
Any help is appreciated;) :q: :q:
The game first puts one coin randomly behind one of the 3 cups. Then on click of one of the 3 buttons it checks if the coin is there and then displays the appropriate msg.
I have tried to make the cup move up by using a motion tween but I don’t know how to make this play or link to it on release of a button. Here is the code I have so far.
------------------------------------------------
randomize();
function randomize() {
_root.coina._visible = false;
_root.coinb._visible = false;
_root.coinc._visible = false;
_root.win._visible = false
_root.lose._visible = false
_root.buttonrandom._visible = false
_root.buttoncupa._visible = true
_root.buttoncupb._visible = true
_root.buttoncupc._visible = true
a = 1;
b = 2;
c = 3;
randnum = random(3)+1;
if (a == randnum) {
_root.coina._visible = true;
d = 1
} else if (b == randnum) {
_root.coinb._visible = true;
} else if (c == randnum) {
_root.coinc._visible = true;
}
}
buttonrandom.onRelease = function() {
randomize();
};
buttoncupa.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUP. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUPA FOR THE MOTION TWEEN.
if (_root.coina._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
buttoncupb.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUPB. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUP FOR THE MOTION TWEEN.
if (_root.coinb._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
buttoncupc.onRelease = function() {
// HERE IS WHERE I NEED TO LINK TO THE INSTANCE OF THE CUPC. I HAVE MADE ANOTHER INSTANCE INSIDE THE CUP FOR THE MOTION TWEEN.
if (_root.coinc._visible == true) {
_root.win._visible = true
} else {
_root.lose._visible = true
}
_root.buttoncupa._visible = false
_root.buttoncupb._visible = false
_root.buttoncupc._visible = false
_root.buttonrandom._visible = true
};
--------------------------------------------
Any help is appreciated;) :q: :q: