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

0 favourites
  • 5 posts
From the Asset Store
50 front view of buildings JPG - residences shops and offices - 2048x2048
  • 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:

    [attachment=0:2kg9xzar][/attachment:2kg9xzar]

    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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this :

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

    Change the 6 to get what you want.

  • 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.

  • I have 6 camera positions in my game, you should use a global variable.

    And also you can use MoveTo behavior ( Third party plugin ).

  • 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!

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