Hi! I'm new to Pixelwave, Objective C and iOS development. I come from the Flash world, and was very pleased when I found this great framework. Thanks to SimianLogic for pointing me this way!
Oh, also, I was curious if setting a rectangle as the touch area is generally faster than using the contents of the sprite. And is it generally good to turn touchenabled to off if not needed?
I will look into that issue and let you know if it's a bug or whatnot.
Neurofuzzy,
- (void) initializeAsRoot
{
[PXDebug setDrawHitAreas:YES];
[PXDebug setDrawBoundingBoxes:YES];
PXSprite *sprite = [[PXSprite alloc] init];
[self addChild:sprite];
sprite.x = self.stage.stageWidth * 0.5f;
sprite.y = self.stage.stageHeight * 0.5f;
[sprite.graphics beginFill:0x008080 alpha:1.0f];
[sprite.graphics drawCircleWithX:0.0f y:0.0f radius:64.0f];
PXRectangle *_hitArea = [[PXRectangle alloc] initWithX:-100.0f y:-100.0f width:200.0f height:200.0f];
sprite.hitArea = _hitArea;
[_hitArea release];
[sprite addEventListenerOfType:PXTouchEvent_TouchUp listener:PXListener(onTouch:)];
}
- (void) dealloc
{
[super dealloc];
}
- (void) onTouch:(PXTouchEvent *)event
{
NSLog (@"%@ [%@] on touch\n", event.type, event.stagePosition);
}
I turn the debug draws on so you can see the hit area. This may also help you find the bug you are having; otherwise, if you can reproduce the problem see if you can make a quick sample for me and I will hunt down a solution!
Neurofuzzy,
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!