# Camera movement

Get help using Construct 2

### » Tue Jun 24, 2014 5:07 pm

Hello all

@Aphrodite can you or anyone please show me how to make the camera move to different positions smoothly then stick every tic to the player until i move it to another place.

My game is platform and the player will fall from height places and jump...etc.

I'm using this global variable :
Position = 0 --------- camera set position to : lerp(Self.X, Player.X+200, 1*dt)
Position = 1 --------- camera set position to : lerp(Self.X, Player.X-100, 2*dt)
......etc

And because of (x*dt) the camera will not stick 100% in the place.
And if i deleted the (x*dt) or make it more less the movement between positions will not be smooth.

Thank's for any help
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

### » Tue Jun 24, 2014 5:26 pm

I am not sure, but are you trying an effect like sonic 1 on master system (the camera has a max speed that sometimes is lower than the actual speed of the player), I can try to do something like it
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
23
G
18
Posts: 2,123
Reputation: 17,200

### » Tue Jun 24, 2014 5:30 pm

Yes I believe A0Nasser means something like this: https://www.youtube.com/watch?v=LzxWuIVUW2c

Found that video as an example.
B
28
S
5
G
5
Posts: 98
Reputation: 4,809

### » Tue Jun 24, 2014 6:04 pm

Thank's for the quick replies.

The camera will stick to the player every tic without lerp, And In some situations i want the camera to move smoothly to left or up or even more to the right then stick there.

If i use lerp the camera will follow the player, Sometimes the player will fall and the camera need x of time to reach the player.

And if i use the code without lerp : set camera to player.x+200 and player.y-100..for example, It will work perfectly but the problem when you move the camera to new positions, it move in 1 tic not smoothly.

Forgive my english
And thank's for interest
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

### » Thu Jun 26, 2014 10:34 pm

Any one know how to make this?
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

### » Fri Jun 27, 2014 1:45 am

As I said in other posts, "the best option for whatever cam thing is the magicam plugin"
It's possible to do whatever you want about cam movements.
B
20
S
4
Posts: 387
Reputation: 2,274

### » Fri Jun 27, 2014 2:43 am

Thank's for the information, i will give it a try.
And i also think we can make this with some lerp cods.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

### » Fri Jun 27, 2014 2:28 pm

do you mean something like this
You do not have the required permissions to view the files attached to this post.
B
267
S
51
G
16
Posts: 2,039
Reputation: 43,944

### » Fri Jun 27, 2014 5:52 pm

Thank's for the example
But what i need is this :

situation 1 : Set camera to : player.x - player.y -150
situation 2 : Set camera to : player.x+300 - player.y -150
situation 3 : Set camera to : player.x-200 - player.y -50

Without lerp, To make the camera stick every tick to the position.
I want to use the lerp only when converting between cameras.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,165

### Who is online

Users browsing this forum: No registered users and 6 guests