Video Tutorial: How to Make a Game Like Flappy Bird

Enjoyed the video course creating the game. Was wondering if there is a way to prevent Felipe from flying off screen above the cactus and scoring points?

@paradox927 Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @bbishop1958. Sorry for not seeing your question earlier.

There are a number of ways to accomplish this, however, one of the easiest and quickest ways is to create an additional physics body. As an example:

let upperLeft = CGPoint(x: 0, y: size.height)
let upperRight = CGPoint(x: size.width, y: size.height)
let upperBody = SKPhysicsBody(edgeFrom: upperLeft, to: upperRight)
physicsBody = SKPhysicsBody(bodies: [lowerBody, upperBody])

This topic was automatically closed after 166 days. New replies are no longer allowed.