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
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)
@ -21,7 +21,7 @@ init 5 python:
if doll is None:
doll = states.dolls[name]
self.char = doll
self.poses = {}
self.poses = poses or {}
# Animation
self.anim_frames = None
@ -158,7 +158,7 @@ init 5 python:
self.pose = pose
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.atl_time = 0
@ -190,7 +190,7 @@ init 5 python:
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"""
self.atl_looping = loop
@ -368,11 +368,12 @@ init offset = 5
default hooch_chibi = DollChibi(name="hooch", doll=hooch)
# 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:
# chibi tonks register ("stand", 1, (600, 800))
# chibi tonks register ("walk", 8, (600, 800))
# "Rollback block"
# $ renpy.block_rollback()
@ -392,8 +393,6 @@ default hooch_chibi = DollChibi(name="hooch", doll=hooch)
# jump main_room_menu
# label chibitest2:
# chibi tonks register ("stand", 1, (600, 800))
# chibi tonks register ("walk", 8, (600, 800))
# "Rollback block"
# $ renpy.block_rollback()