Xcode SpriteKit2D Tile Map Node

I want to create a 2D game platformer on Swift like Mario, and I want to use Tile Map Node. Can I give this Map physical settings, for example let the player be able to run on the textures I make for my game? Or should I use borders and make lines for all maps by commands? I was looking for some information on the web, but I found only Cocos2D and non-platformers.

Which Chapter I need to use? I have already used all of them. But I met more problems. I tried to add Background and Tile Map Node in the GameScene.sks. It doesn’t allow me to set zPosition to the png Background. And my background is always over my Tile Map. When I try to make Background like in Zombie Congo it’s ok. But I can’t define Tile map node and make them textures of my game.

Another question is how I can make different levels. For example I want to create 3 levels at the GameScene.sks. So how I understand, I need to create a lot of files .sks (1lvl.sks , 2lvl.sks etc.). How I need to tell me game that I need this or another one lvl?


I don’t understand what you mean by “physical settings”. You can allocate userinfo to a tile, as described in chapter 13. So you could set eg “run=true” for a tile, and then in code allow the player to run only on tiles where run==true.
Chapter 13 uses user data to find out if a tile is a wall. If it is, then when the player runs into the wall, it turns the tile to wall-cracked.

I don’t know why you can’t change the zPosition - is the background a sprite node? You should also be able to order the sprites in the scene hierarchy in the Scene Editor (but change the zPosition too to make sure the order is correct).

Chapter 14 describes how to change levels. You create levels called eg “level1.sks”, “level2.sks”, and then in code you can access them by "level\(level_number)"

1 Like

Thank you for your answer) I will check everything. And double-check)

Thank you!!!

This topic was automatically closed after 166 days. New replies are no longer allowed.