I'm trying to add a thing where a counter will go up every time an action is performed and also go back one frame
Specifically I want it to say THING (#)
I already have the if statement set up. I just need actionscript within the if statement that:
1. Makes the counter do the THING (#) starting with one and keep going up (don't know if there is supposed to be a limit but if there is, 100 preferably.
2. takes the movie back one frame!
i'm a noob i know.
edit:
Thank you guys for the help. I'm having a little trouble though, the counter doesnt work. :\
I've tried naming the counter thing "counter" and named it's instance "counter" and then I put the actionscript as counter++;
but it doesnt work... are there any additional settings?
I'm not sure what you mean for the THING part, but to go to the previous frame use prevFrame();
For obvious reasons use it after the other part.
For the THING part, do you want it to do a trace command or change something in a text box?
Edit: You said counter. I'm a dumbass.
If you want to have a counter in a text box/field, on the text field under 'Properties' or something theirs a text box that says 'Var' (If you make a dynamic text, which you should). Type in a variable name there then declare that variable somewhere in the code (On the first frame or something). Then in the if block (but before prevFrame) put
var++;
with var replaced with the variable's name. If you want to keep the variable from going beyond a certain limit put the var++ within an if block like so
if ( var>100){
var++;
}
Edit again: If you want some text next to the number make sure they're in different text fields. Make the text one static and the number one dynamic like I said above. You could have them in one field if you really wanted, but that would take more work.
Yes it is possible even if it goes back one frame? The counter?
I'm not sure what you mean by "actions" but I take it that it's just buttons being clicked.
Include this on all buttons that would mean "preforming an action"
on(press){
countervariablegoeshere++;
framevariablegoeshere--;
nameofthemovieclip.gotoAndStop(framevariablegoeshere);
}
_root works too instead of a movieclip, if you want the whole movie to go back one frame.
edit: ye prevframe works too, I just like using vars.
Thank you guys for the help. I'm having a little trouble though, the counter doesnt work. :\
I've tried naming the counter thing "counter" and named it's instance "counter" and then I put the actionscript as counter++;
but it doesnt work... are there any additional settings?
Quote from: Franklin G. Hamilton;1511726for dynamic textboxes you put var as counter, not the instance name.
then you can reference it like _root.counter = 343425453;
Resolved!
Thanks!!
edit: THANKS GUYS IT'S MY FIRST TIME MAKING A GAME