***Method for making ANY object unscrollable***

3xL3xL Member Posts: 676
edited March 2012 in Working with GS (Mac)
Maybe some of you already know this. So forgive me, but I'm just trying to help out. 

I noticed when I uncheck the "scrollable" box in the "layers" tab, this layer moves up the list. 

So un scrollable layers can't be under a scrollable layer?

Anyhow, here's what I did in my scenario. 

I have a level with a sun. And I want to sun to ALWAYS stay in the center of the camera. But the sun is in the back of the HUD and level objects layers. 

Layer 1: HUD  (score, life, items pause button)

Layer 2: Enemies, hero and all that

Later 3: Sun

My camera size is:

Height: 600
Width: 800

So here is the sun's behaviors:

Constrain self.position. X
To
Scene.camera.Origin. X+400

I added those extra 400 pixels since the camera is 800 pixels wide and I want the sun to be at the center of the camera's position. What's half of 800? 400. 

So now to sun moves along with the camera where ever the camera goes. 

This is a easy method to make any actor on ANY layer un scrollable. 

Hopes this helps somebody :)

Comments

Sign In or Register to comment.