Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Initializes the enemy in the Enemy class
- -(id) initEnemy: (int) thehp str:(int) thestr def:(int) thedef
- luck:(int) theluck level:(int) thelevel money:(int) themoney
- thex: (int) thex they:(int) they thefile:(NSString*) thefile
- vel:(float) vel accel:(float) accel dir:(float) dir
- {
- [super init];
- NORTH = 1;
- SOUTH = 2;
- EAST = 3;
- WEST = 4;
- hp = thehp;
- str = thestr;
- def = thedef;
- luck = theluck;
- level = thelevel;
- money = themoney;
- y = they;
- x = thex;
- self.velocity = vel;
- self.acceleration = accel;
- self.direction = dir;
- UIImage *temp = [UIImage imageNamed:file];
- self.imageView = [[UIImageView alloc] initWithImage:temp];
- [temp release];
- imageView.frame = CGRectMake(x, y, 30, 30);
- return self;
- }
- //In the DungeonView class (Adding the Enemy's ImageView to the screen)
- //enemy1 being an iVar of the Enemy class, uninitialized at this point
- enemy1 = [[Enemy alloc] initEnemy:10 str:10 def:10 luck:10 level:10 money:10 thex:400 they:400 thefile:@"Duck.png" vel:10 accel:10 dir:enemy1.SOUTH];
- [self addSubview:enemy1.imageView];
- NSLog(@"%@", enemy1.imageView);
- Print's out
- <UIImageView: 0x4b5bf40; frame = (400 400; 30 30); userInteractionEnabled = NO; layer = <CALayer: 0x4b5bf70>> - (null)
Add Comment
Please, Sign In to add comment