How do I pan the viewport?

  • I would like to make a 2D side-scrolling platformer. By default, the viewport is on the top-left corner, I would like to move it to the bottom left corner so I can make it so that the user only sees a certain portion of the level and the screen will pan with the user, allowing them to access the rest of the map. Can I pan the viewport from the top-left corner to the bottom-left corner, and Is there a better way to do this?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The easiest way to do this is to add the "scroll to" behaviour to your character, this will cause the viewport to follow the character while respecting the edges of the layout.

  • The easiest way to do this is to add the "scroll to" behaviour to your character, this will cause the viewport to follow the character while respecting the edges of the layout.

    Thank you, but will that move the viewport to bottom-left as well?

  • It will keep the attached object in the center of the screen, but will not move any part of the viewport outside of the layout.

    When attached to a character; moving the character to the bottom left will cause the behaviour to scroll to the bottom left.

    If that's not what you want then there are system actions which allow you to manually control the camera position. "Scroll to position", "Scroll X", "Scroll Y", "Scroll to object".

    You should just give it a go, takes like 2 minutes to create a project to test it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)