how to make a charecter move with something similar to joy pad...

Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
edited November -1 in Working with GS (Mac)
Ok so im new to gamesalad and im making a 2d side scrolling game for the ipad, and im lost as to how i can make a left arrow on the screen and a right arrow on the screen(well i know how to do that) then when u press one of them how would i make my charecter/actor move left if the user presses the left arrow and etc. can someone please help me out or if there is a tuturioal can you please post the link thank you!

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    Set a global attribute (integer) and name it something you'll remember or know what it means, such as PlayerDirection. Then you'll need to set a rule for your button or d-pad actors to trigger that attribute. You might have PlayerDirection 1 for left and PlayerDirection 2 for right, so make the rule go something like this:

    When receives touch change attribute game.PlayerDirection to 1

    Then in the player actor have a rule that says if PlayerDirection = 1 either use the move or animate behaviours.

    Basically this sets it up so that when you press the left button on the screen, the attribute is changed to 1 (left) and the character will move appropriately.

    Hope this clears things up a little... I'm a noob myself. lol.

    Oh and don't forget to set your "else" statements... you won't want your character to keep moving... perhaps have PlayerDirection set to 0 for no movement ;)
  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    thanks man! im gonna try this out if i run into some problems ill keep in contact with you =D
  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    ok so i made my left and right arrow and they make the charecter move left or right but my charecter moves up the screen slowy he doesnt stay at on a straight path and also my charecter keeps moving once i let go of the arrow u said i had to set my else satement? but how do i rite an elste statment here i tried making another rule but that didnt work.. i appreciate it man if u can help me out thanks!!
  • quantumsheepquantumsheep Member Posts: 8,188
    Use 'otherwise' instead of 'else' I guess?

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Hipster_Owl_StudiosHipster_Owl_Studios Member, PRO Posts: 214
    how would i create a rule that makes my charecter stand still once i release the press of the left or right arrow in my game?
Sign In or Register to comment.