Simplify and make dynamic teleport and heal animations

This commit is contained in:
Gouvernathor 2024-04-01 22:47:43 +02:00
parent e40b966a0f
commit 5c7bbfcc85
1 changed files with 28 additions and 29 deletions

View File

@ -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