Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. self.clip.text = [NSString stringWithFormat:@"%lu/%lu", (unsigned long)ammo, (unsigned long)maxAmmo];
  2. self.levelLabel.text = [NSString stringWithFormat:@"Level %lu", (unsigned long)level];
  3. self.lifeAmount.text = [NSString stringWithFormat:@"%d/%lu", health, (unsigned long)maxHealth];
  4.  
  5. - (void)setUpInventory {
  6.  
  7. CGFloat rowOffset = self.frame.size.width / kInventoryColumns / 2;
  8. CGFloat colOffset = self.frame.size.height / kInventoryRows / 2;
  9. NSInteger count = 0;
  10.  
  11. for (int row = kInventoryRows - 1; row >= 0; row--) {
  12. for (int col = 0; col < kInventoryColumns; col++) {
  13.  
  14. SKSpriteNode *inventoryThing;
  15. if (count < [self.player.inventory count]) {
  16. inventoryThing = [SKSpriteNode spriteNodeWithColor:[UIColor greenColor] size:CGSizeMake(rowOffset * 2 - 4, colOffset * 2 - 4)];
  17. } else {
  18. inventoryThing = [SKSpriteNode spriteNodeWithColor:[UIColor redColor] size:CGSizeMake(rowOffset * 2 - 4, colOffset * 2 - 4)];
  19. }
  20. inventoryThing.position = CGPointMake(col * (self.frame.size.width / kInventoryColumns) + rowOffset, (self.frame.size.height / kInventoryRows) * row + colOffset);
  21. [self addChild:inventoryThing];
  22. [self.inventorySprites addObject:inventoryThing];
  23. count++;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement