Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.clip.text = [NSString stringWithFormat:@"%lu/%lu", (unsigned long)ammo, (unsigned long)maxAmmo];
- self.levelLabel.text = [NSString stringWithFormat:@"Level %lu", (unsigned long)level];
- self.lifeAmount.text = [NSString stringWithFormat:@"%d/%lu", health, (unsigned long)maxHealth];
- - (void)setUpInventory {
- CGFloat rowOffset = self.frame.size.width / kInventoryColumns / 2;
- CGFloat colOffset = self.frame.size.height / kInventoryRows / 2;
- NSInteger count = 0;
- for (int row = kInventoryRows - 1; row >= 0; row--) {
- for (int col = 0; col < kInventoryColumns; col++) {
- SKSpriteNode *inventoryThing;
- if (count < [self.player.inventory count]) {
- inventoryThing = [SKSpriteNode spriteNodeWithColor:[UIColor greenColor] size:CGSizeMake(rowOffset * 2 - 4, colOffset * 2 - 4)];
- } else {
- inventoryThing = [SKSpriteNode spriteNodeWithColor:[UIColor redColor] size:CGSizeMake(rowOffset * 2 - 4, colOffset * 2 - 4)];
- }
- inventoryThing.position = CGPointMake(col * (self.frame.size.width / kInventoryColumns) + rowOffset, (self.frame.size.height / kInventoryRows) * row + colOffset);
- [self addChild:inventoryThing];
- [self.inventorySprites addObject:inventoryThing];
- count++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement