For those of you that enrolled in my first Role Playing Games with Sprite Kit course, here’s how part 2 is progressing. I’m almost to the point of recording the lessons. It took me way longer than I wanted to get to this point because I kept adding, and adding, and adding more and more to this second set of lessons. And fortunately the original setup (what you have at the end of the first part) plays nice with the future parts to come.
So what will change from part 1? Levels are totally non-linear now. In this first set of lessons, we stepped through levels in order, like level 1, then level 2, etc. And we did so by collecting coins. Coin collection was a quick way to advance levels but as I pointed out to everyone who took the course, this was never the end-goal for navigating the world. Role playing games are more about the mystery of discovering items or clues that help you find your way, then they are about simply gathering up money in a mad dash.
Levels can be huge landscape areas or tiny rooms. You’ll typically have a portal to enter (a door, cave, whatever) and a similar portal to exit. So obviously we’ve got a Portals class in the next set of lessons as well. The game will now have Save Points, so you can choose which levels are deemed worth starting back from. So if the player makes it out of a giant maze, thats probably a good save point. You can use portals to jump around within the same level or to another level. Portals can be locked and unlocked, and you can optionally create “trick” portals, where if you don’t have a certain item, you would end up someplace you don’t want to be when colliding with the portal. Imagine a hole in the floor type situation. If you the player hasn’t collected the plank item, they would fall through the hole.
Inventory has been added. In fact, I think a good start to this next set of lessons is to program the inventory class. We’ll make the inventory all saved in the NSUserDefaults, so if the user decides to quit the game and play again a month later, their inventory is still there. And what exactly is collectible? Well anything really. RPG’s usually have keys that unlock doors, so that option has been added. You can have portals to other levels that open up once a certain item or number of items has been collected. Inventory can be attained by simply colliding with the item (like the player collided with Coins in the first lessons), and I’ve also added the option to have items collected after attacking an Object (class) or by colliding with the Object.
Objects. We’ve got an Object class in this next series of lessons which can be used for A LOT. You can collide with objects (push them around using physics properties), objects can damage you (for example a torch might harm you), objects can be animated, they can move back and forth / or up and down, and you can even read pop-up images if you collide with them. So an object could be a person in the game that delivers you a message when you bump into them. Or they could be a little gremlin that roams around to cause you damage. Objects can also And again, you can attack objects and have them break with an optional particle sequence and optionally leave behind a collectible object.
Map Class / Start Screen. We’ll add a map so the user can choose where to begin the game (from levels they have already gone through). So the game can begin with either the map or just jump them right into the last-played level.
Invisible Boundaries. While objects can be used as collide-able boundaries, thats not always going to be the option to defined where the characters can go. So we’ve not got a Boundary and Edge class to really fine tune the playable area. The Boundary class will create either circular or square areas that the character can’t enter, and the Edge class can define lines ( better for diagonal areas)
Tiled Backgrounds. Yup, we’ve got some tiled backgrounds with Sprite Kit. So if you wanted to create a path through a level, you could use a single square image, maybe 100 wide by 100 tall, then tile it so the path repeats over an area that is 200 wide by 800 tall. Or you could just tile the entire area of the level you want playable, for example, just a bunch of grass tiles. You can also adjust the size of the tiles within the playlist.
Sounds: We’re finally adding sounds!
What Else? There’s more, but I think this covers most of it. By the end of this next series, you should have a greater understanding of Sprite Kit, and a very playable game.