Alex Rivera | Logout

How can I detect touch in cocos2d?

Asked 2009-03-12T08:31:37.087
11

I am developing a 2d game for iPhone by using cocos2d.

I use many small sprite (image) in my game. I want to touch two similar types of sprite(image) and then both sprite(image) will be hidden.

How can I detect touch in a specific sprite(image) ?

Edit
Report

1 Answer

0

@Genericrich: CGRectContainsPoint works in CocosLand because of the call 2 lines above:

[[Director sharedDirector] convertCoordinate:]

The Cocos2D objects will be using the OpenGL coordinate system, where 0,0 is the lower left, and UIKit coordinates (like where the touch happened) have 0,0 is upper left. convertCoordinate: is making the flip from UIKit to OpenGL for you.

answered 2009-05-18T15:55:29.803

Your Answer