Button click counter

5 posts

Flag Post

I am sorry if this has been already here, but I need help. I am pretty newbie in developing (As you can see from my games), and I wanna make a game, where you will have to press a button as many times you want. So how do I do this counter?

For example, I will press the button, and the counter goes up to 1. Then again, it goes to 2. And so on.

 
Flag Post

Set a variable for the number of button clicks. When the button is clicked, increment the variable. Then, if you like, you can set the value of a text object to the value of the variable.

I have no idea of syntax, as I don’t know AS, but that’s probably the easiest way to go.

 
Flag Post

In AS2, make a button. Put score as its variable and btn as instance.

Then, input this awesome AS on the frame.

btn.onRelease = function() {
score++;
}

If you want to see the score, make a dynamic text box and put score as the variable.

 
Flag Post

Didn’t understand that, but thanks to Sp3000. He gave me .fla. Now I know how to make a counter… This topic can be locked.

The Button Counter.

 
Flag Post

For reference: ptdgames’s post is AS3 (ActionScript 3), while the others are for AS2.