How to move an actor left and right with a button

swiftskater1swiftskater1 Member Posts: 97
edited November -1 in Working with GS (Mac)
i have a button. And when i press that button i want him to move right. how would i do this?

I asked this awhile back.

Comments

  • swiftskater1swiftskater1 Member Posts: 97
    please
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Make a game attribute(boolean). Call it ButtonPressedRight

    In that button actor make the rule:
    Rule: If Actor Recieves Event, touch, pressed
    --Change Attribute: game.ButtonPressedRight = true
    Otherwise:
    --Change Attribute: game.ButtonPressedRight = false

    In your moving actor make a rule that checks if the game.ButtonPressedRight is true
    --Move: Direction 0,
  • swiftskater1swiftskater1 Member Posts: 97
    Hm. I still cant get him to move!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    upload your project so we can take a look at it
  • venon_itvenon_it Member, PRO Posts: 594
    hi,
    i create a example for you !!!

    download project here : http://gamesalad.com/game/play/33166

    By By Luke
  • swiftskater1swiftskater1 Member Posts: 97
    Thank you so much guys. Ok. So. How would i make the buttons scroll on the screen with the actor?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    create a layer and uncheck the scroll box. Then no matter what the size of you scene is put your buttons in place as if the scene is only 480x320 and they will stay where you want them as long as they are on that non scrolling layer.
  • swiftskater1swiftskater1 Member Posts: 97
    Worked perfect!
Sign In or Register to comment.