-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Base Layer explanation and adding user's intention #44
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -11,36 +11,43 @@ This article includes instructions for implementing this functionality either wi | |||||
|
||||||
!!! tip | ||||||
|
||||||
Learn more about [layers and cameras](https://wiki.gdevelop.io/gdevelop5/interface/scene-editor/layers-and-cameras/#cameras) and [how to keep UI objects on screen](/gdevelop5/tutorials/keep-ui-on-screen). | ||||||
GDevelop [assigns a single camera per layer](https://wiki.gdevelop.io/gdevelop5/interface/scene-editor/layers-and-cameras/#cameras). It is recomended to start by placing the main objects o the "Base Layer", and add other layers after. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
|
||||||
## Follow an object smoothly | ||||||
## Follow an object (character) 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. | ||||||
Add the **Smooth Camera** [behavior](https://wiki.gdevelop.io/gdevelop5/behaviors#adding_a_behavior_to_an_object) to the object that will be followed. | ||||||
The extension's parameters such as "catch up" and "speed" can be modified to personalize the smoothness of the camera. | ||||||
|
||||||
!!! tip | ||||||
|
||||||
Learn [how to install new extensions](/gdevelop5/extensions/search) by following a step-by-step guide. | ||||||
Learn [how to install](https://gdevelop-wiki-git-fork-lunimoon-patch-2-gdevelop.vercel.app/gdevelop5/extensions/search/) new extensions by following a step-by-step guide. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't add this kind of links in other words the previous version before the edit was correct.
Suggested change
|
||||||
|
||||||
### Follow an object with several cameras | ||||||
|
||||||
## Move several layers together | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an important part of the actual solution. It should not be too far in the doc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I trust you're right. I'm starting to be afraid that the article might be failing to resolve the issue (and the reason why we're doing documentation efforts): users struggle to self-diagnose the issue they're experiencing, and feel they have to "guess" from the (so perceived) isolated answers on the web.
Ending the article here could theorically cover the basics but as we've observed, there can be different intentions on this single title (I wonder if they should be H2 on the article), such as...
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is the role of this other page:
Using only one layer is not a simple solution, it's a just bad solution. Some platforms and decorations need to be behind the player. If they are on the same layer, new platforms will be added on top of the player. The creator will need to change the z-order of the character each time there is something new and setting the player a big z-order won't cut it because new instances will always be the maxiumum z-order + 1. Even for a very basic game, not using layers is a ticket to an UX hell.
It can be a new section. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I know the existence of the Layers and Cameras wiki (it's included in one of the tooltips). Tristan did suggested adding an extension called "copy camera position" (or something like that) but: 1. I got annoyed that I had to add yet another extension (I wonder if this is what a user meant by "relying too much on extensions"), 2. I didn't understand why I had to copy other camera's possitions. So, maybe the solution is partially there: instead of giving them a "fake solution" (keeping most of the graphics on the base layer), pointing them to the "proper solution" -> creating a link to another article on why and how to copy camera position to follow a single camera. 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This advice was to give you the shortest way to have something that works. It's fine to give this advice to someone that is lost as a temporary solution. It's not fine in an official documentation.
Layers can be copied just like this, but Tristan's extension make it easier to do. I think it's better in an extension because it avoids to have a lot of actions that almost do the same thing directly in the engine (which could be overwhelming for beginners).
The existing page has a section for this "Move several layers together". |
||||||
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) 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.* | ||||||
|
||||||
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 follow a single object with different layers (each layer has a single camera), install the **[Copy camera settings](https://wiki.gdevelop.io/gdevelop5/extensions/copy-camera-settings/)** extension. It allows to copy the main camera's position to a secondary camera. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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. | ||||||
### Keep a character at the exact center of the camera | ||||||
D8H marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
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"**. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
## Keep an object at the exact center of the screen | ||||||
|
||||||
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"**. | ||||||
|
||||||
After that, select the character that will be followed by the camera and check that the layer of the character is selected. | ||||||
Select the object that will be followed by the camera and make sure that the layer where the object is placed is selected. | ||||||
|
||||||
The **Action** should look like this: | ||||||
|
||||||
![](pasted/20230316-155732.png) | ||||||
|
||||||
!!! tip | ||||||
|
||||||
To get closer to the character with the camera (zoom-in), use the action **Move camera closer**. | ||||||
|
||||||
|
||||||
## 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. | ||||||
|
||||||
## Make a custom camera following | ||||||
|
||||||
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. | ||||||
## You might be interested in: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This title is meaningless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
- How to [keep UI objects on screen](/gdevelop5/tutorials/keep-ui-on-screen). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
It's not, users can use the "Base Layer" for UI if they want to.
It doesn't give an indication of what the linked page could be and the purpose of linking the page is not to repeat ourselves. What if layer can have several camera one day? We probably don't want to change 36 pages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recomended > recommended