Change variable value based on another one

Hey guys, I'm working on this game project and I need to increase x money based on x customers.
Exemple: if I have 100 customers, I want the money to increase 10/second. If the customer value drops to 50, the money increases only 5/second.
Is that possible? I really don't know how to do that. :/
Thank you!

Best Answers

  • tatiangtatiang Posts: 11,949
    edited February 2015 Accepted Answer

    Timer every 1 second
    .....Change Attribute game.money to game.money+game.customers/10

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

  • tatiangtatiang Posts: 11,949
    Accepted Answer

    @luccafreitas said:
    how do I let the score keep counting if the user changes the scene

    If you have that same Timer in an actor on the scene you change to, it will just keep increasing the money accordingly. Game attributes (as opposed to scene or actor/self attributes) do not reset when you change or reset scenes.

    @luccafreitas said:
    how do I let the score keep counting if the user closes the app?

    This is trickier. You have to do some massaging of the device clock attributes. A starting point is to Google gamesalad device clock.

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

Answers

  • luccafreitasluccafreitas Member Posts: 9

    @tatiang said:
    Timer every 1 second
    .....Change Attribute game.money to game.money+game.customers/10

    Thank you!!
    I have one more question, how do I let the score keep counting if the user changes the scene or closes the app?

  • luccafreitasluccafreitas Member Posts: 9

    Thank you @tatiang , problem solved ;)

Sign In or Register to comment.