i making game , want enemy move in circle enemy should have constant movement left well. have tried create circle path cgpath , make follow path , added skaction constant left movement. seems node following cgpath without left movement.
is there other way make possible?
this code @ moment:
cgmutablepathref circle = cgpathcreatemutable(); cgpathaddarc(circle, null, 0, 0, 80, 0, 2*m_pi, true); cgpathclosesubpath(circle); skaction *followtrack = [skaction followpath:circle asoffset:no orienttopath:no duration:1.5]; skaction *forever = [skaction repeatactionforever:followtrack]; [enemy runaction:[skaction movebyx:-1000 y:0 duration:3.0]]; [enemy runaction:forever];
you can't move same node 2 move actions. can place node in container node. move container node left while child moves in circle.
another option not use skactions , use more dynamic , real-time computing centripetal velocity manually , shifting centripetal point overtime. can see example of in answer here.
Comments
Post a Comment