I am reading the RPG kit documentation and trying to make a transition to another level.
I read that PortalTo property can get the player to another level, but at the same time it says that you cannot change the scene. How to understand that we can change level but not scene? The manual also recommends to have separate scene for each level (Grlassland, Dungeon etc). Sharing some light how to manage levels accounting for experience or items collected and using portals would be helpful. Thanks!
So the PortalTo dictionary has both a Level option and Scene option. You just don’t need to set both because one will get ignored. You have to choose whether you are going to advance to another level scene or jump out of the game entirely and open up a non-level scene (for example, go back to the home menu). So think of it like this…
Level – another level scene Scene – some non-level scene
Things to keep in mind, anytime you’re changing the scene in SpriteKit you’re going to open another scene one way or another. Could even be opening the same scene again (which is common in any SpriteKit game because thats what happens when a player dies, you usually just restart the same level again).
The Demo version is really the “Holy Bible” of how this thing all works. The docs elaborate on things, but I think it helps most to just unfold properties in the demo and see firsthand how its put together. And its all searchable too. So in the .plist you could search for PortalTo and see how the portal thats in there goes to the Dungeon level.
And you’ll notice there’s both a Dungeon.sks file and dictionary in the plist called Dungeon. Thats a key connection right there. The plist contains the data, the sks file contains the visual components. So you’ll always have both (and the .swift files, which you probably don’t ever need to edit, is what combines the two to make the game playable).
And I’m sure you’ve already noticed if you want to make a scene file just for a particular, you would create an sks file named DungeonPad.sks, DungeonTV.sks, DungeonPhone.sks or DungeonPhoneX.sks . The kit knows to look for that base name with those suffixes.