Hi there,
how can I define a juggler to move a tween object to each way point defined in a NSMutableArray?
- (id)initWithWidth:(float)width height:(float)height {
if (self = [super initWithWidth:width height:height]) {
...
cityPoints = [[NSMutableArray alloc] init];
SPPoint *newCoordnate= [[SPPoint alloc] initWithX:413.0f y:533.0f];
[cityPoints addObject:newCoordnate];
newCoordnate= [[SPPoint alloc] initWithX:20.0f y:500.0f];
[cityPoints addObject:newCoordnate];
newCoordnate= [[SPPoint alloc] initWithX:200.0f y:300.0f];
[cityPoints addObject:newCoordnate];
...
return self;
}
...
...
- (void)startTravelling
{
for (id nextPosition in wayPoints) {
[self moveObjectTo];
}
}
...
...
- (void) moveObjectTo{
tween = [SPTween tweenWithTarget:mMyObject time:2.0f transition:SP_TRANSITION_LINEAR];
[tween animateProperty:@"x" targetValue:(nextPosition.y)];
[tween animateProperty:@"y" targetValue:768-nextPosition.x];
[self.stage.juggler addObject:tween];
}