From 5c7bbfcc858fdb0b674de5a42e60ad994d59c973 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:47:43 +0200 Subject: [PATCH] Simplify and make dynamic teleport and heal animations --- game/scripts/events/labels.rpy | 57 +++++++++++++++++----------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/game/scripts/events/labels.rpy b/game/scripts/events/labels.rpy index e844ecad..3e50bb10 100644 --- a/game/scripts/events/labels.rpy +++ b/game/scripts/events/labels.rpy @@ -104,33 +104,32 @@ label increase_house_points(house, points): #TODO Check and fix teleport/heal effect position (chibis are now anchored bottom-left) label teleport(position_=None, effect=True, poof_label=None): - python: - if position_ == "genie": - teleport_xpos = genie_chibi.pos[0]+75 - teleport_ypos = genie_chibi.pos[1] + if position_ == "genie": + dynamic: + teleport_pos = (genie_chibi.pos[0]+75, genie_chibi.pos[1]) teleport_zorder = 3 - elif position_ == "hermione": - teleport_xpos = hermione_chibi.pos[0]+45 - teleport_ypos = hermione_chibi.pos[1] + elif position_ == "hermione": + dynamic: + teleport_pos = (hermione_chibi.pos[0]+45, hermione_chibi.pos[1]) teleport_zorder = 3 - elif position_ == "cho": - teleport_xpos = cho_chibi.pos[0]+45 - teleport_ypos = cho_chibi.pos[1] + elif position_ == "cho": + dynamic: + teleport_pos = (cho_chibi.pos[0]+45, cho_chibi.pos[1]) teleport_zorder = 3 - elif position_ == "astoria": - teleport_xpos = astoria_chibi.pos[0]+45 - teleport_ypos = astoria_chibi.pos[1] + elif position_ == "astoria": + dynamic: + teleport_pos = (astoria_chibi.pos[0]+45, astoria_chibi.pos[1]) teleport_zorder = 3 - elif position_ == "desk": - teleport_xpos = 320 - teleport_ypos = 450 + elif position_ == "desk": + dynamic: + teleport_pos = (320, 450) teleport_zorder = 5 - else: - teleport_xpos = position_[0] - teleport_ypos = position_[1] + else: + dynamic: + teleport_pos = position_ teleport_zorder = 2 - if effect == True: + if effect: play sound "sounds/magic4.ogg" show screen whitefade with d1 @@ -142,7 +141,7 @@ label teleport(position_=None, effect=True, poof_label=None): with d1 hide screen blkfade - show screen heal_animation + show screen heal_animation(teleport_pos, teleport_zorder) with d3 #stop music fadeout 1 @@ -150,24 +149,24 @@ label teleport(position_=None, effect=True, poof_label=None): hide screen heal_animation if poof_label is not None: call expression poof_label - show screen teleport_animation + show screen teleport_animation(teleport_pos, teleport_zorder) with d5 hide screen teleport_animation with d5 - if effect == True: + if effect: pause 1 return -screen teleport_animation(): - add "teleport_ani" anchor (0.5, 0.7) xpos teleport_xpos ypos teleport_ypos zoom 0.5 - zorder teleport_zorder +screen teleport_animation(pos, zorder): + add "teleport_ani" anchor (0.5, 0.7) pos pos zoom 0.5 + zorder zorder -screen heal_animation(): - add "heal_ani" anchor (0.5, 1.0) xpos teleport_xpos ypos teleport_ypos zoom 0.5 - zorder teleport_zorder +screen heal_animation(pos, zorder): + add "heal_ani" anchor (0.5, 1.0) pos pos zoom 0.5 + zorder zorder # Dummy labels. To prevent crashes. # TODO: Remove later. default hermione_action = None