David Dume
David Dume

Reputation: 65

How to make an object bounce on the edges of the screen swift

i need the player to bounce on the edges of the screen and i'm struggling with that here's the code i've made so far:

   func checkTouchesBoard() -> Bool {

    if player.center.x == 360.0 {
        edgeTouched = true
    }

    return edgeTouched!
}

How can i make this work without spriteKit? Thank you

Upvotes: 0

Views: 151

Answers (1)

Charles Truluck
Charles Truluck

Reputation: 981

If you're looking to avoid using SpriteKit, then you may want to take a look at UIKit Dynamics. I found a nice tutorial on it:

http://www.raywenderlich.com/76147/uikit-dynamics-tutorial-swift

Hope this helps!

Upvotes: 1

Related Questions