Copy link to clipboard
Copied
Hey everyone, I am creating a "iSpy" game, where you find objects and once you do, it will take you to a "winner screen"
How do I make it so that when after I click each of the objects (3 movieclips in total), they disappear right after? Also, how do I make it so that when I get a score of 3 (Each time I click an object, its +1) it takes me to a winner screen?
Any help would be appreciated as I'm not really sure how the delete function in actionscript works, but I do have an idea on how to set up the scoreBox which is listed below:
// I use my text tool add a text box and type Score: and then change it to dynamic text, then I add another text box right next to it, I make the instance name scoreBox and type nothing in it
var score = 0; // my variable for my starting score
scoreBox.text = score;
code here for deleting object
score +=1;
scoreBox.text = score;
Hi,
You can have all of your code in the first frame of the Actions layer. With a keyframe set with a label "Win", your code for ActionScript could read something like the following (your objects need to have instance names of myObject1, etc.):
stop();
var score = 0;
myObject1.addEventListener(MouseEvent.CLICK, addScore);
myObject2.addEventListener(MouseEvent.CLICK, addScore);
myObject3.addEventListener(MouseEvent.CLICK, addScore);
function addScore (event:MouseEvent):void {
score += 1;
scoreBox.tex
Copy link to clipboard
Copied
Hi,
You can have all of your code in the first frame of the Actions layer. With a keyframe set with a label "Win", your code for ActionScript could read something like the following (your objects need to have instance names of myObject1, etc.):
stop();
var score = 0;
myObject1.addEventListener(MouseEvent.CLICK, addScore);
myObject2.addEventListener(MouseEvent.CLICK, addScore);
myObject3.addEventListener(MouseEvent.CLICK, addScore);
function addScore (event:MouseEvent):void {
score += 1;
scoreBox.text = String(score);
var target = event.target;
target.visible=false;
if (score > 2) {
gotoAndStop("Win");
}
}
ps: take advantage of code snippets when you can.
Copy link to clipboard
Copied
Thank you for your help!
Copy link to clipboard
Copied
"Hey everyone, I am creating a "iSpy" game"
"I Spy", unless Apple is making surveillance equipment now.
Copy link to clipboard
Copied
Do airpods count as surveillance equipment? They have a feature where you can turn "live listen" to "ON" and are able to leave your phone in a room with someone and hear what they're saying. Of course, its not really meant for that; its purpose is more of a hearing aid.