Hi @dpalme, I’m not sure why the game is locking up on you. I’m able to play the finished game endlessly on the simulator and my devices (iPhone 7 and iPad Pro.) I’ve used a variety of simulated devices (7, 8, 6, iPad, etc.) and they all loop through to the first level after completing the last level.
I don’t think possible swaps: [] is a problem. Whenever you hit shuffle, the game prints all possible swaps to the console like this: possible swaps: [swap type:cupcake square:(4,4) with type:sugarCookie square:(4,5)]. If there aren’t any possible (which happens on Level_4), you’d see that empty Set printed.
Hi @ma2412. The sprite image comes from the CookieType enum, so if you’ve changed the type, you should have the information to update the sprite. I would add a function to GameScene to update the sprite.
Also in GameScene.swift, you also may need to update func addSprites() to use a var instead of a let, since you’re updating the sprite. Change let sprite = SKSpriteNode(imageNamed: cookie.cookieType.spriteName) to be var sprite = SKSpriteNode(imageNamed: cookie.cookieType.spriteName)
Here is what I’m going to do, I’ll take your copy (fresh download) and replace my code with yours, and then retest it again. Provided everything is working, I’ll replace each change I had implemented one by one and go from there.
Is there anything special about the json files ? Any gotchas that I need to be watching for? IE: adding new levels.
Kevin,
I was able to get it working, not sure what the differences were in the end. I took your version and then went back and added each piece of mine in one at a time, testing after each update.
Kevin,
As a follow up question, are you aware of a tut or maybe point me in the right direction on how to create a game map similar to what candy crush has ? It seems as though it must be downloading assets on the fly since it goes on like forever.
Great tutorial. Back again after a bit of a break. With some news.
The “Failed assertion >=4” error that is crashing the game on the Simulator can be stopped by commenting out //run(invalidSwapSound) in GameScene.swift. I also have // run(swapSound) commented out just above it. Don’t know if that was causing problems, but the second one certainly is a problem.
Edit; Yes, I did the same in the Obj-C version, and commented out the swapsound and invalidswapsound, and it works on the simulator in both cases
I haven’t yet got to it to find out why that works - but just thought I’d let you-all know.
any clue what do i have to change to show the corect “tile_…” images? they should have 1 to 9 at the end but the got weird negative random numbers as they need some new hashable-coding for swift 4.2