• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Incremental Game counter help

New Here ,
Nov 14, 2023 Nov 14, 2023

Copy link to clipboard

Copied

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!

TOPICS
Code , How to

Views

100

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2023 Nov 14, 2023

Copy link to clipboard

Copied

this.cnt=0;

this.yourcountertextfield.text=this.cnt;

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

 

function counterF(){

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

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2023 Nov 20, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 20, 2023 Nov 20, 2023

Copy link to clipboard

Copied

LATEST

then use a timer (eg, setInterval).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines