Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

How To Create a Breakout Game with Sprite Kit and Swift: Part 1

Learn how to make a breakout game for iOS with Sprite Kit and Swift via a fun hands-on tutorial.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1161-how-to-make-a-breakout-game-with-spritekit-and-swift-part-1

Thanks a ton for this article! I absolutely adore this website :smiley:

Quick question:
Any chance I could get the paddle.png to texture the paddle with?

I’m going through the “Adding a Paddle” section and noticed that there’s not the paddle.png that I’m supposed to use for the paddle’s texture. I believe I’ve followed the tutorial exactly up to this point so maybe it’s not included within the download?

Any and all help would be greatly appreciated!

It is in Assets.xcassets, along with all other images. You assign the panda face texture to the paddle by first selecting the paddle in GameScene.sks, then selecting “paddle” for Texture in the Attributes Inspector — just like the way set the ball texture.

I’ve been reading your articles and they are quite good, however they seem to be mostly conecentrated to touch devices, I have a real problem getting (Porting) your projects to OS X even though your code has helped me a lot, the navigation e.g mouseMoved etc. is a real puzzle for me. I’m new to Swift and the whole sprite kit (I did some Objective C, PHP Java C++) to keep it short I’m really at a puzzle of how to manipulate move objects in sprite kit, and also why in your code you simply drag the image into the project and the apple standard code calls it in the code… Regards a very confused londoner :wink:

I finished the tutorial and everything was working fine, but all of a sudden the ball slows down or speeds up when it touches other objects or the border.
The only thing I did was edit some of the assets in the project folder.

Any idea what could be wrong?

One thing I noticed when moving the paddle, is that my finger goes off the edge of the screen a lot, and the paddle doesn’t pick up where it left off… i’m guessing that the touch ended somehow… but how can the app be made a little more forgiving and able to pick up from where the finger entered the screen area?

one issue I have with the tutorial is that on the touches began, moved, etc., a whole new object (a skspritenode) is being allocated, often many times per second. that really really seems wasteful and a sure way to slow everything down a lot.

Mine looks like this: https://i.imgur.com/KI3R3xR.png Before making contact :frowning:

Anyone any ideea ?

When I added the 3 lines in the “Forever bouncing” section, it compiles, but I get a runtime error:
“fatal error: unexpectedly found nil while unwrapping an Optional value”

It highlights the line:
let ball = childNode(withName: BallCategoryName) as! SKSpriteNode

can someone please help

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]