Custom Font
Hey guys, I have a problem with something.
I've looked into some videos to how add custom fonts to display score, but I couldn't apply my game score rules to those "images" that are displayed as numbers. Is there any way that I can add fonts to be displayed as text behavior? Or any way to make them work lol
Thank you
Best Answer
-
tatiang Posts: 11,949
What values of self.div are you using for each digit? I believe you would need 10, 100, 1000, 10000, and 100000.
There is a difference in parentheses between what I posted...
floor((game.Score%self.div)/(self.div/10))
...and what you posted:
floor(game.Score%self.div)/(self.div/10)
You have to take the floor of the entire expression, not just the first calculation.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
No, that video is probably the best way to use "custom fonts". There is no way to add your own fonts to GameSalad right now.
I have a method but it works best with mono-spaced fonts. The demo was made with Mac Creator so I'm not sure how helpful it will be.
http://forums.gamesalad.com/discussion/comment/510981/#Comment_510981
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you!
The score is being displayed with my rules, only 1 problem: When the score gets to 10 it starts to 1 again.
Ex: 1, 2, 3, 4 ,5 ,6 ,7 ,8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20...
How do I fix that?
The only way I can know what's wrong is if I can see your rules.
Can you upload a screenshot to a file-sharing site and then embed or post the link here? To show expressions in the expression editor, first click on the 'e' and then take the screenshot with the full expression showing.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Or you can upload and share a link to your project file (be sure to .zip it first).
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I only made one rule, just for testing.
Timer
Every 1 second
Set: game.Score to game.Score+1
I guess the problem is in the custom numbers. Each actor (with a custom font 0 for image) have an integer with 10 for value, but the 10 increases a 0 in the next actor, exemple:
0 0 0 0 0 (5 actors on the screen)
100000 10000 1000 100 10
I know it's confusing, I hope you understand
I don't but if I saw your expressions for each custom digit, I would. You probably have something that looks vaguely like this:
floor(( game.Score % self.div )/( self.div /10))
If you can post those expressions, I can help you fix them.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yes I do, exactly like that one:
(this is what happens when the counter reaches 10, instead of 11, it shows 1.
Have a look at the link in my signature it is a paid template but it does a lot i.e it's dynamic it will shift position as the score grows and shrinks, handles negative scores, etc.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Wow, I didn't notice the missing ( ) haha
Sorry for the trouble,
Thank you, problem solved.
You're welcome!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User