All Data Structures Files Functions Variables Enumerations Enumerator Properties Defines
/Projects/Cogito/src/GameObjects/Terrain.m
Go to the documentation of this file.
00001 //
00002 //  Terrain.m
00003 //  Author: Thomas Taylor
00004 //
00005 //  A basic class to contain Terrain relevant data
00006 //
00007 //  05/01/2012: Created class
00008 //
00009 
00010 #import "Terrain.h"
00011 
00012 @implementation Terrain
00013 
00014 @synthesize isWall;
00015 
00016 #pragma mark -
00017 #pragma mark Initialisation
00018 
00026 - (id)initObjectType:(GameObjectType)_type withPosition:(CGPoint)_position andFilename:(NSString*)_filename isWall:(BOOL)_isWall
00027 {    
00028     self = [super init];
00029     
00030     if (self != nil) 
00031     {              
00032         
00033         self.gameObjectType = _type;
00034         
00035         if(_type == kObjectTerrainEnd && [[GameManager sharedGameManager] debug]) filename = [NSString stringWithFormat:@"%@%@.png", _filename, @"Fill"];  
00036         else filename = [NSString stringWithFormat:@"%@.png", _filename];
00037         
00038         isWall = _isWall;
00039         [self setPosition:_position];
00040         
00041         // set the display frame
00042         [self setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:filename]];
00043     }
00044     return self;
00045 }
00046 
00047 @end