Navigate a falling object left/right with buttons

GrubGamesGrubGames Member Posts: 77
edited November -1 in Working with GS (Mac)
Ok so I have a bouncing object and I want it to move left/right naturally using control buttons. Any help would be appreciated.

So far I set up some attributes to control the actor but it's just not acting naturally.

Thanks

Comments

  • rlehmrlehm Member Posts: 320
    Create right and left button actors
    Make two attributes
    Mright
    Mleft

    In the buttons, when press, mright = true
    Otherwise mright = false

    In the falling actor
    If mright =true
    Change attribute self.motion.velocity.x = a number here

    Do the same for the other button, remember it'll have a - number

    Away from game salad so this is all on memory, sorry if it's wrong
  • hotMagichotMagic Member, PRO Posts: 266
    Yeah that sounds good. If you want it to be some percentage thing, like a throttle, you could also do:
    velocity.x=velocity.x *[some modifier like 1.25]

    that way if it's moving sideways already for some reason, it won't slow down when you're trying to speed it up, which could happen if you chose a low static num. And you can set a max of course. good luck
Sign In or Register to comment.