Learn more about GameplayKit by adding obstacles to the scene.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3875-how-to-make-a-game-like-flappy-bird/lessons/5
Learn more about GameplayKit by adding obstacles to the scene.
I am having a problem when I am adding the spawn. When I compile it. It looks so much different then how your compiling and also it is not making the obstacle random
![45 AM|465x500]@paradox927 Can you please help with this when you get a chance? Thank you - much appreciated! :]
@kennethokereke: Without seeing your code, it’s difficult to determine the cause. My best guess is that you may have missed a step. Go back through what you’ve done to see what’s missing.
Trying to do the flappy bird tutorial and struggling with the movement component since it won’t compile. You write.
// Apply Gravity
let gravityStep = CGPoint(x: 0, y: gravity) * CGFloat(seconds)
velocity += gravityStep
// Apply Velocity
let velocityStep = velocity * CGFloat(seconds)
spriteNode.position += velocityStep
Which the compiler is complaining about since you are trying to multiply a CGPoint by a CGFloat? using iOS 12, Swift 4.2. Maybe something has changed?
Hi @mark.lucking you can solve this with declare an extension;
extension CGPoint {
static func * ( left : CGPoint , right : CGFloat) -> CGPoint {
return CGPoint(x: left.x * right, y: left.y * right)
}
static func * ( left : CGFloat , right : CGPoint) -> CGPoint {
return CGPoint(x: right.x * left, y: right.y * left)
}
copy this code and paste on >MovementComponent.swift under the Import GameplayKit.