How can I make an attribute go from 1 to 2, 2 to3, 3 to 4 and then 4 back to 1.
I have an interger attribute called MovementDirection. Every time I press button A the attribute changes to MovementDirection +1. The movement on the Ship is like this: If movementDirection is 1 - Move Up. If it is 2 - Move Right. If 3 -Move Down and if 4 - Move Left.
Button B, when pressed, changes the attribute like this: MovementDirection to MovementDirection -1.
How can I keep the att in 1,2,3 and 4. If I press button A when the att is at 4 how to make it go to 1 instead of 5 and if it is at 1 and I press button B. How to make it go to 4 instead of 0.
Button B, when pressed, changes the attribute like this: MovementDirection to MovementDirection -1.
How can I keep the att in 1,2,3 and 4. If I press button A when the att is at 4 how to make it go to 1 instead of 5 and if it is at 1 and I press button B. How to make it go to 4 instead of 0.
Comments
When touch is pressed
--Change attribute Game.Attribute to (game.attibute+1)%4
The will cycle 0,1,2,3
Now if you absolutely need 1-4 and cannot live with 0-3 you would do something similar but it will require an extra rule.
When Touch is Pressed
--Change attribute game.attribute to (game.attribute+1)%5
And Then a rule
When game.attribute = 0
--Change Attribute game.attribute to 1
___________________________________________________________________________________
TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!
AppSolute Entertainment on Facebook
AppSolute Entertainment on iTunes
change attribute to ((game.attibute+1)%4)+1?
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
@jb15, I need this to be with attributes because there are a lot of other stuff that are linked to this movement.
Anway, I'd use tenrdrmer's way--it would use fewer rules--just throwing another option out there.
Thanks a lot guys, it worked like a charm.
I guess your approach works jb15 but like you said, fewer rules.
Ps: @Tenrdrmer: as soon as this game gets approved I will send you a promo so you see what I did with the template I bought from you a couple of months ago ( Expanding Menus4).
Thanks again.