Code problem

  1. 2 years ago
    Edited 2 years ago by niutech

    I have a game that I'm making and it has a flip function that is supposed to see if the player is upside down or not. When I run the game and flip downwards the first time, he flips fine but when I want to flip back up, instead of going up, he keeps going down.
    please help.

    The code is here:

       func flip() {
            isUpsideDown = !isUpsideDown
            var scale: CGFloat!
            if isUpsideDown {
                scale = -1.0
            } else {
                scale = 1.0
            let translate = SKAction.moveByX(0, y: scale * (size.height + kMLGroundHeight), duration: 0.1)
            let flip = SKAction.scaleYTo(scale, duration: 0.1)

or Sign Up to reply!