Custom Font

Hello Im trying to make a custom font score for my game and im using gamsaladcookbooks method to do it and the game is running but my image isnt showing up.... its just a rectangular square please help

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    That means something is messe. Up in your code. Go back and make sure that the code is correct.
  • peterraadpeterraad Member Posts: 56
    edited January 2014
    It is but im not sure whats wrong with it: "score_"..floor((game.Score%self.Divider)/(self.Divider/10))..".png"
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If the image doesn't appear, try using the Log Debugging Statement to show you what the value of your expression is (the one you posted above). Just take that same expression and drag it into the Log Debugging Statement expression editor.

    Open the Debugger window and when that portion of the code runs see what it evaluates to. Then check to see that your image filename is the same. The ".png" should be optional.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • peterraadpeterraad Member Posts: 56
    edited January 2014
    ok so im not sure what you meant but i made a log debugger attribute in the display_score actor and then i copied the statement that constrains the attribute to the log debugger. then i ran it and the debugger said this: Log(Actor: Display_Score): score_nan but im not sure what i should do from here
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    peterraad you can notify me in a post by using the @ symbol, such as @tatiang.

    If it is displaying score_nan then your code is not working. The code you posted looked okay at first glance... do you want to either post an actual screenshot or send me a link to download the project file (first compress it as a .zip file and then upload it to a filesharing service such as Dropbox or Mediafire)? If so, I can take a look and let you know why it's not working.

    On a Mac, I use Spotlight to do quick calculations to see if my code should work. For example, since your expression is:

    floor((game.Score%self.Divider)/(self.Divider/10))

    You could enter*:
    floor((105*100)/(100/10))

    This results in 1050, so I would expect to have an image file named 1050.png in my file. That doesn't make much sense as far as a custom font is concerned so hopefully you get better results!

    [*I assumed 100 for your self.Divider value but you should enter whatever your actual value is; I also assumed 105 for your game.Score value but you should enter actual possible score values and test a few to see what result you get.]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • peterraadpeterraad Member Posts: 56
    Sure! here @tatiang this is the link to my project file https://www.mediafire.com/?9wpml7tmsphcuh2
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    Your self.Divider attribute is set to 0 in your Display_Score actor. Because of this, you are always dividing by zero since self.Divider/10 is zero. Hence the score_nan.png result.

    Also, your game.Score attribute jumps all over the place. I'm not sure if you intended it that way, but after I shoot an enemy, it quickly goes down several times. I added a DisplayText actor with game.Score so I could watch it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • peterraadpeterraad Member Posts: 56
    Thanks a lot I got it... and lol yea I made it go down everytime you shoot a bullet so that you think wisely before you start spraying all over the place it works now thanks!!
Sign In or Register to comment.