swift - Resetting and changing speed on SKActions -
is there way change velocity/speed of skaction , reset skaction?
let wait = skaction.waitforduration(5.0) let moveright = skaction.movebyx(300, y:0, duration: 1.0) let sequence = skaction.sequence([wait, moveright]) let endlessaction = skaction.repeatactionforever(sequence) node.runaction(endlessaction)
this code works things change how fast skspritenode
moves right @ moment it quite slow , make skspritenode
return orignal position rather keep on moving right forever?
thank you
since velocity = distance / time
, decreasing duration
increase speed the sprite move across screen.
regarding second point, considering how skaction.movebyx(300, y:0, duration: 1.0)
moves node right; skaction.movebyx(-300, y:0, duration: 1.0)
must therefore move node left, original position.
hope helps.
Comments
Post a Comment