GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Multiple equation

Jesse10Jesse10 Posts: 2Member, PRO
edited December 2014 in Tech Support

Hello,

I was wondering if any of you could help me with my problem.
I want to change scene every time my totalscore reaches a multiple of 50 (50, 100, 150....).
My thought was to make a rule with

Attribute game.totalscore = ?????

Change Scene

Is there any equation that will give every multiple of 50?
Perhaps anyone knows a better solution

I would really appreciate any help!

Jesse

Comments

  • tatiangtatiang Posts: 11,699Member, Sous Chef, PRO, Senior Sous-Chef
    edited December 2014

    If your score will always hit a multiple of 50, you can use a rule that says When numeric expression mod(game.totalscore,50)=0, change sccene. The mod() function returns the remainder of a division problem. So when the score is divided by 50 if there is no remainder, then you would change the scene. Note that mod(0,50)=0 so you'll have to have another condition that says attribute game.totalscore>0.

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

  • Jesse10Jesse10 Posts: 2Member, PRO
    edited December 2014

    @tatiang said:
    If your score will always hit a multiple of 50, you can use a rule that says When numeric expression mod(game.totalscore,50)=0, change sccene. The mod() function returns the remainder of a division problem. So when the score is divided by 50 if there is no remainder, then you would change the scene. Note that mod(0,50)=0 so you'll have to have another condition that says attribute game.totalscore>0.

    I have two scene's and want to go back and forth between these.
    However when i use your rule, and go from scene 1 to 2 i have a problem.
    The scene won't go back if i put the same rule in scene 2 but change 'change scene' to scene 1

    Could you perhaps tell me which rule i should put in scene 2 to go back to 1 and back to 2 again and back to 1 every 50 points.

    Thank you for your reply earlier!

    Jesse

  • tatiangtatiang Posts: 11,699Member, Sous Chef, PRO, Senior Sous-Chef
    edited December 2014

    Hmm... I think the problem is that once you get to the next scene, the rule condition is immediately true so it tries to change scenes. Try this modification.

    Click on the actor to add 25 points. Every two clicks, it will switch scenes.

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

  • colandercolander Posts: 1,610Member
    edited December 2014

    @tatiang @Jesse10 you could put mod(game.score+50,100) in Actor 1 and mod(game.score,100) in Actor 2 and you won't need the game.endOfSceneScore attribute, change attribute and rule condition.

  • tatiangtatiang Posts: 11,699Member, Sous Chef, PRO, Senior Sous-Chef

    Ooh, I like that a lot, @colander. I actually came up with a simpler version that uses a single actor but I didn't post it. Yours is much cleaner.

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

Sign In or Register to comment.