Hi,
First off,I have been using Sparrow Framework for a couple of weeks now and I have to say it is really easy to use with solid tutorials and documentation, so kudos to Sparrow Framework!
I am at a pinch at the moment and I was hoping someone could help me out here.
Basically, I have a class called Creatures and is of type SPMovieClip. I have set up a SPTween on the class itself in Creatures on a custom SPJuggler just like in the tutorial. What I am trying to do is to have the Creatures in a movie as well as move at the same time (SPMovieClip + SPTween). I manage to make it move but am failing at the SPMovieClip bit. Here's the code for my tween:
Creatures.h
@interface Creatures: SPMovieClip { SPJuggler *mJuggler; } Creatures.m - (void)startTween { SPTween *tween = [SPTween tweenWithTarget:self time:(double)((arc4random() % 3) + 1) transition:SP_TRANSITION_LINEAR]; [tween addEventListener:@selector(onTweenCompleted:) atObject:self forType:SP_EVENT_TYPE_TWEEN_COMPLETED]; [tween animateProperty:@"x" targetValue:arc4random() % (int)([UIScreen mainScreen].bounds.size.height - (self.width/2))]; [tween animateProperty:@"y" targetValue:arc4random() % (int)([UIScreen mainScreen].bounds.size.width - (self.height/2))]; [mJuggler addObject:tween]; }
As you can see, mJuggler is my custom juggler which is being called using advanceTime in my scenes. Everything is working well and I got my Creatures class to move about in a linear fashion.
However, I am having a lot of trouble trying to add a Movie into my Creature class. I did the following in my Creature class:
Creatures.m
NSArray *frames = [atlas texturesStartingWith:@"Alien"]; [self initWithFrames:frames fps:3]; self.x = -self.width/2; self.y = -self.height/2;
This adds the texture to my Creature and since I have already got my tween to work, all I need to do is to add it into my custom SPJuggler. Problem is, it is not liking it and doing
[mJuggler addObject:self]
Thank you.