Compare commits

..

2 Commits

Author SHA1 Message Date
0d8e91b5a5 Stop using mutable default values for parameters 2024-04-05 23:21:20 +02:00
314f971609 Allow poses to be passed to the constructor, and update test script
One problem : it still should not go into a defaulted object
2024-04-05 23:21:01 +02:00

View File

@ -4,7 +4,7 @@ init 5 python:
# class attribute # class attribute
instances = {} instances = {}
def __init__(self, name, layer="screens", zorder=12, zoom=0.28, doll=None, **properties): def __init__(self, name, layer="screens", zorder=12, zoom=0.28, doll=None, poses=None, **properties):
super().__init__(**properties) super().__init__(**properties)
@ -21,7 +21,7 @@ init 5 python:
if doll is None: if doll is None:
doll = states.dolls[name] doll = states.dolls[name]
self.char = doll self.char = doll
self.poses = {} self.poses = poses or {}
# Animation # Animation
self.anim_frames = None self.anim_frames = None
@ -158,7 +158,7 @@ init 5 python:
self.pose = pose self.pose = pose
self.update() self.update()
def place(self, pos=None, speed=1.0, pause=False, at_list=[], pose=None, xzoom=None): def place(self, pos=None, speed=1.0, pause=False, at_list=(), pose=None, xzoom=None):
self.set_pose(pose or self.idle) self.set_pose(pose or self.idle)
self.atl_time = 0 self.atl_time = 0
@ -190,7 +190,7 @@ init 5 python:
return return
def move(self, path, speed=1.0, pause=True, loop=False, warper="linear", at_list=[], pose=None, repeat=None, wrap=True, reverse=True): def move(self, path, speed=1.0, pause=True, loop=False, warper="linear", at_list=(), pose=None, repeat=None, wrap=True, reverse=True):
"""Makes chibi move""" """Makes chibi move"""
self.atl_looping = loop self.atl_looping = loop
@ -368,11 +368,12 @@ init offset = 5
default hooch_chibi = DollChibi(name="hooch", doll=hooch) default hooch_chibi = DollChibi(name="hooch", doll=hooch)
# default cho_chibi_new = DollChibi(name="cho", doll=cho) # default cho_chibi_new = DollChibi(name="cho", doll=cho)
# default tonks_chibi_new = DollChibi(name="tonks", doll=tonks) # default tonks_chibi_new = DollChibi(name="tonks", doll=tonks, poses=dict(
# stand=(1, (600, 800)),
# walk=(8, (600, 800)),
# ))
# label chibitest: # label chibitest:
# chibi tonks register ("stand", 1, (600, 800))
# chibi tonks register ("walk", 8, (600, 800))
# "Rollback block" # "Rollback block"
# $ renpy.block_rollback() # $ renpy.block_rollback()
@ -392,8 +393,6 @@ default hooch_chibi = DollChibi(name="hooch", doll=hooch)
# jump main_room_menu # jump main_room_menu
# label chibitest2: # label chibitest2:
# chibi tonks register ("stand", 1, (600, 800))
# chibi tonks register ("walk", 8, (600, 800))
# "Rollback block" # "Rollback block"
# $ renpy.block_rollback() # $ renpy.block_rollback()