Abhishek Gupta
Abhishek Gupta

Reputation: 1

How to get hold of a sprite in cocos2d?

in cocos2d I need to drag a sprite in my project using finger. how do i get hold of that sprite? any help will be appreciated. thanx. i am using chipmunk engine.

Upvotes: 0

Views: 89

Answers (1)

Ben Trengrove
Ben Trengrove

Reputation: 8719

You need to capture the touch began, work out what sprite is being touched and then track the movement of the touch. In touches moved you update the position of the sprite.

Sound complicated? It's not really. Here is a great tutorial for it.

http://www.raywenderlich.com/2343/how-to-drag-and-drop-sprites-with-cocos2d

Upvotes: 2

Related Questions