Akció panel
This commit is contained in:
@@ -31,7 +31,9 @@ cur_action = None
|
|||||||
action_timer = 0
|
action_timer = 0
|
||||||
|
|
||||||
menu_text = TextRenderer(6, 76, 210)
|
menu_text = TextRenderer(6, 76, 210)
|
||||||
action_text = TextRenderer(110, 215, 210)
|
action_text = TextRenderer(128, 204, None, True)
|
||||||
|
action_panel = renderers.NineSlicesPanel(73,187,110,40)
|
||||||
|
show_action_panel = False
|
||||||
|
|
||||||
menu_open = 0
|
menu_open = 0
|
||||||
menu_queue = []
|
menu_queue = []
|
||||||
@@ -243,7 +245,7 @@ def menu_action(data):
|
|||||||
|
|
||||||
# !!! CHATGPT VÉGE !!!
|
# !!! CHATGPT VÉGE !!!
|
||||||
def update(game, dt):
|
def update(game, dt):
|
||||||
global menu_open, cur_action, action_timer
|
global menu_open, cur_action, action_timer, show_action_panel
|
||||||
|
|
||||||
for e in enemies:
|
for e in enemies:
|
||||||
if e.ko or e.stone:
|
if e.ko or e.stone:
|
||||||
@@ -268,11 +270,13 @@ def update(game, dt):
|
|||||||
action = action_queue.pop(0)
|
action = action_queue.pop(0)
|
||||||
print(f"Executing: {action}")
|
print(f"Executing: {action}")
|
||||||
cur_action = action
|
cur_action = action
|
||||||
|
show_action_panel = True
|
||||||
action_timer = 0
|
action_timer = 0
|
||||||
|
|
||||||
if cur_action != None:
|
if cur_action != None:
|
||||||
if cur_action.animation(cur_action, action_text, action_timer, dt):
|
if cur_action.animation(cur_action, action_text, action_timer, dt):
|
||||||
cur_action = None
|
cur_action = None
|
||||||
|
show_action_panel = False
|
||||||
else:
|
else:
|
||||||
action_timer += dt
|
action_timer += dt
|
||||||
|
|
||||||
@@ -341,5 +345,8 @@ def draw(game):
|
|||||||
m.render()
|
m.render()
|
||||||
|
|
||||||
menu_text.render()
|
menu_text.render()
|
||||||
|
|
||||||
|
if show_action_panel:
|
||||||
|
action_panel.render()
|
||||||
action_text.render()
|
action_text.render()
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,12 @@ class Character:
|
|||||||
self.display = display # Egy függvény amely akkor fut le amikor a speciális karaktert megjelenítik
|
self.display = display # Egy függvény amely akkor fut le amikor a speciális karaktert megjelenítik
|
||||||
|
|
||||||
class TextRenderer:
|
class TextRenderer:
|
||||||
def __init__(self, x, y, width=None):
|
def __init__(self, x, y, width=None, center=False):
|
||||||
self.sprites = []
|
self.sprites = []
|
||||||
self.base_x = x
|
self.base_x = x
|
||||||
self.base_y = y
|
self.base_y = y
|
||||||
self.width = width
|
self.width = width
|
||||||
|
self.center = center
|
||||||
self.text = ""
|
self.text = ""
|
||||||
self.textptr = 0
|
self.textptr = 0
|
||||||
self.x = x
|
self.x = x
|
||||||
@@ -56,7 +57,8 @@ class TextRenderer:
|
|||||||
self.y + char.y_offset,
|
self.y + char.y_offset,
|
||||||
char.width,
|
char.width,
|
||||||
12
|
12
|
||||||
)
|
),
|
||||||
|
char.width
|
||||||
])
|
])
|
||||||
|
|
||||||
self.x += char.width
|
self.x += char.width
|
||||||
@@ -78,10 +80,11 @@ class TextRenderer:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def render(self):
|
def render(self):
|
||||||
|
offset = -(sum(s[2] for s in self.sprites) // 2) if self.center else 0
|
||||||
for s in self.sprites:
|
for s in self.sprites:
|
||||||
arcade.draw_texture_rect(
|
arcade.draw_texture_rect(
|
||||||
s[0],
|
s[0],
|
||||||
s[1],
|
s[1].move(offset, 0),
|
||||||
pixelated=True
|
pixelated=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user