Coding at Home: July 15th, Cipher

Join us today when we approach one of my all-time favorite playgrounds, Cipher, at 1pm, Irish time!

Recap: Sensor Arcade

We said goodbye to Sensor Arcade yesterday with a bit of cheat codes.

We’ll explore the Sensor Arcade infrastructure in some future lessons. The potential of using your iPad and its myriad of sensors is so exciting, and this is a great playground to test them all out!

Now we can see practical applications for all this code we’ve been learning about.

And we’ll certainly come back to these concepts and tools in the very near future.

Today’s session

For today, though, we’re going to explore one of my absolute favorite playgrounds: Cipher!

It’s a little bit about cryptography and coded messages and a tiny bit about code. But the reason why it’s my favorite playground is because it’s structured around a story.

We’ll experience the story and learn a little about crypto.

I can’t wait to get started on it with you. See you at 1pm!

Coding at Home: July 14th, Sensor Arcade, Gem Hunter

Join us today as we finish out Sensor Arcade at 1pm, Irish time!

Bumper Bash

We covered a lot of ground yesterday. In Bumper Bash, we learned about the collision handler, which lets us know which two sprites just collided with each other. This is a huge addition to our coding toolbox!

Now if we’re writing a game we can let the SpriteKit framework do the work of figuring out when two objects have collided.

Now, my high score wasn’t amazing for this one. Have you managed to beat it?

We’ll look at a few ways to cheat the system today — we’re coders, after all, we can write our own rules!

We’ll also explore the applyForce method on our sprites and see what that does.

Gem Hunter

We also moved on to Gem Hunter yesterday. This playground page combines all the inputs we’ve learned about: touch, light, sound, and collisions. We’re going to write a game that will use a few different ways of manipulating our player to get as many gems as possible.

My high score for this game, our first pass, also wasn’t brilliant, so please tell me you were able to beat me!

We’ll spend a little time rigging up some easy win scenarios today. Then we’ll think about what might make the game even more playable.

What behavior will our player have in reaction to light updates? Will we add some labels to see values from our events in real-time?

Come code with us today at 1pm, Irish time!

Coding at Home: July 13th, Bumper Bash

Join us today at 1pm, Irish time, for some more coding!

NB. We’re back at our usual time of 1pm, Irish time!

Recap: Sound Poppers

I hope you got to spend a bit of extra time with Sound Poppers and controlling those poppers to take out the balloons (and not the bombs!).

Did anyone beat my time?

Today’s session

Today we’ll continue exploring Sensor Arcade.

Remember when we made our own game/app a while ago?

We did some rough math to figure out if two objects collided in our scene. This let us make it look like a real game to our players.

This playground lesson uses a technology called SpriteKit. It sounds like a soda-making toolbox, but it’s Apple’s framework for building 2-dimensional games.

Using this framework, we can detect collisions between sprites, which are elements in our scene.

We’ll handle these collisions and call methods on our sprites to make them respond in suitably realistic ways.

Can you think of other places you might want to use this type of collision detection and physics (like applyImpulse, which we’ve already used)?

Join us today at 1pm and we’ll build some cool stuff!

Coding at Home: July 10th, Sensor Arcade, Sound Poppers

Join us today at 2pm today, Irish time, for some more coding with sensors!

NOTE the DIFFERENT time of 2pm! We’re just trying to keep you on your toes and really pushing for you to subscribe to our YouTube channel.

Yesterday’s lessons

Yesterday I hope you took some time to play around with different algorithms to see which one might result in the most fun for your game.

Remember, algorithms were simply a set of instructions and parameters we organized to solve a particular problem. There are many different ways to write code, some of which yield similar results. But now we can explore how well an algorithm performs by how well we do in the game!

In our default algorithm, provided by the playground, I got a high score of 63.2 meters and 4 donuts… not a great score, but not too bad.

Can you do better? Did you do better?

Today’s session

Today we move from the camera to the microphone!

We’re going to revisit pitch and tones today and use their numerical values to try and move things around the screen.

Come join us at 2pm, Irish time and we’ll make a bit of noise and have some fun!

Coding at Home: July 9th, Sensor Arcade, Dashing Donuts

🍩 Who doesn’t love donuts?

Join us today at 3pm, Irish time for more fun with our iPad sensors!

This week we’re jumping around with times a little bit. If you want to make sure you don’t miss an episode, obviously you can follow us here. But you can also subscribe to our channel (like and subscribe?) and you’ll get notifications when we go live.

Yesterday

Yesterday we learned about using a touch handler and wrote some code to move our player around the screen to catch cupcakes.

Did you beat my high score?

I hope you tried a few different strategies for moving the player. I also hope you tried your algorithms out on your friends, siblings, parents.

There’s nothing better than having someone play and enjoy the game you wrote!

Today’s session

So for today we’re going to use our camera, and possibly our cameras, both of them, to get light updates.

We’ll explore switching which camera we use and what properties we have access to on the Color that’s passed to us.

Will you be able to beat my high score today?

Join us at 3pm, Irish time, to find out!

Coding at Home: July 8th, a new challenge!

Join us today at 4pm Irish time for a new challenge!

We’re testing out your ability to switch it up this week, and we’ll be going live at 4pm today.

