How do I manage a Mario style camera?

Get help using Construct 2

Post » Wed Jun 11, 2014 12:25 pm

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.
Image
B
13
S
1
Posts: 74
Reputation: 886

Post » Wed Jun 11, 2014 2:19 pm

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)
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Wed Jun 11, 2014 2:45 pm

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.
Image
B
13
S
1
Posts: 74
Reputation: 886


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 2 guests