move draw to the hotbar itself

This commit is contained in:
Waylon Walker 2023-01-02 12:47:24 -06:00
parent 1aeeb90da2
commit 0ac485f69e
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4

View file

@ -121,6 +121,12 @@ class HotBar:
else:
self.items[next_idx].selected = True
def draw(self):
for i, item in enumerate(self.game.inventory):
self.items[i].type = item
for hot_bar_item in self.items:
hot_bar_item.draw()
class HotBarItem:
def __init__(self, game: Game, surf, pos=0):
@ -328,11 +334,8 @@ class Creeper(Game):
(0, 0),
special_flags=pygame.BLEND_RGBA_MULT,
)
for i, item in enumerate(self.inventory):
self.hotbar.items[i].type = item
for hot_bar_item in self.hotbar.items:
hot_bar_item.draw()
self.hotbar.draw()
self.mouse_box = MouseSprite(self.screen, hotbar=self.hotbar)