How do I Make a death counter that starts with 0s [SOLVED]

  • OK i have looked everywhere and for the life of me i can not find a guide that explains how to add 0s in front of a death counter.

    what do i mean by this.. well I'm currently using a "global number" with a simple collision detection for my player.. so when the player collides with the x objects it adds a death to my "global number = deaths" then a text box prints the deaths out on screen.. what i have looked for i can't seem to find.. because this system adds up it douse not achieve the desired look i want. currently it displays my sore as 1 death... 5 deaths.. 15 deaths.. and so on.. and i would like it to be displayed as 00001 deaths... 00005 deaths... 00015 deaths you get the picture..

    i appreciate the help!

    Thanks in advance!!!

  • zeropad(number, digits)

    Pad number out to a certain number of digits by adding zeroes in front of the number, then returning the result as a string. For example, zeropad(45, 5) returns the string "00045".

    from:

    https://www.scirra.com/manual/126/system-expressions

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • oh my!.. thank you so much.. this has been driving me insane for the past hour and half.. i was attempting something a lot more complicated haha. thank you smassa it works like a charm.. much appreciated!!!

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