How to make an actor walk and walk to the opposite direction?


  • Posts: 19
Hi all,

I am making my first game right now with stencyl. I have tried to do what the question above is saying but with no luck. I also tried to make the actor change direction when there is a gap in front of it. Can someone help me?


  • Posts: 19
I mean I know how to make the actor walk but not change its direction


  • *
  • Posts: 2545
when updating:
    if facingLeft:
        if not tile exists at row: (((y of self) + (height of self)) / (tile height)) column: ((x of self) / (tile width)):
           set facingLeft to False
           set xspeed to speed for self
        if not tile exists at row:   (((y of self) + (height of self)) / (tile height))   column: (((x of self) + (width of self)) / (tile width)):
           set facingLeft to True
           set xspeed to negate(speed) for self

Should change direction if there is a gap in front of the player at their feet.


  • Posts: 19
Thanks a lot letmethink! SOLVED!