Kodeco Forums

How to Make a Game Like Can Knockdown

Learn how to make a game like Can Knockdown using SceneKit and Swift.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/932-how-to-make-a-game-like-can-knockdown
1 Like

Thank You for your tutorials!

1 Like

what tool do you use to create the 3D can ? :grinning:

Blender was used to create the model for the can.

Thank you for a nice tutorial!

I added the following code inside throwBall to hide the thrown balls after some delay.

let waitAction = SCNAction.wait(duration: 3.0)
let fadeOutAction = SCNAction.fadeOut(duration: 1.0)
let blockAction = SCNAction.run { _ in
	ballNode.physicsBody = nil
}
let sequenceAction = SCNAction.sequence([waitAction, fadeOutAction, blockAction])
		
ballNode.runAction(sequenceAction)

That’s a great addition @frohmen! I’m glad you enjoyed the tutorial!

thank you very mush :grin:

Thanks for a great tutorial!
I released own game in App Store, based on this guide. For the reference - name is “Can Knockout”.

1 Like

I love the explosions in your game!! Nice job :]

I have just tried to compile the code and I get this error on iOS 11 and Xcode 9 Beta on a iPhone 7 Plus. I tried my own project and the final build you provided but the issues is the same. The crash occurs when calling the presentMenu() function. failed assertion `For color attachment 0, the render pipeline’s pixelFormat (MTLPixelFormatRGBA8Unorm_sRGB) does not match the framebuffer’s pixelFormat (MTLPixelFormatBGR10_XR_sRGB) I read somewhere it maybe something to do with a SpriteKitNode in the Scene? But wasn’t sure that was the case or not?

Actually it doesn’t seem to be that verbose message. I skipped the presentMenu() and tried going straight into the game using presentLevel(). I am guessing there is something up with the scene files and also the scene references maybe? Oh well it looks a good toot though!

I have the same crash on iOS 10, Xcode 8, iPhone 7 Plus. This happens both in my code and also when I tried loading the finished code example. I only tried building it on my device at the end (it was laggy in the Simulator, but seemed to work, otherwise).
I was not abe to work around getting it to load past a black screen on my device.

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! :]