Some changes:
I made a small change in the color palettes, and I realized that if I export the sprite with a gap, there won’t be borders coming out of the sprites. The Extrude Borders are still there, just not visible anymore.
So yeah, this is a beginner’s tutorial made by a beginner after all (´。• ω •。`).
I also changed “player.atlas” into “sprites.atlas” because it seems we only need one atlas for this project.
In this tutorial, I planned on showing how we can make the camera follow the player. However, I see a flaw in the game’s design.
If the map is bigger than what the player can see, the ball will just go outside of the screen and bounce around.
This makes it difficult for the player to hit the ball because they cannot see where it is.
Even if the player manages to hit it a few times, the ball will just go super fast, sometimes kill enemies off-scene, and disappear without the player’s notice.
Although we can fix this issue by adding an arrow that points to where the ball is and a number to tell how far it is from the player, and maybe a scene shake to tell the player it is destroyed.
But that’s too complicated; a simple fix is just to make the player see the whole map.
So we need to create the map first instead of making the camera.
To do that, we need to have a Tile Map.
And the Tile Map uses Tile Source as its… uh, source.
Just right-click in the graphics folder and scroll down a bit, and you will see the Tile Source option.
Click the three dots in the image section and choose the tile set you use.
Then change Tile Width and Height to fit your tile size, mine is 8x8 pixels.
Then you do the same process to create Tile Map, you can put it anywhere, but I will put it in our main folder.
Pretty much the same as Tile Source, you click the three dots again and choose the Tile Source we just made.
Now we need to press Space and start laying out our tiles. This process is a little annoying since you need to pick each tile. But the good news is that you only need to do this once.
After you’ve laid out all the tiles, you can hold Shift and drag to choose multiple tiles and use them like brushes.
We’re going to create two more layers, called ground and border, to draw our arena.
The arena size is 160 x 144 pixels, which is our new resolution since 128 x 128 is pretty small.
But you can choose a higher resolution if you want.
If you want to change the layer order, you will need to change its Z properties.
Since it can only be between -1 and 1, you can use something like -0.1, 0, 0.1, 0.2, etc. The one with higher number will be in the front.
Now, back to our “main.collection”, we need to add a new game object. Then attach component files to it.
Also change the player Z order so our player can be on top of the map
Press Ctrl + B, and this is our result.