diff --git a/docs/gdevelop5/tutorials/follow-player-with-camera/index.md b/docs/gdevelop5/tutorials/follow-player-with-camera/index.md index d10152bbda..987b43fe40 100644 --- a/docs/gdevelop5/tutorials/follow-player-with-camera/index.md +++ b/docs/gdevelop5/tutorials/follow-player-with-camera/index.md @@ -16,31 +16,36 @@ This article includes instructions for implementing this functionality either wi ## Follow an object smoothly -Adding the **Smooth Camera** [behavior](https://wiki.gdevelop.io/gdevelop5/behaviors#adding_a_behavior_to_an_object) to the character make the camera follow it automatically. The **Move camera closer** action can still be used to avoid a 1-frame delay. +Adding the **Smooth Camera** [behavior](https://wiki.gdevelop.io/gdevelop5/behaviors#adding_a_behavior_to_an_object) to the character. The Smooth Camera's parameters such as "catch up" and "speed" can be modified to personalize the smoothness of the camera movement. !!! tip Learn [how to install new extensions](/gdevelop5/extensions/search) by following a step-by-step guide. -## Move several layers together +### Keep an object at the exact center of the screen -Games can contain a lot of objects and using several layers is a good solution to organize a project. All layers (except for UI layers) should likely be moved the same way when a character is followed. +To configure the camera to center on an object, go to the [event sheet](https://wiki.gdevelop.io/gdevelop5/events) and **add an Action** *(no need to set a Condition)* called **"Center the camera on an object"**. -The [copy camera settings](https://wiki.gdevelop.io/gdevelop5/extensions/copy-camera-settings/) extension allows to copy a camera position to another one. The camera that follows the player can be copied to any other camera layers. +Select the character that will be followed by the camera and check that the layer of the character is selected. +The **Action** should look like this: -## Keep an object at the exact center of the screen +![](pasted/20230316-155732.png) -To configure the camera to follow an object, go to the [event sheet](https://wiki.gdevelop.io/gdevelop5/events) and **add an Action** *(no need to set a Condition)* called **"Center the camera on an object"**. +!!! tip -After that, select the character that will be followed by the camera and check that the layer of the character is selected. + To get closer to the character with the camera (zoom-in), use the action **Move camera closer**. -The **Action** should look like this: -![](pasted/20230316-155732.png) +### Follow an object with several cameras (layers) + +Games can contain a lot of objects. Using several layers is a way to keep a project organized, but also to manage camera movements. All layers (except for [UI layers](https://gdevelop-wiki-git-fork-lunimoon-patch-2-gdevelop.vercel.app/gdevelop5/tutorials/keep-ui-on-screen/)) should likely be moved the same way when a character is followed. *Read more on [how cameras and layers](https://wiki.gdevelop.io/gdevelop5/interface/scene-editor/layers-and-cameras/#dimensions-and-angle-of-the-camera) work.* + +To follow an object with different cameras (layers), install the [Copy camera settings](https://wiki.gdevelop.io/gdevelop5/extensions/copy-camera-settings/) extension. It allows to copy the camera's position to any other camera, including the camera that follows the player. + -## Make a custom camera following +## Make a custom camera following (advanced) -To add camera inertia and a smoother transition watch [this video tutorial](https://youtu.be/yUNisggNh7s?t=84) to learn how to use the Camera Center positions on the X and Y axis, along with `lerp` expressions and formulas. \ No newline at end of file +To add camera inertia and a smoother transition watch [this video tutorial](https://youtu.be/yUNisggNh7s?t=84) to learn how to use the Camera Center positions on the X and Y axis, along with `lerp` expressions and formulas.