PDA

View Full Version : [AS2] spot the difference game Help


nfcj
02-04-2009, 12:59 PM
Hello to all, I am new to this forum. I am actually doing a spot the difference game, but somehow i got stuck. My problem is that upon finding all the errors(3 in my case), the game will be complete. But however i do not really catch the logic so how do I go about doing this? thanks in advance.

atomic
02-04-2009, 01:00 PM
Attach your .fla to this forum.

nfcj
02-04-2009, 01:41 PM
I can't seem to upload my fla since it is very big but i think will post my codes

//to make the buttons invisible
btn1._alpha = 0;
btn2._alpha = 0;
btn3._alpha = 0;
btn4._alpha = 0;
btn5._alpha = 0;
btn6._alpha = 0

//to make the circles invisible also
cir1._alpha=0;
cir2._alpha=0;
cir3._alpha=0;
cir4._alpha=0;
cir5._alpha=0;
cir6._alpha=0;

//to prevent the hand cursor from showing up to reveal the answer
btn1.useHandCursor = false;
btn2.useHandCursor = false;
btn3.useHandCursor = false;
btn4.useHandCursor = false;
btn5.useHandCursor = false;
btn6.useHandCursor = false;

//to show the circle when the error have been identified
btn1.onRelease = function()
{
cir1._alpha = 100;
cir4._alpha = 100;
}
btn2.onRelease = function() {
cir2._alpha = 100;
cir5._alpha = 100;
}

btn3.onRelease = function()
{
cir3._alpha = 100;
cir6._alpha = 100;
}


I can't really find the logic to end the game upon the 3 errors being identified.
I have thought of using the If else statement.

atomic
02-04-2009, 01:47 PM
Use a file sharing site as www.rapidshare.com to upload your .fla, and provide here the link to download it from there...

nfcj
02-04-2009, 02:05 PM
http://rapidshare.com/files/193831199/interface.fla.html

here's the link to the file. thanks

atomic
02-04-2009, 02:44 PM
Try this...


//to make the buttons invisible
btn1._alpha = 0;
btn2._alpha = 0;
btn3._alpha = 0;
btn4._alpha = 0;
btn5._alpha = 0;
btn6._alpha = 0

//to make the circles invisible also
cir1._alpha=0;
cir2._alpha=0;
cir3._alpha=0;
cir4._alpha=0;
cir5._alpha=0;
cir6._alpha=0;

//to prevent the hand cursor from showing up to reveal the answer
btn1.useHandCursor = false;
btn2.useHandCursor = false;
btn3.useHandCursor = false;
btn4.useHandCursor = false;
btn5.useHandCursor = false;
btn6.useHandCursor = false;

//to show the circle when the error have been identified
btn1.onRelease = function()
{
this._parent.spotted++;
cir1._alpha = 100;
cir4._alpha = 100;
}
btn2.onRelease = function() {
this._parent.spotted++;
cir2._alpha = 100;
cir5._alpha = 100;
}

btn3.onRelease = function()
{
this._parent.spotted++;
cir3._alpha = 100;
cir6._alpha = 100;
}

var spotted:Number = 0;

this.onEnterFrame = function(){
if(spotted >= 3){
trace("Congratulations!");
// Some other actions here...
// goto another page or whatever else...
delete this.onEnterFrame;
}
};

stop();

nfcj
02-04-2009, 03:16 PM
thanks appreciate it

atomic
02-04-2009, 03:20 PM
Grrrrrreat! ;)