I'm trying to make it so that I have three buttons to push, and when all three have been pushed a new button appears or it takes me to a new keyframe or something.
Here's how far I've gotten:
[FLASH=http://files.myfrogbag.com/by6oea/CODE%20FUCKING%20FUCK%20FUCK.swf]f[/FLASH]
First frame sets the variable "box" to 3:
box = 3;
Second frame: each button's a movie clip with two frames (with frame one being a button) so that it can only be clicked once. each one can bring down the variable "box" (in the dynamic text box) down by 1.
code for each button:
on(release){
_root.box -=1;
}
on(release){
gotoAndStop(2);
}
On a layer above in the main timeline I've got this:
stop();
if(_root.box<=0){
gotoAndStop("win");
}
I've been using tutorials like this (they're about simple RPG battle systems):
http://www.newgrounds.com/portal/view/230421
I'm no expert at ActionScript, I basically just followed the tutorials so I have no idea how to make this work properly or if this is even the system I want to make this happen.
I'm a shitty coder so you might want to wait for advice better than mine. Also I'm not going to test my suggestions to make sure they work, because I think they will.
on(release){
_root.box -=1;
}
on(release){
gotoAndStop(2);
}
You can probably lump both of those things into one onRelease, but instead, how about replacing that code with this:
on(release){
vcrclockIsTheBest();
}
Then, delete everything after stop() on your top layer, and fix it so it looks like this:
stop();
function vcrclockIsTheBest(){
_root.box -=1;
this.gotoAndStop(2);
if(_root.box<=0){
_root.gotoAndStop("win");
}
}
All I've done here is put redundant code into a function, and because this function is called every time you click a button, I've thrown the if statement in there so that it's checked every time you click a button. As it is, I think the if statement is only checked once -- that is, when it comes up on the main timeline.
Let me know if it doesn't work or I did a bad job of explaining it.
I had to change a few things but it ended up working!
Each button is actually a movie clip with 2 frames, frame 1 has the button and frame 2 has the "clicked" button (so that it can't be clicked again). I moved the "gotoAndStop(2);" from the main timeline to each button:
on(release){
_root.vcrclockIsTheBest();
gotoAndStop(2);
}
I also had to put _root. in front of the function, I guess so that it would go back to the main timeline.
stop();
function vcrclockIsTheBest(){
_root.box -=1;
if(_root.box<=0){
_root.gotoAndStop("win");
}
}]
^ main timeline code
Thank you very much VCR :D