Arrows move actor left-right?

EminemEminem Member Posts: 667
edited November -1 in Working with GS (Mac)
I haw two arrows set up on left and one right I have this actor and I want the user when touch the arrows the actor moves to that side anyone know how to do this

Cheers,

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Quick and dirty way:

    Have two global variables - Booleans - call them 'Left' and 'Right'

    On the left arrow have a rule:
    If touched:
    Change 'Left' to True.
    Change 'Right' to False.

    On the right arrow:
    If touched:
    Change 'Right' to True
    Change 'Left' to False

    On the player actor:

    If Left = True
    Move actor left

    If Right = True
    Move actor Right

    If you want to change the direction the actor is facing, you can always use different images depending on whether Left or Right is true.

    Hope that helps!

    QS :D

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

  • EminemEminem Member Posts: 667
    ok i made two Booleans and checked them both in the left arrow i click creat rule and touch is pressed

    then i created a new rule but changed it to attribute and then i chose game.left is true and game.right is false

    and i did the same for the right but the opposite

    in the player i created a new rule and choose attribute and put game.left is true and inside i put a move left behaviour

    and

    creat rule attribute and it is gmae.right is true move right

    but when i play it it stays still is there something im doing wrong?
  • quantumsheepquantumsheep Member Posts: 8,188
    deadbully said:
    ok i made two Booleans and checked them both in the left arrow i click creat rule and touch is pressed

    then i created a new rule but changed it to attribute and then i chose game.left is true and game.right is false

    and i did the same for the right but the opposite

    in the player i created a new rule and choose attribute and put game.left is true and inside i put a move left behaviour

    and

    creat rule attribute and it is gmae.right is true move right

    but when i play it it stays still is there something im doing wrong?

    I'm not sure I understand where you've put the booleans.

    They should be GLOBAL attributes, not on the actor itself. i.e. they should be game.left, not self.left for example.

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

  • EminemEminem Member Posts: 667
    Thanks for the tip! It worked perfectly I owe u big time ! Thx
  • quantumsheepquantumsheep Member Posts: 8,188
    You owe me nothing.

    Just help others out with what you learn! ;)

    QS :D

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

  • EminemEminem Member Posts: 667
    I will thx again xD
Sign In or Register to comment.