Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to make a character walk back and forth?

HeyFriesHeyFries Posts: 78Member
edited November -1 in Working with GS (Mac)
How to make a character, like an enemy, walk back and forth within a constrained distance, without controllers?


  • gyroscopegyroscope I am here.Posts: 6,577Member, Sous Chef, PRO
    Hi, there's a wiki entry called How do make an actor pace back and forth? you'll find it here:


    ""You are in a maze of twisty passages, all alike." - Zork        temp domain

  • HeyFriesHeyFries Posts: 78Member
    Thanks, I am already able to make my character pace back and forth, but I also want to change the animated image to match the character's direction. How do I do that?

  • butterbeanbutterbean Posts: 4,315Member, PRO
    To do that, create 2 rules:

    When self.motionlinearvelocityX > 0
    Animate: Facing right images

    When self.motionlinearvelocityX < 0
    Animate: Facing left images
  • HeyFriesHeyFries Posts: 78Member
    Thanks a lot! Now I got my character's animation matching the direction too!

    I created a player that jumps when I touch the screen, and it jumps properly when the gravity Y is set to 900, but the character that is pacing back and forth doesn't walk when the gravity Y is set to 900, so I changed the gravity Y to 0. Now the character pace back and forth but the player jumps in slow motion when gravity Y is 0. What should I do to make both -player and other character- to work properly?

This discussion has been closed.