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
→
Actor Goes Out of Scene [Solved]
Pages:
1
Actor Goes Out of Scene [Solved]
Edge123
Posts: 62
November 26, 2019, 09:31:09 pm
Alright so lets refer to the actor I'm having a problem with as actor 1 and the actor that has no problems as actor 2
I've been using this code to keep actor 1 in a scene:
if x < 0
set x to 0 for self
if x of self > scene width (pixels) - width of self
set x to scene width (pixels) - width of self
For some reason it works for when the actor's x < 0 but not for when the actor is out of bounds on the other side of the scene. I have this exact code for actor 2 and it works for them. Any idea as to why actor 1 is not working with me?
« Last Edit: January 17, 2020, 12:38:57 pm by Edge123 »
MrD69
Posts: 235
December 16, 2019, 09:36:26 pm
What is the width of your screen compared to the width of the scene. Most likely the scene is wider than the screen so the actor appears to go out of bounds but exists still within the screen. No idea why it would work for one actor but not the other.
Games: Arrow Mania, Breakout/Outbreak, Water Drop
NickamonPoppytail
Posts: 1141
December 17, 2019, 03:04:36 am
Go into the Behaviours tab of Actor 1 and click "Add Behaviour". Under the Motion tab, you'll find Stencyl has a pre-made behaviour called "Cannot Exit Scene" for actors. Attaching it to your actor should hopefully fix the issue.
Upcoming Projects
Poppytail 5
and
Pixeltail
: Fifth and sixth main instalments in Poppytail series.
A Game About Trimming Hedges: Final Version
: An updated version of the original AGATH.
One Million
: Last-one-standing style small project.
The Poppytales
: Platformer boss rush with character collecting.
Skies n' Fall
: Boss rush shooter prequel to Rise n' Brawl.
Precious
: Weird platformer.
Christmas Time 2
: Sequel to Christmas Time 1.
Bombini
Posts: 1401
December 18, 2019, 12:54:13 am
Sometimes your described method doesnt work because the actor is already outside of the scene.
I use it in the way that i will prevent the actor from even moving outside of the scene (so cheking where the actor will go to and checking if thats inside the scene or not).
Edge123
Posts: 62
January 17, 2020, 12:38:27 pm
Sorry about the very late reply but I just looked at my code again after a while and realized the scene is bigger than the resolution you play in
. I appreciate the help though.
Pages:
1