Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

How to Make a Game Like Candy Crush with Swift Tutorial: Part 2

Learn how to make a game like Candy Crush for your iPhone in this 2-part tutorial series - and get a great Swift tutorial along the way!


This is a companion discussion topic for the original entry at http://www.raywenderlich.com/75273/make-game-like-candy-crush-with-swift-tutorial-part-2

Hi! thanks for a great tutorial!

Ive got it working in swift 2.1 but have run into some troubles concerning levels.

When the level is complete I run a function that loads the next level, the crop layer however does not want to update.
Does that have to do with it lying in the init?
Can I move the initialization of the crop layer to an initilizer methos that runs in the beginGame func?
at the moment the mask will be added to the following mask.

Hi I liked this tutorial too, but I have the same issue trying to get the levels system to work. I also think it has to do with the load being in the init.
A hint or two would be nice… :-))

i use a storyboard to work with levels
when the player is game over or when the user completes a level i destroy all layers via code and move to another VC, then when they select a new level (next level or one of the levels in my menu) i go back to the game VC, and rebuild all the layers via the methods in the init

i really hope it helped both of you

ah, yes ill try with that. Seems its not as straight forward as just removing the layers from parent.
Thanks

For the tiles update on level change, just insert at the top of addTiles():

maskLayer.removeAllChildren()
tilesLayer.removeAllChildren()