From 8ebf5750decf897810c9ee162ab2d46511ee7b88 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 16 Aug 2021 10:02:39 -0300 Subject: It looks fugly, but animate actions from the party and enemy members --- game/battle.rpy | 31 +++++++++++++++++++++++++++++++ game/gui/battle.rpy | 14 +++++++------- game/gui/transforms.rpy | 27 +++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/game/battle.rpy b/game/battle.rpy index 4be9dd5..3d13134 100644 --- a/game/battle.rpy +++ b/game/battle.rpy @@ -27,7 +27,35 @@ init python: return ERR_JSONDECODER return bt + def bt_anim(e0, e1, st): + global czoom_p1, czoom_p2, czoom_p3, czoom_p4 + global czoom_e1, czoom_e2, czoom_e3 + if e0 == "party": + if e1 == 0: + czoom_p1 = copy.copy(st) + elif e1 == 1: + czoom_p2 = copy.copy(st) + elif e1 == 2: + czoom_p3 = copy.copy(st) + elif e1 == 3: + czoom_p4 = copy.copy(st) + else: + stdout("Invalid party source: %d" % e1) + elif entry[0] == "enemy": + if e1 == 0: + czoom_e1 = copy.copy(st) + elif e1 == 1: + czoom_e2 = copy.copy(st) + elif e1 == 2: + czoom_e3 = copy.copy(st) + else: + stdout("Invalid enemy source: %d" % e1) + def bt_handlelog(entry): + ## Animate action caster + bt_anim(entry[0], entry[1], czoom_on) + + ## Execute actions if entry[2] in [SPH_NONE, SPH_PIERCE, SPH_ASSAULT, SPH_HEAL]: ## Play audio (WIP) ## FIXME: Play -2 versions as well, randomly @@ -52,6 +80,9 @@ init python: renpy.pause(2.0) renpy.hide("summon", layer="overlay") #renpy.with_statement(Dissolve(1.0)) + + ## De-Animate action caster + bt_anim(entry[0], entry[1], czoom_dd) return label combat: diff --git a/game/gui/battle.rpy b/game/gui/battle.rpy index c0934a3..0a4caa2 100644 --- a/game/gui/battle.rpy +++ b/game/gui/battle.rpy @@ -82,7 +82,7 @@ screen battle_mobs(): fixed: # Enemy 1 showif (en1["hp"] > 0): - add At("mob_"+str(en1["unit_id"]), enemy1) + add At("mob_"+str(en1["unit_id"]), enemy1, czoom_e1) vbox: xalign 0.5 yanchor 0.5 @@ -97,7 +97,7 @@ screen battle_mobs(): # Enemy 2 showif (en2["hp"] > 0): - add At("mob_"+str(en2["unit_id"]), enemy2) + add At("mob_"+str(en2["unit_id"]), enemy2, czoom_e2) vbox: xalign 1.0 yanchor 0.5 @@ -112,7 +112,7 @@ screen battle_mobs(): # Enemy 3 showif (en3["hp"] > 0): - add At("mob_"+str(en3["unit_id"]), enemy3) + add At("mob_"+str(en3["unit_id"]), enemy3, czoom_e3) vbox: xalign 0.0 yanchor 0.5 @@ -148,7 +148,7 @@ screen battle_core(): if (fx1): drag: drag_name "party1" - child At(fx1, c_party1) + child At(fx1, c_party1, czoom_p1) droppable False if (Battle["party"][0]["hp"] > 0): dragged combat_action @@ -199,7 +199,7 @@ screen battle_core(): if (fx2): drag: drag_name "party2" - child At(fx2, c_party2) + child At(fx2, c_party2, czoom_p2) droppable False if (Battle["party"][1]["hp"] > 0): dragged combat_action @@ -248,7 +248,7 @@ screen battle_core(): if (fx3): drag: drag_name "party3" - child At(fx3, c_party3) + child At(fx3, c_party3, czoom_p3) droppable False if (Battle["party"][2]["hp"] > 0): dragged combat_action @@ -297,7 +297,7 @@ screen battle_core(): if (fx4): drag: drag_name "party4" - child At(fx4, c_party4) + child At(fx4, c_party4, czoom_p4) droppable False if (Battle["party"][3]["hp"] > 0): dragged combat_action diff --git a/game/gui/transforms.rpy b/game/gui/transforms.rpy index e4d2c9f..ddada1a 100644 --- a/game/gui/transforms.rpy +++ b/game/gui/transforms.rpy @@ -80,6 +80,32 @@ transform c_party4: # yalign 1.0 # zoom 0.25 + +transform czoom_on: + yanchor 0.5 + yzoom 1.1 + linear 0.1 yzoom 1.2 + linear 0.2 yzoom 1.1 + +transform czoom_e1: + pass +transform czoom_e2: + pass +transform czoom_e3: + pass +transform czoom_p1: + pass +transform czoom_p2: + pass +transform czoom_p3: + pass +transform czoom_p4: + pass +#transform czoom_p5: +# pass +transform czoom_dd: + pass + transform czoom_70: zoom 0.70 @@ -156,6 +182,7 @@ transform tcustom(xaxis): transform tzoom(val): zoom val +# FIXME: Why not use `linear x zoom x` instead of this... ugly... mess? transform tzoomin: zoom 0.1 pause 0.05 -- cgit v1.2.3-70-g09d2