1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

[SOLVED] Parallax Background doesn't stop when outside of room.

Discussion in 'Programming' started by Drazglb., Apr 16, 2019.

  1. Drazglb.

    Drazglb. Member

    Joined:
    Apr 12, 2019
    Posts:
    6
    Hi guys, it's me again.
    I'm having an issue with my parallax code.
    Here is how the hole thing is set up; I have 3 background layers, each one follows at a specified speed my character's x position.

    Code:
    layer_x("layer1",clamp(o_char.x/2.5,0,room_width))
    layer_x("layer2",clamp(o_char.x/2,0,room_width))
    layer_x("layer3",clamp(o_char.x/1.5,0,room_width))
    It works fine until I reach the room's boundaries. It moves strangely and it stops only when the character is outside the room. What I want is my "backgrounds" to stop when I my view can't move further to the left, or onto the right. Any idea? I tried with camera_get_view_x but it doesn't work either.
    By the way, my Background layer's sprites have tile horizontal checked in.

    Thank you for your answers in advance.
     
  2. Drazglb.

    Drazglb. Member

    Joined:
    Apr 12, 2019
    Posts:
    6
    Alright, so it seems I am definitely an idiot.
    This tutorial helped me, I just didn't see it before some others.

    Sorry then!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice