- if CurrentDirection != LastDirection {
let MoveAtlas = SKTextureAtlas(named: “RedSwanMoveE”)
var MoveFrame = [SKTexture]()
for i in 1…MoveAtlas.textureNames.count / 2 {
let TextureName = “RedSwanMoveE” + “\(i)”
MoveFrame.append(MoveAtlas.textureNamed(TextureName))
}
let MoveAnimationAction = SKAction.repeatForever(SKAction.animate(with: MoveFrame, timePerFrame: 0.125))
self.run(MoveAnimationAction, withKey: “Move”)
AttackDirection = CurrentDirection
}
LastDirection = CurrentDirection
2. AttackBody.position = CGPoint(x: 15, y: -12)
AttackBody.run(SKAction(named: “Attack_MeleeE”)!)