Chapter    24

Platform Game Physics

In the previous chapter, you learned how to create an animated character. You also learned how to build a tile-based game world by reading level data from a text file. One of the most important aspects is still missing: defining how the character interacts with the game world. You can make a character move from left to right, but if you simply place the character in the level, it can only walk on the bottom of the screen. This isn’t enough. You want the character to be able to jump on top of tiles and fall down if it moves off a tile, and you don’t want the character to fall off the edge of the screen. For these things, you need a physics system.

You could use the existing physics engine provided with the SpriteKit ...

Get Swift Game Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.