Multiple equation
Jesse10
Member, PRO Posts: 2
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
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
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
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
@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.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
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