Csata menü próbálkozás

This commit is contained in:
markojozsef
2026-09-30 13:13:16 +02:00
parent 2d1bae444c
commit 3558b7db7a
4 changed files with 86 additions and 45 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -74,8 +74,8 @@ battles = [
Combatant("Magma Brute", 200, 40, 40, 60, 999, -50, True, False),
],
"party_members": [
Combatant("Terra", 100, 35, 100, 30, 30, 30, False, False),
Combatant("Locke", 80, 45, 130, 15, 10, 10, False, False),
Combatant("Terra", 100, 35, 100, 30, 30, 30, False, False),
Combatant("Celes", 110, 25, 90, 50, 40, 40, False, False),
Combatant("Cyan", 130, 38, 70, 40, 20, 20, False, False),
],
@@ -95,42 +95,42 @@ battles = [
}
},
"menus": [
{ # Locke
"Attack": "phys_att",
"": "unselectable",
"": "unselectable",
"Item": "items"
},
{ # Terra
"Attack": "phys_att",
"Magic": "magic",
"": "unselectable",
"Item": "items"
},
{ # Celes
"Attack": "phys_att",
"Magic": "magic",
"": "unselectable",
"Item": "items"
},
{ # Cyan
"Attack": "phys_att",
"": "unselectable",
"": "unselectable",
"Item": "items"
}
[ # Locke
["Attack", "phys_att"],
["", "unselectable"],
["", "unselectable"],
["Item", "items"]
],
[ # Terra
["Attack", "phys_att"],
["Magic", "magic"],
["", "unselectable"],
["Item", "items"]
],
[ # Celes
["Attack", "phys_att"],
["Magic", "magic"],
["", "unselectable"],
["Item", "items"]
],
[ # Cyan
["Attack", "phys_att"],
["", "unselectable"],
["", "unselectable"],
["Item", "items"]
]
],
"spells": [
{}, # Locke
{ # Terra
"Fira": ("Fira", move_fire, True),
"Blizzara": ("Blizzara", move_ice, True),
},
{ # Celes
"Fira": ("Fira", move_fire, True),
"Blizzara": ("Blizzara", move_ice, True),
},
{} # Cyan
[], # Locke
[ # Terra
["Fira", 0, ("Fira", move_fire, True)],
["Blizzara", 0, ("Blizzara", move_ice, True)],
],
[ # Celes
["Fira", 0, ("Fira", move_fire, True)],
["Blizzara", 0, ("Blizzara", move_ice, True)],
],
[] # Cyan
],
"inventory": [
["Phoenix Down",67, ("Phoenix Down", move_phoenix, False)]

View File

@@ -1,23 +1,28 @@
import arcade
import assets
import controls
import text
import math
import random
import battle_data
import arcade
from battle import Combatant, Action, Damage, StatusChange
from menu import MenuItem
from text import TextRenderer
import assets
import battle_data
enemies = []
party_members = []
enemy_turn = None
battle_music = None
party_menus = []
spells = []
inventory = []
action_queue = []
enemy_ai_data = {}
party_text = text.TextRenderer(3, 206, 210)
ene_text = text.TextRenderer(123, 206, 210)
menu_text = text.TextRenderer(3, 76, 210)
party_text = TextRenderer(3, 206, 210)
ene_text = TextRenderer(123, 206, 210)
menu_text = TextRenderer(3, 76, 210)
menu_open = 0
menu_queue = []
@@ -26,13 +31,26 @@ menu = []
battle_id = 0
def switch(game):
global enemies, party_members, battle_music, enemy_turn, enemy_ai_data
global enemies, party_members, battle_music, enemy_turn, enemy_ai_data, party_menus, spells, inventory
enemies = battle_data.battles[battle_id]["enemies"]
party_members = battle_data.battles[battle_id]["party_members"]
enemy_turn = battle_data.battles[battle_id]["enemy_turn_func"]
enemy_ai_data = battle_data.battles[battle_id]["init_ai_data"]
party_menus = battle_data.battles[battle_id]["menus"]
spells = battle_data.battles[battle_id]["spells"]
inventory = battle_data.battles[battle_id]["inventory"]
battle_music = assets.sounds[battle_data.battles[battle_id]["mus_id"]].play(loops=True)
def menu_action(data):
global menu, menu_open
user, action = data
menu = []
menu_open = 0
menu_text.reset("")
action_queue.append(Action("In development", user, user, Damage(0, 0, 0, 0), StatusChange(0, 0, 0)))
print(f"pressed action: {action}")
def update(game, dt):
global menu_open
@@ -76,12 +94,36 @@ def update(game, dt):
menu_text.reset(f"{whose.name}'s Menu")
menu_text.type_all()
party_idx = party_members.index(whose)
for i, m in enumerate(party_menus[party_idx]):
menu.append(MenuItem(m[0], 19, 64-(i*13), None, None, None, None, menu_action, (whose, m[1])))
print(len(menu))
for i, m in enumerate(menu):
if i == 0:
m.up = menu[len(menu) - 1]
m.down = menu[1]
elif i == len(menu) - 1:
m.up = menu[len(menu) - 2]
m.down = menu[0]
else:
m.up = menu[i - 1]
m.down = menu[i + 1]
menu[1].select()
for m in menu:
m.update()
party_text.reset(partytext)
ene_text.reset(enetext)
party_text.type_all()
ene_text.type_all()
def draw(game):
for m in menu:
m.render()
party_text.render()
ene_text.render()
menu_text.render()

View File

@@ -43,7 +43,6 @@ class MenuItem:
self.selected = False
self.right.select()
def render(self):
self.text.render()