WTS/game/scripts/characters/snape/common.rpy
LoafyLemon 914f03fa73 Bug fixes and improvements
* Simplified and restructured plug events for Hermione
* Fixed Snape's sprite flickering
* Fixed requirements check for EventQueue class
* Adjusted label names for item-related quests
2022-05-19 16:44:36 +01:00

73 lines
2.5 KiB
Plaintext

label update_snape:
$ snape_flip = 1
return
define character.snape_say = Character("Severus Snape", show_icon="snape")
init python:
def sna(what, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, wand=False, **kwargs):
global snape_xpos, snape_ypos, snape_face, snape_animation, snape_zorder, snape_flip, snape_zoom
redraw = False
tag = "snape_main"
layer = "screens"
#showing = renpy.showing(name=tag, layer=layer)
if xpos != None or ypos != None:
xpos = snape_xpos if xpos == None else sprite_pos.get("x").get(xpos, xpos)
ypos = snape_ypos if ypos == None else sprite_pos.get("y").get(ypos, ypos)
snape_xpos = xpos
snape_ypos = ypos
redraw = True
head_ypos = sprite_pos.get("y").get("head")
head_only = snape_ypos == head_ypos
# The easiest way to fix image positions for Snape is to use offsets.
# It's not ideal, but it's better than having to change all calls manually.
if snape_ypos in ("head", head_ypos):
xoffset = -25
yoffset = 150
else:
xoffset = -50
yoffset = 0
if face:
snape_face = face
redraw = True
if animation != False:
if isinstance(animation, list):
snape_animation = animation
else:
snape_animation = [animation]
redraw = True
if flip != None:
snape_flip = -1 if flip else 1
redraw = True
if redraw:
base_transform = doll_transform((snape_xpos + xoffset, snape_ypos + yoffset), snape_zoom, snape_flip)
sprite = Image("characters/snape/main/"+snape_face+".webp")
if wand:
sprite = Fixed(sprite, "characters/snape/main/wand.webp")
renpy.show(name=tag, at_list=[base_transform] + snape_animation, layer=layer, what=sprite, zorder=snape_zorder)
if not renpy.in_rollback():
if trans:
renpy.with_statement(trans)
else:
renpy.with_statement(d2)
if what:
character.snape_say(what, **kwargs)
if head_only:
renpy.hide(name=tag, layer=layer)
screen snape_picture_frame():
add "characters/snape/main/picture_frame.webp" xpos snape_xpos ypos snape_ypos xzoom snape_flip zoom 0.5
zorder snape_zorder+1