SKSpriteNode has given itself teleporting capabilities and it can't be stopped

139 views Asked by At

If anyone has ever played league of legends, they know that you click an area to make a player move to that spot. They don't get there instantly, it takes a little bit of time. I've tried to add this functionality to a game that I am trying to make. The problem is, the character tends to sometimes move slowly towards the touched area, which is great because that is what I want, but some times there is an inconsistency where it teleports instantaneously to the touched spot. Can anyone see the problem?

let touch                   = touches.anyObject()! as UITouch
let location                = touch.locationInNode(self)
let moveAction              = SKAction.moveTo(location, duration: 3.0)              

if(tankTurn)    // Tank's turn when tankTurn is true.
{
    tank.runAction(moveAction)

    tank.position               = location
    tankTurn                    = false
}// if statement
0

There are 0 answers