Move when touch the button

Martin14Martin14 Member Posts: 109
edited November -1 in Working with GS (Mac)
how can i make a good move when i touch a button ??

i make a a rule when tuch is press .. change atribete (left) to 1.

when touch is release change atribute (left) to 0.

rule
when atribute left is = 1

accelerate.

my problem is that when i touch two buttons at the samie time my actor go anywere... :S

sory for my English !

Comments

  • expired_012expired_012 Member Posts: 1,802
    Very SImple:

    2 game integer attribute

    -left
    -right
    ---------------------

    Left button:

    When Touch is pressed

    change attribute: game. left to 1

    OTHERWISE

    change attribute: game.left to 0

    -------------------------------

    Right button:

    When touch is pressed

    change attribute: game.right to 1

    OTHERWISE

    change attribute: game.right to 0

    ------------------------------

    MOVING ACTOR RULES:

    RULE 1: When attibute game.left is 1

    MOVE: Direction 180

    OTHERWISE

    change attribute: game.left to 0

    RULE 2: When attribute game.right is 1

    MOVE: Direction 0

    OTHERWISE

    change attribute: game.right to 0
  • Martin14Martin14 Member Posts: 109
    @artonskyblue

    I do that but I have up down left rigth... if i press up and rigth at the same time my actor start moving alone... :S
  • expired_012expired_012 Member Posts: 1,802
    Ah i see what you mean now.

    Basically you would have to go in each button and do something like this:

    LEFT BUTTON:
    When (any) attribute
    -game.up=1
    -game.down=1
    ----Rule: when touch is pressed
    change attribute game.left to 0

    ETC....

    See what I mean? Try to play around with it.
Sign In or Register to comment.