Modulus Function Help
I want a scenario where when a block goes off screen, it adds to a counter, call it "blockcount" (which I already have got going). Once "blockcount" is divisible by 10 completely, I want the value of block count to pass into another attribute. I think I need to use the modulus function but I don't really know how. Any ideas?
Comments
game.ConstantZero = 0
Rule: if game.ConstantZero = mod(game.blockCount,10)
1 less constrain, and try to shift over to using the mod(x,y) function instead of %.
If you want to avoid a constrain behavior, create an integer attribute named game.ZERO and give it a value of zero. Then, create a rule that says When [all conditions] attribute game.blockcount>0 AND game.ZERO=game.blockcount%10 ... [rules]
I assume you're wanting to keep a tens counter or something along those lines?
So it would be:
When attribute game.blockcount>0 AND game.ZERO=game.blockcount%10
.....Change Attribute game.tensCount to game.tensCount+1
.....Change Attribute game.blockcount to 0