judge the num position we type

cmzcmz Member Posts: 46
edited April 2012 in Working with GS (Mac)
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

Best Answer

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I think I understand what you're trying to do, but if not, please reply and clarify. You can do this with a single actor. Place the actor in all four "digit" spots on the scene. Edit the actor's prototype and add an integer attribute called self.location. Then double-click on each actor on the scene and change each actor's self.digit value to 1, then 2, then 3, then 4 in order of appearance.

    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:

    image
  • cmzcmz Member Posts: 46
    thanks for comment ,I expound my question in detail,please see my picture:)
    Photobucket
  • cmzcmz Member Posts: 46
    Here's a demo I just made: http://dl.dropbox.com/u/19602014/Calculator Demo.zip
    wonderful thanks a lot & cheers :)
Sign In or Register to comment.