Using SpriteKit Scenes in SwiftUI

Question:

Hi looking to meet others using SpriteKit Scenes in SwiftUI to make games with students.

Currently transitioning away from python to swift for students graduating from block coding and would love to share ideas with others making games in Playgrounds.

We make games in our classes like old Moon Patrol, Frogger, Trantor and such.

What are your students making?

Tagged in: Game-Based Learning, Swift Playgrounds, SwiftUI

Posted on September 21, 2022 in response to bigTanuki

There's a great app project in the Explorations book called BouncyBall. Students learn about drawing shapes, using animations, and scene physics. Not exactly SpriteKit, but a step in that direction. There's lots of other lab simulations as well in the playgrounds files, such as BoogieBot and Simulations. I like for students to look at the supporting files to see how the API was built and what changes they can make.

For more SwiftUI based content the Animating Shapes playground in Swift Playgrounds has a great walkthrough as well.

Posted on October 04, 2022 in response to NelsonT

Hi Nelson, my students are already using SpriteKit Scene with a python language wrapper via the Pythonista app in the iOS AppStore. I tried to open the link to Explorations in your text but the link may be broken as it opens a blank web page.

Thank you for the suggestions. I am aware of the introductory projects in the playgrounds app. I will probably run through these to familiarize my students with the differences between python and swift. I agree that they are very clear and explanatory.

That said, our projects are very game-like (“think Galaga or frogger”) and so running a SpriteKit Scene as a view in in SwiftUI is necessary for having an update method and access to SKActions. But perhaps trying to build in SwiftUI instead of UIKit will require a alternative approach to movement, touches and actions.

Thanks for the suggestions and response.


Posted on November 30, 2022 in response to bigTanuki

Hi bigTanuki!

It is a pleasure to read the amazing things you and your students are creating! I do a lot of coding with students in the SwiftUI space, but might be a bit rusty on SpriteKit (it's been a couple years since I've picked up SpriteKit). I would love to share some resources and knowledge, and work on a joint project with you, if you're keen?

Question: Using SpriteKit Scenes in SwiftUI

Maximum file size: 400MB

Insert a video

Insert an image

Insert an image

125: 125
220: 220

This action can’t be undone.

Are you sure you want to continue? Your changes will not be saved.