FreshMinded

Member

Last active last year

  1. last year
    Sat Jan 2 19:13:12 2016
    FreshMinded started the conversation Code problem.

    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)
            
            runAction(translate)
            runAction(flip)
            
        }

  2. Sat Jan 2 19:08:26 2016
    FreshMinded joined the forum.