Sprite Invaders with Swift Playgrounds
In this course your students will learn how to create a simple Space Invaders game on your iPad using the Swift Playgrounds application and Swift 3. The project uses very simple logic to detect collisions, but students will also be introduced to Sprite animations and physics which can be extended their knowledge into other projects.
This course teachers students how to use and implement objects within the SpriteKit Framework. SpriteKit is a graphics rendering and animation infrastructure that you can use to animate arbitrary textured images, otherwise known as sprites. SpriteKit provides a traditional rendering loop that alternates between determining the contents of and rendering frames. You determine the contents of the frame and how those contents change. SpriteKit does the work to render that frame efficiently using graphics hardware.
SpriteKit implements content as a hierarchical tree structure of nodes. A node tree consists of a scene node as the root node and other nodes that provide content. Each frame of a scene is processed and rendered to a view. The scene executes actions and simulates physics, both of which change the contents of the tree. Then the scene is rendered efficiently using SpriteKit.
Level of Difficulty
This course is designed for learners who have had previous exposure to coding. Not necessarily Swift, but they must have an understanding of the basic control structures and functions. Through this course they will be introduced to more advanced topics such as Sprite Physics and Collision Detection.
I have delivered this course to students aged between 13-16 years old with good results.
The course is designed to be very visual and get students creating rather than reading and learning about the theoretical elements of coding. Additional reading, video and support material are provided to supplement the challenges.
The challenges themselves within the courses are designed to be slightly ambiguous to encourage students to ask intelligent questions, research solutions and scaffold their learning. It's not designed to be a tutorial.
Within the SpriteKit Introduction topic students learn about the individual objects within the SpriteKit framework and how to manipulate the Sprite object's properties and animate them. They will learn about the following specifically:
- Add a Sprite
- User Touch Location
- Animating Sprites with SKActions
- Drag & Drop Sprites
- Manipulating Scene Physics
- simple Collision Detection
Within the Sprite Invaders topic students apply the knowledge they have gained to build a little Sprite Invaders game.
Accessing the Materials
All of the materials for this course are available through iTunesU and are publicly available under Creative Commons should you wish to re-use them for your own lessons. I appreciate and encourage any feedback and constructive criticism so I can improve my courses.
- Sprite Invaders with Swift Playgrounds (SpriteKit) - https://itunesu.itunes.apple.com/enroll/DDK-YYX-NNB