Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:interface:scene-editor:layers-and-cameras [2019/08/14 03:13]
4ian [Layers and cameras]
gdevelop5:interface:scene-editor:layers-and-cameras [2019/08/21 06:18] (current)
4ian
Line 1: Line 1:
 # Layers and cameras # Layers and cameras
  
-A layer is used to categorize multiple ​objects ​with similar physical properties (Z order, speed, etc)The default ​layer in GDevelop ​is called ​"Base Layer". To create a new layer, open the layers editor using this button:+A layer acts as a virtual container for objects ​displayed on the screenObjects are drawn on a layer, which is by default the "base layer", and the layer is then drawn on the screen. A scene can have multiple layers. If a layer is below another layer, the objects on the former layer will be displayed under all the objects of the latter - whatever their Z order. 
 + 
 +<note tip>You can think of layers as sheets of transparent paper that you put on the top of each others.</​note>​ 
 + 
 +To create a new layer or edit existing ones, open the layers editor using this button:
  
 {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-30_at_18.34.33.png?​nolink |}} {{ :​gdevelop5:​tutorials:​platform-game:​screen_shot_2017-09-30_at_18.34.33.png?​nolink |}}
  
-This will open the layers editor. ​In the layers editor, you can create a new layer using the plus sign. You can change the name of the layer and also toggle ​its visibility ​using the layers editor.+In the layers editor, you can create a new layer using the plus sign. You can change the names of the layers ​and also toggle ​their visibility ​and add effects.
  
 {{ :​gdevelop5:​interface:​scene-editor:​layers.png?​nolink |}} {{ :​gdevelop5:​interface:​scene-editor:​layers.png?​nolink |}}
  
-camera is used to display ​the scene in the game window. Each layer has its own camera and its position and angle can be controlled using events.+During the game, a virtual ​camera is attached ​to each layer. You can move the camera ​in the scene, moving the part of the layer that is rendered on the screen. You can also rotate the camera, effectively rotating objects of this layer on the screen.
  
-## Camera fixed center+## Centering the camera on an object
  
-The center of the camera ​is the center of the game window displayed. The X and Y coordinates of the camera center denote the coordinates of the center of the window.+There are two actions to position ​the camera ​on an object:
  
-## Center ​the camera on an object+* If you want an object to always stay in the view of the camera, you can center ​the camera on an object. This will make the camera follow the object wherever it goes on the scene.
  
-If you want an object to always stay in the view of the camera, you can center the camera on an object. This will make the camera ​follow ​the object wherever it goes (even if it goes out of bounds).+* To prevent ​the camera from going out of bounds, you can center the camera on an object ​within limits. This will limit the center of the camera ​within ​the quadrilateral inscribed using the two diagonally opposite points entered.
  
-To prevent the camera ​from going out of bounds, you can center the camera on an object within limits. This will limit the center of the camera within the quadrilateral inscribed using the two diagonally opposite points entered.+## Zooming with camera
  
-## Dimensions ​and angle of the camera+Camera can have a zoom applied to them. If you zoom into a scene, the contents appear larger ​and if you zoom out, they appear smaller than the default setting. The default zoom value is 1. To zoom in, set a value higher than 1 and to zoom out, set a value less than 1.
  
-Height ​of the camera is the length of the vertical side of the game visible and width is the length of the horizontal side.+## Changing visibility ​of a layer
  
-The camera angle is the angle by which the camera is rotated ​on the X-Y planeThe angle increases as we go in the clockwise direction from the X axis.+Visibility of a layer can be toggled, either in the Layers Editor or using events. Hiding a layer _does not_ delete ​the objects ​on the layerIf a layer is hidden, all the objects on the layer exist and can interact with the objects on other layers but they are not visible
  
-{{ :​wiki:​pres_coord2.png?nolink |}}+<note tip>By default, all layers are visibleThis can be changed in the Layers Editor.</​note>​
  
-## Camera zoom+## Changing the time scale of a layer
  
-Zooming is feature that allows ​the user to increase or decrease ​the magnification ​of the scene. If you zoom into scene, the contents appear larger and if you zoom outthey appear smaller ​than the default setting. The default zoom value is 1. To zoom in, set a value higher ​than 1 and to zoom out, set a value less than 1.+The "time scale" of layer allows ​you to change ​the speed of all the animations in layeras well as all object movements. To slow down the time on a layerset a time scale less than 1. To speed up the time on a layer, set a time scale greater ​than 1. The default time scale is for all layers.
  
-## Visibility of a layer+## Effects (shaders) on layers
  
-Visibility of a layer can be toggled. Hiding ​a layer DOES NOT delete the objects on the layerIf layer is hiddenall the objects on the layer exist and can interact ​with the objects on other layers but they are not visibleBy default, ever layer is visible.+You can add [[gdevelop5:​interface:​scene-editor:​layer-effects|effects]] that change how a layer is renderedThis allow to quickly create things like night effecta flashback/​retro atmosphere ​with sepia colors, etc... [[gdevelop5:​interface:​scene-editor:​layer-effects|Read more about effects here]].
  
-## Objects ​on layers+## Other manipulations ​on layers ​and cameras
  
-You can move the object ​to a different layer or check the layer of the object using actions and conditions that are common for all objects.+### Changing ​object ​layers during ​the game
  
-## Time scale+You can move the object to a different layer or check the layer of the object using actions and conditions that are available for all objects.
  
-Time scale of a layer allows you to change ​the speed of all the animations in a layer. To slow down the animations on a layer, set a time scale less than 1. To speed up the animations on a layer, set a time scale greater than 1. The default time scale is 1 for every layer.+### Dimensions and angle of the camera
  
-## Effects (shaders) ​on layers+* Height of the camera is the length of the vertical side of the game visible and width is the length of the horizontal side.  By default, these sizes are the same as the game window. If you change them, the rendering of the layer will be stretched or minimised. Most of the time, if you change the size of the game window, you'll want to change or restart the scene so that the camera update their size to the new window size. 
 + 
 +* The camera angle is the angle by which the camera is rotated ​on the X-Y plane. The angle increases as we go in the clockwise direction. 
 + 
 +{{ :​wiki:​pres_coord2.png?​nolink |}}
  
-In a future version of GDevelop, layers will be able to get effects applied on them. 
-Vote for this feature on the roadmap: https://​trello.com/​c/​3tjeWGuc/​94-add-support-for-choosing-the-effects-to-apply-on-layers-in-gdevelop-5