I have this game I'm making and in the game the player dodges block by moving under or over this beam-like ground. So far I have everything down except for the fact that the hero doesn't flip back up when he flips down.
This is the code i used:
func flipDown() {
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)
}