Skip to content

Environment

Alec Barker edited this page Feb 18, 2021 · 8 revisions

How to Create a Level

  1. Click the + button at the top of the main window
  2. Select 2D Scene in the left menu
  3. Save the scene to the desired folder

How to Create a Collidable Environment

  1. Click on the World node
  2. Add a new StaticBody2D
  3. Add a new CollisionPolygon2D
  4. If desired, turn on grid snapping
  5. Make sure the CollisionPolygon2D node is selected
  6. Click the Create points button in the top menu (Looks like a green square with a + icon)
  7. Create a shape by clicking points and connect the last point to the first one
  8. If you wish to see the collision shapes when playing the game, go to Debug in the window menu and select Visible Collision Shapes

How to Manage When Objects are Behind Other Objects (YSort)

A YSort node will compare the Y position of every child node and display the object that is further down in front.

  1. Select the world node
  2. Select Add Child Node
  3. Select YSort

Make sure objects' base areas are set up for correct YSorting. For example, the player will want to be YSorted using their feet rather than the middle of their body. To do this, you must:

  1. Click the object's Open in Editor button (Looks like movie clapperboard)
  2. Select the Sprite, CollisionShape2D, and other relevant child nodes
  3. Move the selected nodes up or down so the base area is on the scene's origin. With the player example, the player's feet would be over the scene's origin.