How to Make a Game Like Candy Crush with SpriteKit and Swift: Part 1

Hi @archideus: You’re absolutely right! Great catch. Thanks! :]

And I believe this is what @c0nman was asking about as well.

I’ve updated the tutorial and the downloadable materials to reflect the bug fix.

Cheers,
Kevin

Hi Ray,

I love your tutorial.

hashValue does not seem to be reliable to convert Bool to Int. I get values of -bigNumber or +bigNumber. To make sure, I posted the question at Stackoverflow: swift - Bool.hashValue valid to convert to Int? - Stack Overflow

I converted topLeft.hashValue to (topLeft ? 1 : 0) also for the other three constants, and now it works fine.

Best regards,
Michael

1 Like

@icemichael Thank you for the heads up - much appreciated!

@kevcol can u help me? how to fix this problem?

Hi @bodya, those red X’s mean the images are not being found for some reason. Check to see if the images are missing or if the code that calls them has a typo.

@kevcol Have you any idea, how I can solve it?

Hey @bodya, this tutorial is more than six months old, so is not officially supported … but I have a little time this week, so if you wanted to send me your whole project (as a zip file), I can take a look and see if I can’t find out what’s wrong. Just reply and attach a zip file. Thanks

@kevcol new users can’t upload attachment, but you can download my zip file here https://files.fm/f/eckqvr5a
Thanks for your help.

Hi @bodya try icemichael’s solution above as It worked for me.

in your addTiles function change

var value = topLeft.hashable
value = value | topRight.hashable << 1
value = value | bottomLeft.hashable << 2
value = value | bottomRight.hashable << 3

to

var value = (topLeft ? 1 : 0)
value = value | (topRight ? 1 : 0) << 1
value = value | (bottomLeft ? 1 : 0) << 2
value = value | (bottomRight ? 1 : 0) << 3

and it will find the images

2 Likes

viktorevil This worked for me. Thanks so much!

@viktorevil thanks for help

Yes, you solved it. Thanks, @viktorevil!

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!