SDL3 Oyun Programlama ve Godot Oyun Motoru sayfalarımız yayında...

Ana sayfa > Oyun programlama > Godot game engine > Creating map

Creating map

In 2D games, the process of creating the map, which is the area where the game will be played, is done with tiles. Tiles are specific and small-sized images located within a large image. These images are used one or more times to create a map.

In the Godot development environment, the TileMapLayer Node is used to create a map using tiles.

Perform the following steps in order to create the game map:

1. To create a TileMapLayer Node, while the "Game" scene is selected, create a new Node by clicking the + sign under the Scene tab or the Ctrl-A key combination.

2. In the Create New Node window that appears, search for and select TileMapLayer in the Search line and click on the Create button.

3. While the "TileMapLayer" Node is selected, create a new Tileset by selecting the "New TileSet" option from the right selection box in the "Tile Set" row in the "Inspector" tab.

As a result of this process, a grid is placed on the scene.

4. Click on the "TileSet" statement at the bottom line of the Godot development environment.

5. Drag the world_tileset.png file under the "sprites" directory and drop it into the window in the "Tiles" tab.

6. Click the "Yes" button in the "Automatic queue creation" checkbox.

7. While the "TileMap" tabs in the bottom bar and the "Tiles" tabs in the top bar and the "Paint" button are selected, we can select any of the tails under the "Base Tiles" title by clicking on them and copy them by clicking on any square in the grid in the "game" tab with the left mouse button.

When we move the mouse on the stage, the grids become visible in the background.

8. Complete the drawings as seen in the picture below by applying the rules below.

  • If a tile is selected, when we drag the mouse on the stage with the left mouse button pressed, the same tile is loaded to all the frames passed over it.
  • When we right-click the frame we copied tail in the same grid or press Ctrl-Z, tail is deleted.
  • We can select more than one tile while holding down the Shift key and add them all to the stage with a single click.
  • By clicking the "Select" button in the panel below, we can select more than one frame on the Grid with the left mouse button and:
    • You can move it to a different place with the left mouse button,
    • You can copy it with the Ctrl-C key and add it to a different place on the stage with a single click.

9. When we're done drawing, save the scene and run the game. The player will fall down again. Close the game.