How do I make an actor move by pressing a different actor

whity7whity7 Member Posts: 58
edited November -1 in Working with GS (Mac)
I want to make my sprite move by pressing a different sprite which would be a button please help

Comments

  • azavegaazavega Member Posts: 362
    ok I think your trying to do an up and down,left and right button... if thats the case think you have to create 2 game attributes one for X and one for Y...
    Then the button you press change those attributes depend of the orientation... if you want to go up increase Y, down decrease Y...and so on
    Then constrain your actor position X and Y to those values... I never did it before but I think that should work
  • whity7whity7 Member Posts: 58
    The only problem is i don't know how to make one actor do it for a different actor
  • azavegaazavega Member Posts: 362
    Im kind of new here but as far as i know have to be done with attributes... game attributes not actors attributes... so you can use them with any actor on the scene...
    Dont know if this help you, probably somebody else knows better...
  • whity7whity7 Member Posts: 58
    thanks ill try it out
  • SingleSparqSingleSparq Member Posts: 1,339
    Example: set global attribute integer called "move"
    On actor one, set rule to "if pressed change global.move to 1"
    On actor two, set rule to "if global.move = 1 do something"
    Go from there
  • vegasmike1vegasmike1 Member Posts: 192
    Its really easy to make one actor move another

    First set an attribute in the game, call it move make it boolean and let it be false.

    Then make a rule for that object or actor that says, when touch is pressed change attribute of move to true.

    Then go to your actor you want to move and make a rule, when attribute of move is true, then add behaviour that says, when Move is true, add behaviour MOVE to the rule and have it move in the direction you want it to move.

    Once you get that working you can see how easy it is to do so you could make a joystick or whatever you want and when you press an actor it will affect the other actor.

    Make sense., if not let me know and I will make you a small project file, getting a handle on variables is the most important factor in GS, IMHO

    mike
  • quantumsheepquantumsheep Member Posts: 8,188
    There's a codemonkey demo that demonstrates this really well - it's basically move and shoot using buttons to control your spaceship.

    Just look under CodeMonkey's profile - should be there!

    Hope that helps,

    QS :D
  • whity7whity7 Member Posts: 58
    I figured out how to do it yesterday but thanks for the help!
  • BeyksGamesBeyksGames Member Posts: 1
    Im just a 12 year old and i dont know how to make a button when u press to make another actor move up????????????? Please help :(
Sign In or Register to comment.