🗺️Phaser, Map Design & Scenes
Last updated
Last updated
Creating captivating and immersive maps is a crucial part of designing engaging Portals in Sunflower Land. To begin designing your map, follow the steps outlined below:
Obtain the Sunnyside Pack: Sunflower Land utilizes assets from the Sunnyside pack to design land, water, and buildings. Purchase and download this pack, and locate the Tileset
> spr_tileset_sunnysideworld_16px.png
file. This file will serve as the foundation for your map design.
Download Tiled: Tiled is a free map editor widely used for designing game maps. Visit the official Tiled website at https://www.mapeditor.org/ to download the latest version of Tiled. While the details of working with Tiled are beyond the scope of this guide, we recommend exploring beginner tutorials and videos to familiarize yourself with its features and functionality.
You will want to set up a new map, using the Sunnyside tileset above as the tileset https://www.youtube.com/watch?v=IHmF_bRpOAE
It is time to get creative and design your map. You can include unique terrain, resources, paths, decorations and much more!
Naming Conventions for Map Layers: When designing your map, it's helpful to adhere to a consistent naming convention for the layers you create. Here are some recommended naming conventions for your map layers:
"Water": This layer is dedicated to placing water tiles on your map.
"Ground": Use this layer for the primary ground tiles, forming the base layer of your map.
"Path": This layer can be used to create paths or trails for players to navigate.
"Decorations Base": This layer serves as the foundation for decorative elements in your map.
"Building Base": Use this layer as the base for buildings and structures in your map.
You do not need to follow these conventions, but they will help you collaborate with others.
We will also include support for layers rendering in-front of players. To render a layer in front of a player you can name it "Decorations Layer 2", "Decorations Layer 3", "Decorations Layer 4", "Building Layer 2", "Building Layer 3" or "Building Layer 4".
By using the recommended naming conventions for decoration and building layers, you can ensure that objects appear correctly in relation to the player character. For example, if you want a player to walk behind a tree, place the tree on a higher-numbered decoration or building layer.
Set up a Collision Object Layer: Create a new object layer in Tiled called "Collision."
In this layer, you can draw rectangles that act as collision objects.
These shapes will prevent players from walking through them, keeping players within specific boundaries and preventing them from passing through objects or walls.
Exporting the Map: Once you have completed your map design in Tiled, go to "File" > "Export As" and save the file as map.json
. It is crucial to use the JSON format when saving your map. This file will contain all the necessary information about your map's layout, objects, and collision boundaries.
You can then place this file inside of your Github Repo.
This file should then be used inside of your Phaser Scene.
Do you want to use custom assets on your map such as biomes or themes? You can do so inside of your Scene configuration by specifying a tileset property.
If you are using proprietary assets, ensure you are hosting them on a protected server.
Inside of Preloader.ts
you will want to update the tileset
that points to wherever your tileset is located.