0
votes

I just recently start to learn box2d, I am making a tiny wing clone. and i am trying to make a sprite follow another sprite, and eventually catch up.

since box2d is a whole new api to me, I do not know where to start. The way I am thinking of is storing the leader sprite position into a cgpoint array and setting it to the other sprite, but since its box2d, and it goes up and down hills. I dont know if the animations are smooth enough

2

2 Answers

0
votes

My code is base of that, and I figured it out. heres my code for now

- (void)makeNinjaFollow {
  if (posCounter >= 200) 
    posCounter = 0;

  pandaPositions[posCounter] = _panda.position;
  _enemy.position = pandaPositions[posCounter - 20];

}
0
votes

Please follow these Tutorial

Tiny wings tutorial Part-1

Tiny Wings tutorial Part-2

You can find the project on Github here: Tiny-wings Clone github link