How to: make background stop when actor stops
fatetaleteller
Member, PRO Posts: 40
Hello!
How can i make my parallax background scrolling stop when my actor is not moving in any direction?
At the moment background works fine but for example if my actor runs against a wall background still continues to move
Comments
Why does it continue to move ?
@Socks Oh hello again!
It moves because at the moment only thing that stops the background is if all keys are not pressed.
Sounds like another way of saying that pressing a key moves the background ?
Can you upload a stripped down version of your project, just the main actor and the BG actor ?
@Socks it says "file not allowed" when i try but here is what i did.
You need to compress/zip the file before uploading.
@Socks Thanks in advance!
"if my actor runs against a wall background still continues to move"
I can't see any walls, the hero actor falls off the screen as soon as you start, there are broken references in the hero actor's rules . . . etc etc.
Maybe someone else will have better luck.
Well you just asked for main actor and bg actor xD @Socks
Does the background have any behaviors?
Hi, its really easy for create parallax effect, you have tutorial here:
http://www.gamesalad-templates.com/gamesalad-tutorial-parallax/
I think the method your using is to teach beginners more about gamesalad logic , and it works but it has two flaws :
1- as you mentioned the background moves when your walking against a wall
2- If you had a checkpoint at the middle of the level the background will remain the same so it will cause issues.
The best method to use is this:
First Create two game attributes make them real attributes call them CAMX , CAMY
1 - Create an actor call it CameraControl
2 - Create an actor for your background image
Place the CameraControl actor on the scene and unlock it to access scene attributes
Add 2 constrains
Constrain Game.CAMX to scene.Camera.Origin.X
Constrain Game.CAMY to scene.Camera.Origin.Y
thats it for the CameraControl Actor
Now go to your Background actor create 4 real self attributes
1- X speed
2- Y speed
3- StartX
4- StartY
Make sure to tick off scrollable and add these actors to a non scrollable layer
Now play with the X and Y speed to get the effect you like ..
Hope this helps