0 Favourites

How do I keep camera centered on character?

  • Im working on a sidescroller platform game but I cant seem to get the camera to stay centered on my player character sprite I am using these: lerp(Self.X, Player.X,0.03) lerp(Self.Y, Player.Y,0.03) but with these settings the player mainly moves to the far right of the screen when I move right and the far left when I move him left

    can anyone please tell me the settings to get my camera keep the character at the center when scrolling?

  • You can either use the System action Scroll to: Player.X, Player.Y, every tick

    or

    You can apply the Scroll To behavior to your Player

  • If you only want the lateral movement and not the up and down. You can create a sprite name it "Camera", make it invisible and have it updating its X position to the player's X positon constantly and use the Scroll To Behavior on the camera sprite.

  • Thanks for replying I have the scroll behavior on the player,playerbox and the camera and I tried the settings you mentioned but the camera still wont stay in the center also when the player to the top platform at the end of the level the camera doesnt follow him up to the top of the layout would you guys have any idea why the camera wont scroll to the top of the layout?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Yes, in the layout settings for that layout (on the left side of the C2 editor), you need to set "Unbounded Scrolling" to Yes. Otherwise, it will keep the viewport within the boundaries of the layout.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 39,772
lucasgc1's avatar
lucasgc1
Unread hot topic
99 10,136
karshinkoff's avatar
karshinkoff
Unread hot topic
0 Favourites
Keep me logged in.
66 5,736
grigrizljac's avatar
grigrizljac