In this episode we build a SpriteKit match three game with physics, particle effects, fragment shading, and more. You can download the finished project for this and all Swift in Sundays streams: github.com/twostraws/SwiftOnS...
КОМЕНТАРІ: 50
@twostraws4 роки тому
Watch next: Building a declarative user interface app using JSON and Codable - ukposts.info/have/v-deo/fp2manqjgpyDyZc.html Questions? Comments? Tweet me @twostraws.
@gwolanin4 роки тому
This tutorial is amazing. I have been out of the App creation mode for about 7 years and so much has changed. Thank you for providing these tutorials!
@ruptapas4 роки тому
Hi Paul, such a wonderful stream, enjoyed every bit of it. The way you explain the SpriteKit feature & the game was really great. Thank you...
@gregcampbell34935 років тому
Paul, thanks for this video. It was incredibly helpful.
@tehLilaQ3 роки тому
I love this so much, your videos are to the point, educational, and easy to follow. Thanks a lot!
@vels71814 роки тому
Thank you for amazing tutorial on Sprite Kit. It's really a good start for me on SpriteKit.
@Searchupunk2 роки тому
thanks for everything you teach! you are one of the best and brightest teachers I have ever had. I bought the book, it's amazing! Thank you very much.
@arukshun2710Рік тому
Still watching. About half way through. This was a great tutorial! Information still relevant today!
@marcoantoniobatista55643 роки тому
Learned lots from this. Thank you!
@williamsquires30705 років тому
For determining the ‘end of game condition’, do this. Define a var ballColorCount = [0, 0, 0, ..., 0, 0] where the # of elements in the array = # colors you have. When you initialize the random balls at the beginning, add 1 to the array index for that color ball (a good use of an enumeration with an Int raw value). As you make matches, subtract from the count for a particular color the # of balls in the set of “adjacent” balls, plus 1 for the original ball. Once no element of the array >= 3, the game is over; there’s no way to make a match-3 with any colored ball. The array is a histogram of the ball’s colors at any point in the game. This approach is a lot easier than trying to mathematically determining how many balls there must be to still have a match, taking into account that you might have 15 balls, but they’re all at the bottom of the screen, and no adjacent balls are the same color, even though you might still have - let’s say - 4 green ones, 3 red ones, 2 purple ones, 3 yellow ones and 3 blue ones. But they could make a match if you tilt the device and allow the balls (using the physics engine) to rearrange themselves.
@yarkil4 роки тому
This is one of the best fast intro & tutorial I ever seen (on any technology tbh). Nice paced, clear and on point! Amazing work!
@williamsquires30705 років тому
(@1:30:00) “...Metal is hard.” LOL! Good one! 😆
@zaurmahmudov14384 роки тому
Perfect Video
@kjmyatt40693 роки тому
👍 I’ll keep watching I need to learn haha
@HumbleHustle101Рік тому
Nice video. Paul can you make a video about creating cloth physics with metal framework?
@clipartinc5 років тому
Thanks for your videos!!! Please do more game tutorials in Spritekit or Scenekit :) It would be great to get a game setup tutorial that includes the use of inventory to hold items for use during game play.
@petersuvara5 років тому
You can create an inventory by creating a protocol called InventoryItem, then have a character that has an array of those items. This can be then drawn when each inventoryitem has a reference to an image/animation asset. :) There you go...
@clipartinc5 років тому
@@petersuvara Thank you! I will give it a try :)
@semilife4 роки тому
Thanks so much Paul for a very entertaining and very informative and useful session.
@dragonangel0012 роки тому
Hi Paul, thanks for the great tutorial, but when I follow your tutorial, I only get a frame width of 1024 using an iPad Pro 12.9. I tried to change the settings at many location but I can never get more then 23 balls to fit horizontally (23*44). In your video, you do not have that issue and we can see that you have 31 horizontal balls which is 1364 which sounds more like it should be at 2x scale right? What am I doing wrong. I'm using Xcode 12.5 with iOS 14.5. Cheers!
@roipropertypathfinderuae5 років тому
I've made everything on your lesson but in method update "if let accelerometerData = motionManager?.accelerometerData", accelerometerData is always nil. Therefore it never let me implement the down code "physicsWorld.gravity = CGVector(dx: accelerometerData.acceleration.y * 50.0, dy: accelerometerData.acceleration.x * 50.0)". So, what's the hitch? Help me plz, stunning lesson!!!
@mortisea24082 роки тому
What resource did you use to learn the basics and fundamentals of SpriteKit
@guptdas1140Місяць тому
Great👍
@light-water9 місяців тому
How were the colors of the balls generated?
@light-water9 місяців тому
nvm, I realized it would be in the assets folder.
@williamchoy8853 роки тому
Thanks Paul. Excellent presentation as usual. Minor Leak: Forgot to remove the omg nodes after they fadeout. let disappear = SKAction.group([ SKAction.scale(to: 2, duration: 0.25), SKAction.fadeOut(withDuration: 0.25), SKAction.removeFromParent() ]) Was able to finish the game with 9 nodes (6 remaining balls + background + score label + one unaccounted). Is there a way to debug SpriteKit to see the remaining nodes?
@williamchoy8853 роки тому
Or you can reuse the same omg SpriteNode by moving the setup to the update function, and adding a reset action to scale it back to 0.001
@williamsquires30705 років тому
Given these two implementations of getMatches(), would it be better to make touchesEnded() call another func called ‘removeBallsOfMatchingColor()’ that takes a closure that takes a Ball and returns Void, then move the existing code in touchesEnded() into this new func, and have it pass in a func that takes a Ball and returns Void (which each implementation of getMatches() does). You can now implement both: call the first func, ‘getExactMatches()’, and the second one ‘getMatchesWithLeeway().’ And pass in one or the other to see what the difference in game play or performance is with each implementation. 🤠 Now you can add a new type of Ball; a ‘PebblyBall’ that has a rough, pebbly surface. In addition, the PebblyBalls have a unique property. Whereas a normal (smooth) Ball will match any other normal Ball of matching color when tapped, the PebblyBall will match any normal or pebbly ball of the same color, but only if you tap on it first. Now, you’ll have another method, ‘getMatchesWithPebblyBall()’, and touchedEnded will check if the touched ball is a Ball or PebblyBall, and call the ‘removeBallsOfMatchingColor()’ with this new method, and no changes need be made to ‘removeBallsOfMatchingColor()’ as it’s already flexible enough to use any closure that takes a ‘Ball’ (or subclass thereof), and returns Void. Ta-daa!
@LucasAraujo-il5mm3 роки тому
The zero patience police for harassment made me like your video as soon as I heard it
@ra9rРік тому
Idea for a video ... Rendering a 3d dice app. Show how to use physics and 3d rendering within a swiftUI interface
@VeryBlueBot4 роки тому
thanks this is very useful! Cant really find an answer anywhere in 2019.. are there any performance advantages in using SpirteKit over a modern engine (Unity/Godot)>
@koncr4404 роки тому
well spritekit is specifically to use in xcode. Spritekit is used if you want to make a game you can publish into the appstore. Unity is used to make general games you can post onto the internet (which im not sure you can put onto the app store). Note that Spritekit is strictly 2d games while Unity can make both 2d and 3d. In summary, spritekit is for games you want to put onto the appstore.
@VeryBlueBot4 роки тому
@@koncr440 Question is if you get any advantages using IOS specific tech? performance? ease of integration etc.. of course if Im going with SpriteKit stack for my mobile games ill have to find a tech to build to Android as well (LibGDX etc)
@koncr4404 роки тому
Blue Bot well I’m not exactly sure, but Swift is a very powerful language, designed to be fast (faster than C++). So using SpriteKit with swift will increase performance
@VeryBlueBot4 роки тому
@@koncr440 guess ill have to test them creating a simple game or even a scene and over populating it with objects to see where the diff starts (if any)
@yarkil4 роки тому
@@koncr440 Dude, your lack of knowledge is profound. C++ is faster than Swift, and if you would know just a little bit about what is going on under the hood it would be obvious for you and you would never make that mistake. Please learn more and stop putting wrong information lol
@what44012 роки тому
thx
@kbr8ck2 роки тому
Could you share links to your plugs? You mentioned a fun choose your own adventure for $40 but I’m having trouble finding in the video - found at 1:20:00 links to shaders and SpriteKit game
@twostraws2 роки тому
It's here: www.hackingwithswift.com/store/dive-into-spritekit HOWEVER: In a few hours I'll be launching my annual WWDC sale, so you can save $20 if you wait a little. I'll be announcing the sale on Twitter @twostraws.
@TheRealWinsletFan5 років тому
Who's METAL book was that you mentioned? ( 1:02: )
@twostraws5 років тому
Janie Clayton's.
@TheRealWinsletFan5 років тому
@@twostraws Thx, located and ordered!
@nas-zu8xl3 роки тому
hugh grant hudson
@neilsoulman2 роки тому
So, would spritekit be considered a " real game changer"? Lol #nerdjoke