Skip to main content
Participant
November 14, 2023
Question

Incremental Game counter help

  • November 14, 2023
  • 1 reply
  • 200 views

Heya, new to working in adobe animate, and i'm trying to, as the title says, make an incremental game with Animate. I'm new and don't know much about coding, so I was asking how to make it so when i push my button (let's say Button1), it starts adding 1 to a points counter infinitely while also removing the button from the scene? i'm in HTML5 Canvas if it helps. thanks in advance!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
November 14, 2023

this.cnt=0;

this.yourcountertextfield.text=this.cnt;

this.btn.addEventListener("click", counterF.bind(this));

 

function counterF(){

this.cnt++;
this.yourcountertextfield.text=this.cnt

}

iiiaaa123Author
Participant
November 20, 2023

Sorry for the late answer, but its not quite what i'm looking for. From what I understand, this would simply add 1 to the cnt variable when btn is clicked, but I need it to start adding 1 to that variable every second.

kglad
Community Expert
Community Expert
November 21, 2023

then use a timer (eg, setInterval).