Number Utilities
Overview
Number utilities provide functions for formatting and manipulating numbers in your game. These utilities are particularly useful for displaying scores, timers, and other numerical game elements.
Number Formatting
Zero Padding
The getZeroPaddedNumber
function adds leading zeros to a number:
Common Use Cases
Score Display
Timer Formatting
Level Numbering
Best Practices
-
Use consistent padding lengths for similar types of numbers:
-
Consider locale-specific formatting when needed:
-
Use appropriate padding lengths for your use case:
Tips and Tricks
-
Combine with other utilities for complex formatting:
-
Use for file naming conventions:
-
Create helper functions for common formats: