Hi all,
I've been trying to convert the code from the article below to v0.8.1 of Cocos2D.
http://juanmunozar.blogspot.com/2009/02/cocos2d-iphone-dynamically-touch.html
I understand from Riq that I need to replace 'absolutePosition' with 'convertToWorldSpace:CGPointZero'.
I've tried making these changes but when testing no touches are being registered.
Does my new code look okay?
// OLD CODE
- (CGRect) rect {// rectangle that contains the sides coords of each sprite.
float x = [self absolutePosition].x - [self contentSize].width/2;
float y = [self absolutePosition].y - [self contentSize].height/2;
float h = [self contentSize].height;
float w = [self contentSize].width;
return CGRectMake(x,y,w,h);
}
// NEW CODE
- (CGRect) rect {
float x = [self convertToWorldSpace:CGPointZero].x - [self contentSize].width / 2;
float y = [self convertToWorldSpace:CGPointZero].y - [self contentSize].height / 2;
float h = [self contentSize].height;
float w = [self contentSize].width;
return CGRectMake(x, y, w, h);
}