How do I stop the camera from scrolling outside of a sprite

  • How do I stop the camera from scrolling outside of a sprite yet keep it's focus on the player?

    I wish there was a way to make bound scrolling for sprites, similar to how it is for layouts.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are, just control the scrolling manually via the Scroll to position system action rather than the scroll to behavior.

    For exemple (a simple rectangle limitater), Area is a rectangle sprite, player is the target of the camera:

    Every tick: System>Scroll To position:

    X:clamp( Player.X , Area.BBoxLeft + OriginalWindowWidth/2 , Area.BBoxRight - OriginalWindowWidth/2)

    Y:clamp( Player.Y , Area.BBoxTop + OriginalWindowHeight/2, Area.BBoxBottom - OriginalWindowHeight/2)

    This should work however I may be incorrectly using the Originalwindowwidth and height (never tried them, and I assume a letterbox scale).

    But you get the idea, a manual control is necessary.

    As for "I wish there was a way to make bound scrolling for sprites, similar to how it is for layouts.", there could be inconsistency of what the result should do if there is a non rectangular form.

  • The resolution my game is running is 256x224, which is an 8:7 aspect ratio.

    Would all the rectangle sprites have to be the same size? Also "non rectangular form"? I thought Construct2 could only do box/rectangle shapes.

    Thanks for the help!

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