sprite kit - swift spritekit update not getting accurate or constant reading -


im using update track moving node. when using update function not getting constant or accurate numbers.

what code doing first declares current position , endpostion. node moves.in update function track nodes position whiles moving. if reaches endposition , user did not touch screen updates endposition. , until user touches screen.

my code doing want. except update function jumps reading 10.9 12.7 30.75. not constant when node stops, position offset 2-3 points. don not want.

any suggestions make more accurate or code way?

code:

override func didmove(to view: skview) {     curpos=bear.position.y+(bear.size.height/2)     endpos=bear.position.y+(boxsize+boxsize/2)     print(curpos,endpos)      let moveup=skaction.moveby(x:0,y:boxsize,duration:0.7)     let rep=skaction.repeatforever(moveup)     bear.run(rep) } override func update(_ currenttime: timeinterval) {      count=bear.position.y      if endpos <= count {         endpos=count+boxsize         print(endpos)          if touchz==1{             bear.removeallactions()         }     } } 


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -