About Archive Tag Cloud Translations RSS

You are writing a comment about Touch Detection in Cocos2d iPhone, here is a quick summary:

A quick look at three different approaches for implementing touch detection using the Cocos2d iPhone library. There are a number of snippets here, and I imagine it would be rather confusing to approach without a basic understanding of ObjC and Cocos2d iPhone.


You are responding to this comment written by Tim on October 31st 2008, 17:59.

Great article!

I have an observation about using CGRectContainsPoint to try to detect a Sprite though...

I don't think the pseudo-code above will work for detecting your MySprite object. There is no 'rect' support either for Sprite or for NSObject - I think because the Sprites are able to be scaled and rotated so a trivial rectangle can not be easily resolved.

To detect if your point is within a Sprite's bounds you would need to multiply it through the transformation matrix to do it properly.

It may be a good addition to your MySprite class to add the 'rect' operation?


Please be aware that comment forms go stale after one hour.





Comments may make use of LifeFlow MarkDown. Raw html will be escaped.


Quick Introduction to LifeFlow MarkDown Syntax

A highlighted code block:

@@ ruby
def a (b, c):
  b * c
end
@@

Other common languages work as well: scheme, python, java, html, etc.

Other markdown syntax:

 ### This is an h3 title
#### This is an h4 title
**this is bold**
*this is italics*

1. This is an
2. ordered list

* And an unordered
* list too

[this is a link](http://www.lethain.com/ "Lethain")