Create a Counter

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I was wondering how you would create a counter that would count up to the player's score iteratively and you would see it go up from 0, 1, 2, 3. Am I doing it wrong?

    <img src="http://i.imgur.com/IhMa2Ma.png" border="0" />

  • Simplest way I can think of is:

    Create a global variable counter

    system every 0.5 seconds

    system compare two values counter < score

    • system add 1 to counter
    • currentscore set text to counter
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Simplest way I can think of is:

    Create a global variable counter

    system every 0.5 seconds

    system compare two values counter < score

    - system add 1 to counter

    - currentscore set text to counter

    Perhaps add something like:

    maxcounttime = 180 (3 sec x 60 ticks per sec)

    scorecounter = int(score / maxcounttime)

    every tick

    sub int(text.text) < score

    action: set text.text = int(text.text) + scorecounter

    This theoretically would give a 3 second counting function to count from 0 to your score.

    I suggest this because, if you would have a very high score, the counting could take long. this function dynamically reduces counting to 3 seconds (180 ticks).

  • lennaert

    That's why I said "the simplest way", haha..

    There's always room for adding extra stuff..

  • Thanks guys. I guess it's the equivalent of a while loop.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)