How do I manage a Mario style camera?

0 favourites
  • 3 posts
From the Asset Store
Slot Machine Games. suitable for workers who work from home because it has player names that must be played alternately
  • As you know, in New Super Mario Bross Wii for example, the camera doesn't follow exactly the player, it smoothly moves a little % of the screen in front of Mario so there is a bigger part of the screen showing things that Mario is moving to (less focused on what he's leaving behind). http://youtu.be/BH8CzKml6xg

    I tryed simulating this making the camera follow an invisible point that moves with "lerp" to Player position + 100 when Player is looking right, and to Player position -100 when he's looking left. The problem is that the "lerp" speed movement is relative to the Player movement speed, so if he's static, the camera point can move normally but if he's moving, it can't catch him. Or if i make the camera movement faster to catch the Player when hes moving, it's too fast when hes static.

    I would like to know if there is another way to do this, or a way to make the camera movement speed be the same independently of the Player movement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What lerp code did you use?

    Try this code :

    lerp(Self.X, Player.X+200, 1*dt)

    lerp(Self.Y, Player.Y-220, 1*dt)

  • With your code, the camera pivot is still moving with speed relative to the Player speed. If Player is static, camera smoothly moves to the desired position, but if Player is running, it does it slowly, cause while it moves, Player is also moving and progressively catching the camera pivot.

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