Today’s session @ 4pm

We’re going to start a super fun series today with Sensor Arcade!

I love this playground because it shows us what amazing capabilities we have in our hands with the iPad.

We start off writing a touch event handler to handle when and where a user puts their finger on the screen.

This is an intermediate playground, so it definitely helps if you’ve gone through the Everyone Can Code Puzzles lessons, first.

But if you’ve been following along with the Lights, Camera, Code playground or the Sonic Workshop sessions you should be well able for this.

Game-based learning

A huge motivation for working on the code in these next few sessions will be all about the games. We’ll write code to practice and then play our own games, using the different sensors on the iPad — the touch screen, microphone, light sensor in the camera — as input devices and controllers.

And the great thing about coding our own games is we can see and feel how our code affects the way the game is played.

I can’t wait to get cracking on this one. See you at 4pm!

Coding at Home: Revisiting an Old Swan Friend

Join us today at THREE P.M., Irish time, when we revisit an old friend!

Note the later time, we’ll see you at 3, Irish time, instead of 1.

Swan’s Quest, Revisited

So now that we’ve finished Sonic Workshop, we’re going to revisit an old friend today.

With our newly-minted knowledge about closures, we’re going to see how they apply to Chapter 2 of Swan’s Quest.

You can either work with your existing copy of Swan’s Quest: Chapter 2, or download a new copy from our playground feed for WWDC.

We’ll talk about those pesky DispatchQueues and Timers and hopefully they’ll make a lot more sense.

Next!

Once we revisit old times, we’ll move right on to one of my favorite playgrounds.

Sensor Arcade takes advantage of all the sensors we have built into our iPad that we take for granted.

We’ll play with touch handlers, like we did in Sonic Workshop. We’ll also play with light handlers, which uses properties of the camera to tell us about brightness levels in the room around us.

I can’t wait to show you around this playground and see what we can do with Swift!

See you at 3pm, Irish time!

Coding at Home: July 6th, Sonic Workshop #5

Join us today at 1pm for some more Sonic Workshop!

We’re nearly done with Sonic Workshop and we have learned a ton.

We added a new function that will create a crystal that plays sound in a loop. We’ve explored closures in a few different forms. That’s been a lot of work.

Today’s session

Today we’ll add some visual flair to our auditory masterpiece, and then we’ll use some pre-built functions to build out an entire musical masterpiece!

We’re going to add a call to a function called addCaveGlitter, does it get better than that?

So we’re going to customize the heck out of this playground as a reward for all the hard work.

Revisiting the Swan

Remember the Swan’s Quest? Sure you do, it was only a little while ago.

We’re going to go back and have a quick look at those playgrounds, now that we have the Sonic Workshop under our belts.

In particular, we’re going to look at Swan’s Quest, Chapter 2, and see if what we just learned can help us better understand the challenge of the swan!

So if you want to follow along, and even start fresh, open up that Chapter 2 playground from our WWDC playground feed!

See you today at 1pm!

Coding at Home: July 3rd, Sonic Workshop #4

Join us today for some more functions at 1pm, Irish time!

Super coders!

You guys have written some amazing code at this stage! I hope you had some time to play around with that touch moved code. We were using a bit of math to figure out where the x position of our touch was, then we divided that by the width of our graphic. This was just to get us a number to plug into the Color initializer. And it was a little bit to show off how we get the updated position of the user’s finger on the graphic.

We fed that color into the setTintColor method on our graphic to visually show how often that new handler we set gets called.

Today’s session

Today we’re going to add a touch handler for when someone presses on the graphic.

We’ve done this before in previous pages. But this time we’ll use some of the other functions defined by the playground for playing music.

We’ll spend a lot of time customizing the behavior of our graphic when we tap on it. And we’ll also spend some time exploring all those messages to our onTouchMovedHandler. Maybe we can come up with some other use for them?

You can get as creative as you like with your function names, you just may sacrifice your sanity with some names.

We’ll see you at 1pm!

Coding at Home: July 2nd, Sonic Workshop #3

Come and join us in the Sonic Workshop today at 1pm, Irish time!

Yesterday

Yesterday we spent some time writing some code in a function in a shared file.

This comes in useful, like we said, when you want to do the same tasks over and over again.

Today’s session

In the previous page we had a function pre-written for us. Today we’re going to write our own. Like yesterday’s function, ours will also return a Graphic to place in the scene.

In our createCrystal function we return a Graphic by using a dash and a greater than sign, followed by the type we return. Like so:

public func createCrystal(image: Image, sound: SonicSound) -> Graphic  {
    //...
}

We’ll want to come up with a good, descriptive name for our new function so it makes sense when we use it in code, later.

This requires a bit of thought up front, but it will pay off when we can come back to our code and understand it without too much trouble.

We’ll also get introduced to a new wrinkle in the syntax for closures. Remember, closures are effectively unnamed functions. With functions, we can define parameters you can pass in, as well as a return type.

In the closure we use for the setOnTouchMovedHandler we’ll see in this session we’ll show you how to specify a parameter for a closure and what that does to what a closure looks like.

Like many things with code, there are many ways to write closures. We’ll try to use the most clear way possible to avoid confusion and make our code readable.

Let’s get coding! We’ll see you at 1pm!