How can I improve my animated counter? [Math Formulas]

0 favourites
  • 3 posts
From the Asset Store
City ride is a game to improve your memory.You have to focus and remember the information related to passengers of previ
  • I'm working on a Money counter since I wanted to animate every digit separately I ended up turning the Money Integral into a String and using "len", and "mid" (which can only be used on strings) to display the correct value for every SpriteFont.

    More recently I wanted every digit to not just change to the correct one, but to update the digit's value as it increased until reaching the total value. I was able to accomplish the task but since I just started "programming" I would like to hear the opinion of more experienced users, I was also trying to implement a lerp expression so if I were to add 1 Million Coins I won't have to wait for years until the digits caught up, but it's not working properly as it's now. Do I even need a function? Since I can't use it to update digits because it does everything in 1 tick and it won't look like an animation?

    I'm using the plugin LiteTween for the jumping animations, has nothing to do with the main problem (If I'm doing something wrong related to that please just say so)

    Here are my capx, There's a version with and without LiteTween:

    dropbox.com/sh/gsqcxalkd0822r4/AAAJFiDNDnjfuTQPg22Tbvsea

    P.D: Ignore The add and subtract parameters I probably don't need them.

  • This is my capx which fixed on your file:

    drive.google.com/open

    This is what I changed :

    I moved all local variables to global because they didn't work when they were local.

    My solution could be clumsy but I think it could help you a bit. :D

    Cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Idk why the local variables wouldn't work were they at static mode? They work on my end...

    I like the wave effect but what I was trying to do was to implement it only on the digits that changed, so for example, if I added 100 coins only the 3 first digits would jump, but not immediately first the numbers would start rolling until they caught up.

    But I like the small delay you added on yours so the numbers take turns to jump instead of jumping at the same time when they update I'll try to emulate that idea thanks. I'll keep working on it if I come up with something I'll update this post.

    Edit:

    I've achieved what I wanted but the formula is hardcoded, I would like to have some kind of formula that let me control how long would it take for the digits to update depending on the amount to add, as it's now it works but I guess I'll try to polish it a bit more, especially the speed at which the numbers update I would like to space more the time between update so you can distinguish the number, I think it has something to do with the "For each" If I add a delay on top of that only the first digit will update

    Updated Capx With LiteTween:

    dropbox.com/s/irha9lmwy7kb0zn/Animated%20Counter%20LiteTween%20Version%20V.2.capx

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