How do I show 2 digits for a Global number, when its '00'

Just started using Construct 2? Post your questions here

Post » Sat Dec 05, 2015 8:27 pm

I made a simple clock in a game I'm working on. Each action has a time it takes to complete, that's added to "TimeinMin". When "TimeinMin" is greater then or equal to 60, I add 1 to "TimeinHR" and subtract 60 from "TimeinMin"

My issue is getting "TimeinMin" to read '00' When needed. I end up with times such as 4:0 instead of 4:00

I'm new to Construct 2, came from Stencyl which was frustrating me, so theres a bit of a learning curve here. Thanks in advance.
Posts: 5
Reputation: 210

Post » Sat Dec 05, 2015 8:42 pm

From the manual

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".
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 05, 2015 8:47 pm

Dang it! I knew it would be something simple, but I didn't see that while I was searching around, thank you very much for the fast response.
Posts: 5
Reputation: 210

Return to Beginner's Questions

Who is online

Users browsing this forum: Stenky and 0 guests