i need some help with constraining a self image to a number.

hi all, i have a game.attribute "coins" so i have a actor that display this amount, so i have it with
constrain self.image to floor((game.coins%divider)/(divider/10))..".png" so i only want to display 3 digits so i have 3 actors, everything works good like if my coins values is 5, my actors images are 005, but i want to display negative numbers to, so if my coins are=-5 why my actors are not 005 instead of 995, if my values is negative i just want to display a image with a negative sign so it looks like this -005,thanks

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    @guilleface

    Hi, off the top of my head, but should work OK:

    When coins > 0 ...........or > -1 if you like
    constrain self.image to floor((game.coins%divider)/(divider/10))..".png"
    Otherwise
    Change Attribute self.image to NegImage

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • guillefaceguilleface Member Posts: 1,014
    thanks but in the otherwise rule if i set it to change to negative image which is a negative sign picture then i get - - - but i solved by adding 3 more actors , i just would like to know why if my value is =-5, my actors are changed to 995?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012
    thanks but in the otherwise rule if i set it to change to negative image which is a negative sign picture then i get - - -
    Well you should get the correct result, don't know why it's not happening for you, i.e if >-1 then change image but if -1 or less, then change to your specific image for negative results.... can't go wrong really...
    i just would like to know why if my value is =-5, my actors are changed to 995?
    That is odd; sorry, don't know why that happens...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.