Guest User

Untitled

a guest
Aug 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. //Initializes the enemy in the Enemy class
  2.  
  3. -(id) initEnemy: (int) thehp str:(int) thestr def:(int) thedef
  4. luck:(int) theluck level:(int) thelevel money:(int) themoney
  5. thex: (int) thex they:(int) they thefile:(NSString*) thefile
  6. vel:(float) vel accel:(float) accel dir:(float) dir
  7. {
  8. [super init];
  9.  
  10. NORTH = 1;
  11. SOUTH = 2;
  12. EAST = 3;
  13. WEST = 4;
  14.  
  15. hp = thehp;
  16. str = thestr;
  17. def = thedef;
  18. luck = theluck;
  19. level = thelevel;
  20. money = themoney;
  21.  
  22. y = they;
  23. x = thex;
  24.  
  25. self.velocity = vel;
  26. self.acceleration = accel;
  27. self.direction = dir;
  28.  
  29. UIImage *temp = [UIImage imageNamed:file];
  30. self.imageView = [[UIImageView alloc] initWithImage:temp];
  31. [temp release];
  32. imageView.frame = CGRectMake(x, y, 30, 30);
  33. return self;
  34. }
  35.  
  36. //In the DungeonView class (Adding the Enemy's ImageView to the screen)
  37. //enemy1 being an iVar of the Enemy class, uninitialized at this point
  38.  
  39. 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];
  40. [self addSubview:enemy1.imageView];
  41. NSLog(@"%@", enemy1.imageView);
  42.  
  43. Print's out
  44. <UIImageView: 0x4b5bf40; frame = (400 400; 30 30); userInteractionEnabled = NO; layer = <CALayer: 0x4b5bf70>> - (null)
Add Comment
Please, Sign In to add comment