move draw to the hotbar itself
This commit is contained in:
parent
1aeeb90da2
commit
0ac485f69e
1 changed files with 7 additions and 4 deletions
11
creeper.py
11
creeper.py
|
|
@ -121,6 +121,12 @@ class HotBar:
|
||||||
else:
|
else:
|
||||||
self.items[next_idx].selected = True
|
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:
|
class HotBarItem:
|
||||||
def __init__(self, game: Game, surf, pos=0):
|
def __init__(self, game: Game, surf, pos=0):
|
||||||
|
|
@ -328,11 +334,8 @@ class Creeper(Game):
|
||||||
(0, 0),
|
(0, 0),
|
||||||
special_flags=pygame.BLEND_RGBA_MULT,
|
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:
|
self.hotbar.draw()
|
||||||
hot_bar_item.draw()
|
|
||||||
|
|
||||||
self.mouse_box = MouseSprite(self.screen, hotbar=self.hotbar)
|
self.mouse_box = MouseSprite(self.screen, hotbar=self.hotbar)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue