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

Get help using Construct 2

Post » Mon Dec 15, 2014 2:36 am

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!!!
Last edited by Tenrex on Mon Dec 15, 2014 3:03 am, edited 1 time in total.
Posts: 2
Reputation: 204

Post » Mon Dec 15, 2014 2:41 am

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".

Posts: 27
Reputation: 479

Post » Mon Dec 15, 2014 3:01 am

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!!!
Posts: 2
Reputation: 204

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests