//
//  Sprout.m
//  Caterpillar
//
//  Created by Brandon Trebitowski on 11/13/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "Sprout.h"
#import "GameConfig.h"

@implementation Sprout

@synthesize lives = _lives;

- (id) initWithGameLayer:(GameLayer *)layer {
    // 1
	if(self = [super initWithGameLayer:layer]) {
        // 2
	    self.sprite = [CCSprite spriteWithSpriteFrameName:@"sprout.png"];
        
	    // 3
	    [self.gameLayer.spritesBatchNode addChild:self.sprite];
        
	    // 4
	    self.lives = kSproutLives;
    }
    return self;
}

// 5
- (void)setLives:(NSInteger)lives {
    _lives = lives;    
    self.sprite.opacity = (_lives / 3.0) * 255;
}

@end


