Thanks Daniel, Yes that fixed it.
Just like to say this framework is really impressive, only picked it up for about a week and already got an very rapid and productive head start..
On another note:
How would I do a call to function inside that target_obj (sprite). Having real issues trying to call a function.
my iso_tile is the target_obj, I checked by just adding a tween to alpha in the touch event. works no problems.
Iso_Tile.h
#import "Sparrow.h"
@interface Iso_Tile : SPSprite
- (id)initWithX:(int)inPosX andY:(int)inPosY;
SPImage *tile_img;
SPSprite *sprite;
- (void)adapt;
@end
//---------------------------------//
Iso_Tile.m
#import "Iso_Tile.h"
@implementation Iso_Tile
- (id)initWithX:(int)inPosX andY:(int)inPosY
{
if (self = [super init])
{
tile_img = [SPImage imageWithContentsOfFile:@"map_tile.png"];
sprite = [SPSprite sprite];
[sprite addChild:tile_img];
[self addChild:sprite];
sprite.x = inPosX;
sprite.y = inPosY;
}
return self;
}
- (void)adapt
{
NSLog(@"adapt fired");
}
- (void)dealloc
{
[tile_img dealloc];
[sprite dealloc];
[super dealloc];
}
@end
//------------------------------//
The touch event in Game.m
- (void)onTouch:(SPTouchEvent*)event
{
SPTouch *touch = [[event touchesWithTarget:self andPhase:SPTouchPhaseBegan] anyObject];
if (touch)
{
//SPSprite *target_obj = event.target;
SPDisplayObject *target_obj = (SPDisplayObject *)event.target;
if ([target_obj.parent isKindOfClass:[SPSprite class]])
{
NSLog(@"touched Sprite");
NSLog(@"obj_x %f obj_y %f ",target_obj.parent.x,target_obj.parent.y);
//SPTween *tween = [SPTween tweenWithTarget:target_obj.parent time:0.5f];
//[tween animateProperty:@"alpha" targetValue:0.0f];
//[self.stage.juggler addObject:tween];
[target_obj.parent adapt]; //Here's where I'm having issues....
}
}
}