judge the num position we type
HI ,I was poor at logic. here is my question:
Now I'm making a game about maths, it relate to calculator。+ - X / is OK but I was puzzle that how to judge the num position we type
for example:
_ + _ = _ _
now we have ten num to choose (0-9) I use "rule"to do but fail
number"5"actor :
“rule:"touch" "pressed"; attribute:"first blank" is "true"——change attribute "first blank num"to 5”
“rule:"touch" "pressed"; attribute:"first blank" is "false"+"second blank" is "true"——change attribute "second blank num"to 5”
“rule:"touch" "pressed"; attribute:"first blank" is "false"+"second blank" is "false"+"third blank" is "true"——change attribute "third blank num"to 5”
thanks for reading and help
Now I'm making a game about maths, it relate to calculator。+ - X / is OK but I was puzzle that how to judge the num position we type
for example:
_ + _ = _ _
now we have ten num to choose (0-9) I use "rule"to do but fail
number"5"actor :
“rule:"touch" "pressed"; attribute:"first blank" is "true"——change attribute "first blank num"to 5”
“rule:"touch" "pressed"; attribute:"first blank" is "false"+"second blank" is "true"——change attribute "second blank num"to 5”
“rule:"touch" "pressed"; attribute:"first blank" is "false"+"second blank" is "false"+"third blank" is "true"——change attribute "third blank num"to 5”
thanks for reading and help
Best Answer
-
tatiang Posts: 11,949
Here's a demo I just made: http://dl.dropbox.com/u/19602014/Calculator Demo.zip
Answers
In the actor's prototype rules, have a rule for inputting a digit (are you going to use the keyboard input behavior for this or your own custom buttons?). Store the value in a game-level attribute named after the location (e.g. game.location1, game.location2, etc.). So an example of this might look like: