Let’s Make Pong! (Pt. 1 : Swift 3 in Xcode : SpriteKit)

Today we make one of the first games ever made: Pong. It’s a great project especially for beginners or those just getting started with SpriteKit. Enjoy!

Project Files – https://github.com/Archetapp/Pong

Intro/Outro Song – https://soundcloud.com/adhesivewombat/adhesivewombat-8-bit-adventure

Have a tutorial idea? Write it down here! 😀 – http://bit.ly/ArchetappIdeas

~Social Stuff~
Nooma – https://www.nooma.tv/n/JaredDavidson
Patreon – http://www.patreon.com/archetapp
Website – http://www.archetapp.com
Twitter – http://www.twitter.com/archetapp
Snapchat – archetapp

Donate (Thank you!) – https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XCX6T4UPC96ES

Donate (Thank you!) – https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XCX6T4UPC96ES


ArenEDB says:

Where is the code that changes the speed of the ball?

Saurav Kunwar says:

Finn the Human programs…

Vic Winkler says:

excellent tutorial… There are several changes needed if you are using Swift 4 and Xcode 9, the least intuitive one was the fact I needed to define the border as: border.categoryBitMask = 1

Right now at the end of part 1, my ball tends to get stuck in an endless loop when it gets trapped behind a paddle (either at the very top or very bottom) — I’ll continue with part 2 before I tackle that…

This is my first experience with SpriteKit, I was writing a conventional UIKit-based app when it occurred to me that a behavior I desired for a screen object was something that SpriteKit would give me for less effort than programing it from scratch… This tutorial is an excellent hands-on introduction. Thank you!

Gianluca Fuoco says:

I copied everything exactly but ended up with an error in my game view controller, I didnt add anything to it so I was quite confused. Anybody else have this issue?

Justin Kobler says:

Go download my new free and addictive app, Paper Plane Flappy Flight on the App Store.

Link: https://appsto.re/us/Mz_Hlb.i

The game is similar to Flappy bird but with added gameplay features and a new look. This is my first ever app and if any of you would be willing to download and play it, I would greatly appreciate the support. Also if any of you can beat the current high score of 27, send me a screenshot of your new high score and I’ll give you a shoutout on my instagram page!

vtec kickedin says:

anyone else getting Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value when you try to run the code, it keeps popping up for the ball variable

Chord Palette says:

Hey Jared! Thanks for these tutorials man you’ve helped me make my first game!! it just got released into the app store actually; here it is if you wanna check it out!! https://appsto.re/us/jKpBkb.i

Alexander Smith says:

Can’t figure this out.

fatal error: unexpectedly found nil while unwrapping an Optional value

Alina Almasan says:

For someone starting out brand new and really want to learn code. Where can I start with Swift? In the beginning of the video you deleted most of the code and kept a few lines, for me that’s confusing not knowing what you deleted and what you kept. And also the code you left . What does it do? Why is that important.

Alex Grace says:

hi my ball doesnt bounce off the walls whats the problem?

sam e says:

Thank You, this was a pretty simple video to follow. A great way to start and practice.

YouSayWeDo says:

Once I am done coding the second time, my ball glitches and goes strait down, and lags

Austin Jones says:

Maybe its because of an xcode or swift update or something but after going over everything several times i can’t get the ball to bounce unless I check affected by gravity. also the ball seems to be slow yet I’ve set damping to 0 & 0 and restitution is set to 1 on the ball and the border in code just like yours.

Travis Floyd says:

Do you do calls? I need too call you.

Lasse Lundeberg says:

Great tutoria!
Just one question, the ball moves but when it hit my bar or the enemy the ball sticks to the bars. What is the problem?
Using Xcode 9

Andrew N says:

ahah thanks. I got stuck with my ball not moving and then I realized that I had set ball = self.childNode(…) x3 3 times. I changed it to ball, enemy, main = and the ball started bouncing around thanks!

Travis Floyd says:

What does the “Expected declaration” error mean on line 26: “ball.physicsBody?.applyImpulse(CGVector(dx: 20, dy: 20))”

Dan McGladdery says:

The bottom line of code fucked me at the end. Neither of us altered it.

Tyler Parker says:

Great tutorials, but stop saying “go ahead” so much haha. a little annoying in the long run imo

Lazur o says:

When i try to run it says thread 1: fatal error: unexpectedly found nil while unwrapping an optional value

Please help

BloodHeresy says:

As someone who is just trying Xcode for the first time with this video, think you are a little bit too quick and had to jump around to make sure I followed, not a criticism just feedback :).​ Was very informative and got it to work. Thank you 😀

Geecko drome says:

Hi, for me, it’s not working… the ball is really slow, stick to my left border and fall down to my bottom border… and stay …

Muhammed Yaseen says:

After like 3 tries and almost quitting once, I have done it!
Don’t quit people! I did it in Xcode 9 and Swift 4. So yeah! This tutorial as I doubted is not outdated!
But I want to know what those masks are.. I didn’t understand whats the use of them
Thank you Jared!



Sumedh Patwardhan says:

any alternative for pixelmator

Sasha Kost says:

Thank you Jared for this interesting video!) 
And to another people, if your ball didn’t move to fix it you need in file GameViewController.swift change that line “if let scene = GameScene(fileNamed: “GameScene”)” SKScene() to YourNameScene (example — GameScene()!)
And it’s work!

gamer0unreleased says:

This is the best Xcode tutorial I’ve ever seen

Yogesh Jaiswal says:

want one special video after your 50K subs. will not take long

Harry Elliott says:

I can do the code but the game doesn’t show up beside the assistant editor, so I can’t edit the ball so it goes faster, please someone help

成彦儒 says:

I really need help! The impulse does not work and the ball’s physics body is set as dynamic. I set a breakpoint in the didMove(to:) function and it wasn’t even called! In fact, nothing in my GameScene is ever called in runtime. Anyone’s any idea?

Nomis says:

Hi jared You make really good video but they’re question in your comment that you need to answer. I have a problem to with that tutorial, When I start the game I only see my ball going around I don’t see anything else. I revise your video twice and theirs nothing wrong also my ball is slowing down can you help me please?

VectorTime says:

Dude I’ve been searching for hours and no tutorials have made sense and then I found this, this was AMAZING it will help me soooo much in my start to game development!

Ebuka Perez says:

when I ran the app my ball didn’t move at all

Irinyx says:

is there any way to make the ball faster?

ArenEDB says:

How do put an app icon?

Michael Habermas says:

Nice down and dirty tutorial. Quick clear and to the point. I’ll be watching the rest, thanks!

Carlos Vega says:

Into: Looks like Utah mountains to me… Nothing but mountains in Utah.

That One Guy says:

Reallyyy easy to follow

Travis Floyd says:

How do I do this on xcode 9

SirJammy ASMR says:

how do I get rid of the blue rings around my balls

Jacky Tran says:

Nice way to start spritekit, doesn’t overwhelm you with other things I would I want to do in the future

shoaib ramjaun says:

i did the exact same thing but yet my ball is not moving at all

Emre The Technician says:

by the way love your videos Jared 🙂

Ashantha Perera says:

Awesome !

Travis Floyd says:

What photo editor did you use?

Roma Bhattacharjee says:

For everyone who is having trouble making their ball move: under the ball’s physics definition, check dynamic. If a physics body is not dynamic, then impulses and forces don’t work. Read more: https://developer.apple.com/documentation/spritekit/skphysicsbody

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!