TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
How to make an actor walk and walk to the opposite direction?
Pages:
1
How to make an actor walk and walk to the opposite direction?
Osman2001
Posts: 19
April 08, 2015, 04:43:10 am
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?
Osman2001
Posts: 19
April 08, 2015, 04:44:04 am
I mean I know how to make the actor walk but not change its direction
letmethink
Posts: 2545
April 08, 2015, 05:31:30 am
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
otherwise:
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.
~Letmethink
Osman2001
Posts: 19
April 08, 2015, 07:46:29 pm
Thanks a lot letmethink! SOLVED!
Pages:
1