Skip to content

Instantly share code, notes, and snippets.

@alanf
Created April 21, 2011 03:40
Show Gist options
  • Save alanf/933667 to your computer and use it in GitHub Desktop.
Save alanf/933667 to your computer and use it in GitHub Desktop.
//
// CCParticleSystemAnimation.m
// TapZoo
//
// Created by alan fineberg on 4/20/11.
// Copyright 2011 Streetview Labs. All rights reserved.
//
#import "CCParticleSystemAnimation.h"
@implementation CCParticleSystemAnimation
-(void) dealloc
{
[animation_ release];
[super dealloc];
}
-(void) setAnimation:(CCAnimation *)animation {
animation_ = animation;
[animation_ retain];
}
-(void) update: (ccTime) dt
{
if ( active && emissionRate ) {
NSArray *frames = [animation_ frames];
NSUInteger numberOfFrames = [frames count];
NSUInteger idx = dt * numberOfFrames;
if( idx >= numberOfFrames )
idx = numberOfFrames -1;
[self setDisplayFrame: [frames objectAtIndex:idx]];
}
[super update:dt];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment