Hi all,
First sorry for my english!
I've been trying to animate an object by onEnterFrame event.
in MyClass.m (Which his superclass is SPSprite)
@implementation MyClass - (id)init { if (self = [super init]) { //initialize all global variables and puts a SPImage inside //... //And finally the event listener [self addEventListener:@selector(onEnterFrame:) atObject:self forType:SP_EVENT_TYPE_ENTER_FRAME]; } return self; } - (void)onEnterFrame:(SPEnterFrameEvent *)event { //Printing X and width (?) NSLog(@"X: %f | Width: %f", self.x, self.width); self.x += 5; } @end
In my Game.m
i'm creating some objects of MyClass
MyClass *obj = [[[MyClass alloc] init] autorelease]; obj.x = 10; obj.y = 10;
The problem: When I print the X and width i't shows:
X: 10.000000 | width: 92.000000
X: 15.000000 | width: 97.000000
X: 20.000000 | width: 102.000000
X: 25.000000 | width: 107.000000
X: 30.000000 | width: 112.000000
...
...
And follows adding +5 to the width property.
There is no way to animate with onEnterFrame the object's X from itself?
Thanks guys!!!