Game Development Reference
In-Depth Information
2. Now using currentTime , create a timer kind of functionality by declaring a
property called lastCoinAdded in the private interface of FSMyScene.
@property (nonatomic, assign) NSTimeInterval
lastCoinAdded;
3. So this is the timer added in the update method and the diff of currentTime
and lastCoinAdded is checked by 1. Hence, after every 1.0 second, a coin
will be added with animation moving from left to right on the screen.
if( currentTime - self.lastCoinAdded > 1)
{
self.lastCoinAdded = currentTime + 1;
[self addCoin];
}
Finally, our update method is ready to animate multiple coins after a set delay.
Search WWH ::




Custom Search