Akció panel

This commit is contained in:
markojozsef
2026-10-17 14:53:30 +02:00
parent 6632344afe
commit f26964e697
2 changed files with 15 additions and 5 deletions

View File

@@ -31,7 +31,9 @@ cur_action = None
action_timer = 0
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_queue = []
@@ -243,7 +245,7 @@ def menu_action(data):
# !!! CHATGPT VÉGE !!!
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:
if e.ko or e.stone:
@@ -268,11 +270,13 @@ def update(game, dt):
action = action_queue.pop(0)
print(f"Executing: {action}")
cur_action = action
show_action_panel = True
action_timer = 0
if cur_action != None:
if cur_action.animation(cur_action, action_text, action_timer, dt):
cur_action = None
show_action_panel = False
else:
action_timer += dt
@@ -341,5 +345,8 @@ def draw(game):
m.render()
menu_text.render()
if show_action_panel:
action_panel.render()
action_text.render()

View File

@@ -12,11 +12,12 @@ class Character:
self.display = display # Egy függvény amely akkor fut le amikor a speciális karaktert megjelenítik
class TextRenderer:
def __init__(self, x, y, width=None):
def __init__(self, x, y, width=None, center=False):
self.sprites = []
self.base_x = x
self.base_y = y
self.width = width
self.center = center
self.text = ""
self.textptr = 0
self.x = x
@@ -56,7 +57,8 @@ class TextRenderer:
self.y + char.y_offset,
char.width,
12
)
),
char.width
])
self.x += char.width
@@ -78,10 +80,11 @@ class TextRenderer:
pass
def render(self):
offset = -(sum(s[2] for s in self.sprites) // 2) if self.center else 0
for s in self.sprites:
arcade.draw_texture_rect(
s[0],
s[1],
s[1].move(offset, 0),
pixelated=True
)