How do I keep camera centered on character?

0 favourites
  • 5 posts
From the Asset Store
2d warrior machrom platformer game character assets
  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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)