0 Favourites

How do I make the camera follow the player only vertically?

  • So i have this platform game, where the player jumps from one platform to another. What i want it is

    the camera to follow him only vertically/up, when if falls the camera will remain in the same position and the player will fall outside of layout(doodle jump like). I tried a few things with scroll to behavior but i don't have to much control with that.

    Maybe it's simple than it's looks but i spent hours trying things and doing research and i couldn't work it out.

  • you should to use the lerp() function instead the scroll behavior I guess, if for example you need to the camera follows onley the main player vartically, then you have to use something like that.

    +System: Every tick
    ->System: Scroll to  lerp(ScrollY, Player.Y, dt)  (only for vertically)
    [code]+System: Every tick
    ->System: Scroll to lerp(ScrollX, Player.X, dt), (only for horizontally)
    [code]+System: Every tick
    ->System: Scroll to lerp(ScrollX, Player.X, dt), lerp(ScrollY, Player.Y, dt)(both)
  • So i tried your method and it works but only partially. The camera still follows the player even when it falls from a platform,

    and i want to freeze the camera somehow and only the player to fall.

    Also the camera has a slow delay, when the player jumps high the camera remains behind to the point where i can not see the player anymore. Pls see Doodle jump to know what i want to achieve.

  • Add player not falling condition to one of the lerp actions and it will work fine.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • ok, so try this

    https://dl.dropboxusercontent.com/u/60873147/RE_FORUM/TEST.capx

    [quote:2cmhgkc7]and i want to freeze the camera somehow and only the player to fall.

    when the player fall out you can freeze the scroll sprite

  • So i added not fallen condition, it works almost perfectly

    camera follows the player when it jumps, but there is still an

    issue. In the game there is a platform which throws the player really high and the camera remains behind so the player is outside the layout.

    When the player falls down, the camera still follows a bit, but

    that isn't much a problem since it gets outside of screen pretty quick.

  • I saw your example but i didn't manage to freeze the camera, is still following the player down even when it falls

  • use the on collison event create an invisible block and do if camera collides with the invisible box then freeze

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,771
lucasgc1's avatar
lucasgc1
Unread hot topic
167 14,489
DMT2005's avatar
DMT2005
Unread hot topic
0 Favourites
[plugin] Youtube player
175 20,538
rexrainbow's avatar
rexrainbow