Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

Video Tutorial: Beginning SpriteKit Part 4: Boundaries and the Playable Area

Learn how to set up the playable area for your game, Zombie Conga.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3876-beginning-spritekit/lessons/5
1 Like

On line 62 of GameScene.swift the is an erroe: Value of type ‘CGPoint’ has no member ‘angle’/ What is the correction for this error?

  • List item

On line 107 of GameScene.swift there is an error: Binary operator ‘-’ cannot be applied to two ‘CGPoint’ operands. How do I correct this?

Hey man,

You need to import the MyUtils.swift file included in this video’s resources. It’s a helper file with handy calculations done for you. That solves the’-’ function problem.

Secondly the angle issue is resolved by using the file above and is part of the challenge. All you do is call diff.angle and set that as the zombie’s zRotation - spoiler sorry.

L

I’ m try to do function : debugDrawPlayableArea().
But in the video, line 129 will be Error in Swift 3.
How can i to solve it? Thanks.

Eason Hsu

I repeatedly face the error

“Instance member ‘minY’ cannot be used on type ‘CGRect’”

OR

‘CGRectGetMinY’ has been replaced by property ‘CGRect.minY’

‘CGRectGetMaxY’ has been replaced by property ‘CGRect.maxY’

Anyone able to help, pls!

You are probably missing the important part of the message: property.

I don’t have the code you are working on, but it is probably something like:

let y = CGRectGetMaxY(area)

which now becomes

let y = area.maxY

@eason Do you still have issues with this?