Help understanding a formula in OSTime Demo

sawkasteesawkastee Member Posts: 184
edited July 2013 in Working with GS (Mac)
I'm looking at the OSTime demo. In the LED clock the minutes digit has the following formula:

Constrain Attribute, Self Image to:
( game.Clock.Minute %10)..".png"

Can someone tell me what the %10 and ..".png" is doing?

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    The 10 would be used to find a specific number. For example, if the minute on the clock was 59, Game.Clock.Minute%10 would take the last number out of the two, which is 9. If the minute was 59 and the equation was Game.Clock.Minute%100, it would get 59 out of it. The ..".png" will add a .png to the end of any number or name, this is used to display the image in the clock. (Ex. 1.png)

    Here is a good tutorial on it

  • sawkasteesawkastee Member Posts: 184
    thanks
  • TheGabfatherTheGabfather Member Posts: 633
    @sawkastee
    The % is called the Modulo Operator. It just gives you the remainder of a division.

    It has been suggested by GS staff to use the mod(x,y) operator -- they're trying to set a programming standard, so that if any major changes affecting the equation editor takes place your old games won't break.

    Also I think there's no need to add the file extension when directing the name of images in Gamesalad (correct me if I'm wrong).
Sign In or Register to comment.