Adding a Comma in Display Text?
JDuaneJ
San Francisco Member Posts: 300
Is this possible? If I wanted to display 1,000 instead of 1000.
Best Answer
-
TheGabfather Posts: 633
Yeaahhh, a quick Google search of "Gamesalad commas" gives you this resulting page. There are two methods highlighted in that thread, you can just choose which you need
Answers
Dang I knew it, i did a search too. Thanks for your help!
Illustration Portfolio:: |
Our Christmas Wishes for iPad:: |
Astropak for iPhone,
Android
and Kindle Fire
I guess you could also create a game text attribute and call it comma. Give it a comma value.
In your expression, you could do something like this:
game.score..game.comma..etc etc
I believe that would work, but it's really not necessary as there are easier ways. Just thought I'd post this in case it helps someone in the future.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I just tried the crazy long expression route in the forum link shared by @TheGabfather. Seems to be ok for prototyping, but I doubt I would use it in production. I think the best solution was the last one, displaying a "Custom Font Comma" that is just hidden until game.score > 999 etc.
I just wanted something while I'm prototyping crap so my score felt more complete. Thanks guys!
Illustration Portfolio:: |
Our Christmas Wishes for iPad:: |
Astropak for iPhone,
Android
and Kindle Fire
Actually, it only appears to be a bloated expression because it deals with numbers up to the millions. You can trim it down as per your needs, starting from the left.
In traditional programming, you would probably use something like it as well -- floor functions and a lot of modulo (%). Even mathematical stored procedures make use of them under the hood.
The idea is that it might seem long and ergo might produce performance hiccups, but in truth it's just peanuts for your computer or device to compute.
But, to each his own good luck with your latest game!