How do I Move The Camera in Front of The Player?

Get help using Construct 2

Post » Mon Dec 15, 2014 11:14 am

Hi everyone.

I apologize in advance if this issue has been solved elsewhere on the forums. I have tried searching to see if anyone else has asked this question before, but I couldn't find any threads on it.

I'm currently having trouble with the camera. I'm wanting the camera to move in front of the player, so when the player is running, they can see what's coming up ahead better.

I have the smooth camera working, where the camera positions itself behind the player no problem. Here is a screenshot of the event for the camera:

Construct2_Camera_Screenshot.jpg


The first thing I tried, was to place a minus in front of the 10 where it says "PlayerController.X, 0.10". However this just breaks the entire camera and it goes crazy. So basically all I want to do is make the camera position itself in front of the player instead of behind.

Any help on this would be greatly appreciated. Thanks a lot for your time!
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 14
Reputation: 203

Post » Tue Dec 16, 2014 12:50 am

Try this :
every tic ------------ camera set x : lerp(self.X,player.X+200,6*dt)

Change the 6 to get what you want.
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Tue Dec 16, 2014 9:53 am

A0Nasser wrote:Try this :
every tic ------------ camera set x : lerp(self.X,player.X+200,6*dt)

Change the 6 to get what you want.


Thanks for the response.

It's not quite the camera behaviour I was looking for. It works in the sense that the camera is always ahead of the player, but I want the camera to reposition itself to the player if they're not moving.

Basically if the player is standing still, then they're in the centre of the screen. When the player starts running, then I want the camera to move ahead of the player. So if the player runs to the right, then the camera will move in front of the player to the right of the screen and if they run left, then the camera moves ahead of the player to the left side.

The event that I currently have (the one in the screenshot) functions how I want the camera to work, in terms of how the camera slowly moves when the player runs, but I just want it to work in the opposite way that it does. So instead of the camera always moving behind the player in the direction they're running, I want it to do the opposite.
B
3
Posts: 14
Reputation: 203

Post » Tue Dec 16, 2014 11:41 am

I have 6 camera positions in my game, you should use a global variable.
And also you can use MoveTo behavior ( Third party plugin ).
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Tue Dec 16, 2014 2:47 pm

Ah ok, that makes sense. I never thought about having multiple camera positions. Hopefully with some experimentation, I should be able to get the desired results.

Thanks a lot for your help!
B
3
Posts: 14
Reputation: 203


Return to How do I....?

Who is online

Users browsing this forum: Cubus32, tarek2 and 8 guests