Look ahead camera

0 favourites
  • 5 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Hi guys.

    I've made a simple look ahead camera that has a quick "forward focus" effect when the player is running, but has a slower reset time when the player stops. It seems to work well except when doing a static jump. In that case I want it to behave like when the player has stopped moving, but I can't for the life of me figure out how! Any help would be appreciated.

    The way it works is by pinning an invisible box sprite to the player sprite and constantly adjusting the box's width. The box sprite has its origin and one additional image point at opposite ends. That way, it only grows at the direction the player is facing and the window scrolls to the aforementioned image point.

    I hope my English makes sense and forgive any mistakes cause it's not my mother tongue!


  • Why not just check the x position of the camera every tick. If there is no difference then dont move the camera.

  • spongehammer Thanks a lot for taking the time to check this!

    I tried your suggestion by making an instance variable and storing the X value every tick. Then I do a comparison on the variable and it works partially (camera stops going ahead when static-jumping), but when the camera is in reset mode the static-jump cancels out that movement.

    My post count doesn't allow me to post screenshots so that I can explain better what I mean.

    Any suggestion is welcome

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • immortalx can you not connect the camera to the state of the player, running = camera follow , or maybe if you can get the x-speed of the character, when over a treshold the camera comes active,.. just some idea's here..

  • Thanks vtrix, it seems you and spongehammer were right!. Tracking for a change in X position alone did the trick. I was also checking for Platform->Is Moving condition, but that apparently means a change in both X and Y.

    Consider this solved and I hope someone will find this camera useful.

    New capx:


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