Hey people,
When i define boundaries to bounce my zombie off i get an error stating I ‘cannot assign value of type ‘CGfloat’ to type ‘CGPoint’’ .
as far as i can tell the zombie.position value is CGFloat and we defined topRight and bottomLeft as CGPoints.
What am i missing here ?
thanks. My code is below
func boundsCheckZombie() {
    let bottomLeft = CGPoint.zero
    let topRight = CGPoint (x: size.width, y:size.height)
    
    if zombie.position.x <= bottomLeft.x {
        zombie.position = bottomLeft.x
        velocity.x = -velocity.x
    }
    if zombie.position.x >= topRight.x {
        zombie.position = topRight.x
        velocity.x = -velocity.x
    }
    if zombie.position.y <= bottomLeft.x {
        zombie.position = bottomLeft.y
        velocity.y = -velocity.y
    }
    if zombie.position.x >= topRight.x {
        zombie.position = topRight.y
        velocity.y = -velocity.y
    }
}
