ios - Why doesn't my SKAction run properly? -
so have problem skaction dosen't run properly. runs duration of 0.2 of times instant no animation of node moving position.
array_dot[j].runaction(skaction.movetoy(premakni_do, duration: 0.2))
more code used. function move sphere nodes 1 place down if place free underneath them (idk if code works kinda :p). 152 on y max low can go.
what run through nodes match names move them array, reverse array , move them low can go. mentioned before moving of nodes works, of times (90%) animation doesn't run. not using of physics.
func premakni_pike() { array_dot.removeall() var preveri_pozicija: cgfloat = 0 self.enumeratechildnodeswithname("//*") { node, stop in if(node.name == "blue" || node.name == "yellow" || node.name == "red" || node.name == "green") { self.array_dot.append(node) } } let velikost_array = array_dot.count array_dot = array_dot.reverse() var premakni_do: cgfloat = 0 j in 0...velikost_array-1 { if(array_dot[j].position.y != 156) { premakni_do = array_dot[j].position.y in 0...6 { preveri_pozicija = array_dot[j].position.y - 60 if(preveri_pozicija < 156) { break } print(array_dot[j].name,i,preveri_pozicija,array_dot[j].position.y) let novi_node = self.nodeatpoint(cgpoint(x: array_dot[j].position.x, y: preveri_pozicija)) if(array_dot[j].intersectsnode(novi_node)) { array_dot[j].position.y = preveri_pozicija premakni_do = premakni_do - 60 print("prazno") } else { break } } array_dot[j].runaction(skaction.movetoy(premakni_do, duration: 0.2)) } } }
are sure runaction not working? may setting nodes position , telling move position. try removing lines
if(array_dot[j].intersectsnode(novi_node)) { array_dot[j].position.y = preveri_pozicija premakni_do = premakni_do - 60 print("prazno") } else { break }
Comments
Post a Comment