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

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) #TODO Check and fix teleport/heal effect position (chibis are now anchored bottom-left)
label teleport(position_=None, effect=True, poof_label=None): label teleport(position_=None, effect=True, poof_label=None):
python: if position_ == "genie":
if position_ == "genie": dynamic:
teleport_xpos = genie_chibi.pos[0]+75 teleport_pos = (genie_chibi.pos[0]+75, genie_chibi.pos[1])
teleport_ypos = genie_chibi.pos[1]
teleport_zorder = 3 teleport_zorder = 3
elif position_ == "hermione": elif position_ == "hermione":
teleport_xpos = hermione_chibi.pos[0]+45 dynamic:
teleport_ypos = hermione_chibi.pos[1] teleport_pos = (hermione_chibi.pos[0]+45, hermione_chibi.pos[1])
teleport_zorder = 3 teleport_zorder = 3
elif position_ == "cho": elif position_ == "cho":
teleport_xpos = cho_chibi.pos[0]+45 dynamic:
teleport_ypos = cho_chibi.pos[1] teleport_pos = (cho_chibi.pos[0]+45, cho_chibi.pos[1])
teleport_zorder = 3 teleport_zorder = 3
elif position_ == "astoria": elif position_ == "astoria":
teleport_xpos = astoria_chibi.pos[0]+45 dynamic:
teleport_ypos = astoria_chibi.pos[1] teleport_pos = (astoria_chibi.pos[0]+45, astoria_chibi.pos[1])
teleport_zorder = 3 teleport_zorder = 3
elif position_ == "desk": elif position_ == "desk":
teleport_xpos = 320 dynamic:
teleport_ypos = 450 teleport_pos = (320, 450)
teleport_zorder = 5 teleport_zorder = 5
else: else:
teleport_xpos = position_[0] dynamic:
teleport_ypos = position_[1] teleport_pos = position_
teleport_zorder = 2 teleport_zorder = 2
if effect == True: if effect:
play sound "sounds/magic4.ogg" play sound "sounds/magic4.ogg"
show screen whitefade show screen whitefade
with d1 with d1
@ -142,7 +141,7 @@ label teleport(position_=None, effect=True, poof_label=None):
with d1 with d1
hide screen blkfade hide screen blkfade
show screen heal_animation show screen heal_animation(teleport_pos, teleport_zorder)
with d3 with d3
#stop music fadeout 1 #stop music fadeout 1
@ -150,24 +149,24 @@ label teleport(position_=None, effect=True, poof_label=None):
hide screen heal_animation hide screen heal_animation
if poof_label is not None: if poof_label is not None:
call expression poof_label call expression poof_label
show screen teleport_animation show screen teleport_animation(teleport_pos, teleport_zorder)
with d5 with d5
hide screen teleport_animation hide screen teleport_animation
with d5 with d5
if effect == True: if effect:
pause 1 pause 1
return return
screen teleport_animation(): screen teleport_animation(pos, zorder):
add "teleport_ani" anchor (0.5, 0.7) xpos teleport_xpos ypos teleport_ypos zoom 0.5 add "teleport_ani" anchor (0.5, 0.7) pos pos zoom 0.5
zorder teleport_zorder zorder zorder
screen heal_animation(): screen heal_animation(pos, zorder):
add "heal_ani" anchor (0.5, 1.0) xpos teleport_xpos ypos teleport_ypos zoom 0.5 add "heal_ani" anchor (0.5, 1.0) pos pos zoom 0.5
zorder teleport_zorder zorder zorder
# Dummy labels. To prevent crashes. # TODO: Remove later. # Dummy labels. To prevent crashes. # TODO: Remove later.
default hermione_action = None default hermione_action = None