2D Parallax platformer

Hi guys, i’m making a 2D game, a platformer.
I’m using the offset thing to create a nice style when i walk.
but… here comes the problem!

I’m trying to figure this out by myself for a long time.

When i “get stuck” in a wall for example, the parallax effect wont stop!

Anyone could help me?

Can the linecast function help me?

if yes {
} Else {
What could help me?

Make a few transforms for keep layers content:

  1. layer back: slow moving transforms.
  2. layer 0: player and level transforms.
  3. layer fore: fast moving transforms.

Apply a script on layer transforms,


layer_move_speed = 1;
layer.position = Player.position * layer_move_speed;

Attach the script on each layer roots and change the layer_move_speed property.