Angry ninjas demo, were is actual controls situated in the code.

Topics: Sample Code and Demos
Jul 29, 2013 at 3:21 PM
What I mean by this is I can't seem to find the piece of code which says something along the lines of if the player touches here do this ... I realise that each object in the game has been somehow wired into reacting to a touch but what I want to do, is release the slingshot and turn it into some sort of character with a bow, which would then see me apply controls for movement and then an action of pulling the bow back.

I understand this might be a simple concept but I really analysed this code looking for some answers but have come up with nothing. I'm new to box2d and cocos2d ..

Thanks for your time and any help :)
Coordinator
Jul 29, 2013 at 4:26 PM
The slingshot in Angry Ninjas is a composite sprite where the band is just a sprite that is stretched (scale factor) to match the touch movements.

Layers respond to touches either as a sequence of multi touch events (CCLayer.TouchesStarted) or by a single touch (CCLayer.TouchStarted). You override the methods to handle the touch events.

You can also enable gestures and consume them.
Jul 29, 2013 at 5:13 PM
Right I get the theory behind it, looking the the cocos2d class's and seeing the handlers in the touch_dispatcher ...

I'm really sorry to be a pain but could you refer to a class that refers to a sequence in the angry ninjas project.

It only because i can see the calculations for the scaling the slingshots straps .. i just dont see how this is linked to
the touch classes.

thanks again for your time.
Jul 29, 2013 at 5:41 PM
sorry .. iv worked this out now ...

thanks again :)