Sphero Edu + Swift Playgrounds

Introducing the Sphero Arcade

Swift Playgrounds — “Everyone Can Code”

Code. The universal language of technology that powers everything around us. As technology continues to evolve and play a huge part of our daily lives, programming skills are becoming more and more essential. Apple thinks everyone should have the opportunity to create something that can change the world, so they designed the Swift language, which lets anyone easily learn, write, and teach code.

At the Apple Worldwide Developers Conference in 2016, Apple announced Swift Playgrounds, a revolutionary app for the iPad that makes learning the Swift language interactive and fun for all learners. Swift Playgrounds is essentially a video game that teaches kids how to code using Apple’s Swift programming language. The interface allows you see what you’re creating with code as you write it — type your code on the left and immediately see the result on the right. Earlier in 2017, the Sphero Edu team partnered with Apple to build the first integrated Playground content designed to control real world robots. On June 5th at WWDC, Apple unveiled the new content that is now part of the Swift Playgrounds app. Thanks to our new partnership, you can now program real world robots including Sphero’s very own SPRK+.

Introducing the Sphero Arcade Playground — Code classic games with Sphero

In this arcade-style playground, you can recreate classic games with a Sphero SPRK+ robot while learning the basics of game design. You’ll build your very own robotic renditions of some famous games like Pong, Bop It, and Pac-Man. Each game uses Sphero in a different way such as rolling on the floor, detecting gestures, or using Sphero as a joystick.

Chapter One: Get Rolling

If you’ve never used a Sphero, Swift Playgrounds is a great opportunity to dive in. Learn the basics of the robotic ball to set you up for success in building fun games. Learn to roll, aim, control the LEDs, change heading, and detect collisions. Once you master the basics, you’re off to the arcade.

Chapter Two: Pong

The world’s first popular video game, Pong, launched in 1972 to replicate a basic ping-pong game table. We all remember the simple white bars bouncing the ball back and forth. Our rendition of Pong gets a little more physical as it leverages Sphero as a rolling ball on the ground.

In this robotic 21st century version, your Sphero replaces the ping-pong ball, and 2 players use their feet to bounce Sphero back and forth. Users write code to detect collisions, create random bounce angles, use variables to keep track of player possession and score, and the “locator” sensor to determine when one player misses the ball and a point is awarded. The locator data is reported back from encoders on the motors in Sphero, providing the user with accurate X and Y distance measurements to use. The first player to score 3 points wins.

Chapter Three: Bop It

One of the most popular handheld electronic toys launched in 1996, Bop-it calls out gestures for a user to match quickly or the game ends. If you remember Bop-it, the theme is probably already playing in your head.

To recreate Bop-it, users leverage the Inertial Measurement Unit (IMU) to define and detect gestures like a tap, toss, spin, and shake in Sphero. Each gesture is defined in a function and sounds are added to round out the experience. Then, users code each function into an array and the program calls gestures randomly to create the unpredictable gameplay. As user’s progress through the game, the functions are called faster and faster. The object is to score as many points as you can.

Pac-Man

One of the most recognizable games of all-time, Pac-Man was made in 1980 by Toru Iwatani, a Japanese designer that wanted to attract more women to arcade games (YES!) Users control Pac-Man as it eats dots within a maze, while avoiding ghosts to survive. There was no greater satisfaction than getting a power up and devouring the ghosts that tried to devour you…

To build Sphero Pac-Man, users leverage the gyroscope orientation angles to transform Sphero into a handheld controller to navigate through the maze, instead of the old-school arcade joystick. The roll angle (side-to-side tilt) controls the left and right movement, and pitch angle (forward-to-backward tilt) controls the up and down movement. Then users code scoring points, power ups that allow them to eat ghosts, and even program smart ghosts that taunt and follow Pac-Man based on your XY coordinates on the screen.

Head to the Arcade

The Get Rolling and Pong chapters are currently live in the “Accessories” section of the Swift Playgrounds app, and Bop-it and Pac-Man will be integrated later this year. But, because we love you, you can get early access to all three games now through a manual download here:

  1. Update your iPad to iOS 10+ and download the Swift Playgrounds app
  2. Using your Mac computer, download this zip file, and double click to unzip it
  3. Right click on the folder, click “share” and Airdrop it to your iPad, or several iPads
  4. Using your iPad, accept the Airdrop, and choose “Open with Playgrounds”
  5. Open the Sphero Arcade and connect to your SPRK+ robot when you get to the “Roll” page

You can’t program the robot without the robot, so pick up a SPRK+ and look for the official “Works with Swift Playgrounds” badge on the new box. Don’t worry, all SPRK+ robots (badge or no badge on the box) will work with Swift Playgrounds. Get coding at the new Sphero Arcade. No quarters required.