How do I make a lerp camera follow, instantly change on layout swap?

  • So I have currently a camera set on every tick to lerp(scrollx, player.X, 0.05) lerp(scrolly, player.Y, 0.05) that way it follows the player smoothly, however when I change a layout and I place the coordinates of the player elsewhere for the new lavel, the camera follows smoothly from outside the edge of the screen to the character new location.

    How can I make the camera quickly snap to the player current position if on every tick tells it to always use lerp?

  • Just set the scroll to player position in "On start of layout" event.

  • Thanks, originally I had done that and did not work, then I realised while trying to fix it that I had made a mistake in the set position of the camera as well, so it should have been self.x and self.y (instead of scollx and scrolly which I copied from somewhere else) for some reason when I fixed that the camera on start also got fixed :)

  • So, another little issue with this if anyone is still reading!

    When you anchor objects to a layer like the UI but the camera has lerp all of those UI elements tremble like crazy, anyone else encountered this?

  • Did you set parallax and scale rate to 0 for UI layer?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much, that worked!

    I had done UI for Contruct like 3 years ago, so I completely forgot I had to take care of that.

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