Cbibis
* Implement animation pause intervals for the new chibi class * Fix static animations not playing due to a timeout.
This commit is contained in:
parent
587425723e
commit
07489362c8
@ -1,7 +1,7 @@
|
|||||||
init 5 python:
|
init 5 python:
|
||||||
class DollChibi(renpy.Displayable):
|
class DollChibi(renpy.Displayable):
|
||||||
|
|
||||||
def __init__(self, name, layer="screens", zorder=12, zoom=0.28, **properties):
|
def __init__(self, name, layer="screens", zorder=12, zoom=0.5, **properties):
|
||||||
|
|
||||||
super().__init__(**properties)
|
super().__init__(**properties)
|
||||||
|
|
||||||
@ -35,8 +35,8 @@ init 5 python:
|
|||||||
self.atl_pause = False
|
self.atl_pause = False
|
||||||
self.atl_at_list = []
|
self.atl_at_list = []
|
||||||
|
|
||||||
def register(self, pose, frames, size):
|
def register(self, pose, frames, size, pause=0):
|
||||||
self.poses[pose] = (frames, size)
|
self.poses[pose] = (frames, size, pause)
|
||||||
|
|
||||||
if config.developer:
|
if config.developer:
|
||||||
print(f"Registered \"{pose}\" pose for {self.name}")
|
print(f"Registered \"{pose}\" pose for {self.name}")
|
||||||
@ -75,12 +75,12 @@ init 5 python:
|
|||||||
return Fixed(*sprites, fit_first=True)
|
return Fixed(*sprites, fit_first=True)
|
||||||
|
|
||||||
def build_animation(self):
|
def build_animation(self):
|
||||||
|
frames, _, pause = self.poses[self.pose]
|
||||||
pose = self.pose
|
pose = self.pose
|
||||||
frames = self.poses[pose][0]
|
|
||||||
sprite = self.build_image(self.char._hash, pose)
|
sprite = self.build_image(self.char._hash, pose)
|
||||||
|
|
||||||
if frames > 1:
|
if frames > 1:
|
||||||
interval = self.anim_speed / self.anim_fps
|
interval = self.anim_speed / self.anim_fps + pause
|
||||||
else:
|
else:
|
||||||
interval = (365.25 * 86400.0) # About one year
|
interval = (365.25 * 86400.0) # About one year
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ init 5 python:
|
|||||||
self.anim_sprite = sprite
|
self.anim_sprite = sprite
|
||||||
|
|
||||||
def render(self, width, height, st, at):
|
def render(self, width, height, st, at):
|
||||||
frame_width, frame_height = self.poses[self.pose][1]
|
frames, (frame_width, frame_height), _ = self.poses[self.pose]
|
||||||
|
|
||||||
# Calculate the current frame based on the time
|
# Calculate the current frame based on the time
|
||||||
trans = self.anim_trans
|
trans = self.anim_trans
|
||||||
@ -115,7 +115,8 @@ init 5 python:
|
|||||||
rv = renpy.Render(frame_width, frame_height)
|
rv = renpy.Render(frame_width, frame_height)
|
||||||
rv.blit(cr.subsurface((frame_x, frame_y, frame_width, frame_height)), (0, 0))
|
rv.blit(cr.subsurface((frame_x, frame_y, frame_width, frame_height)), (0, 0))
|
||||||
|
|
||||||
if not self.atl_looping and st > self.atl_time_total:
|
# Freeze render if there's only one frame.
|
||||||
|
if frames < 2 and not self.atl_looping and st > self.atl_time_total:
|
||||||
renpy.timeout(0)
|
renpy.timeout(0)
|
||||||
elif not renpy.game.less_updates:
|
elif not renpy.game.less_updates:
|
||||||
renpy.redraw(self, interval - time)
|
renpy.redraw(self, interval - time)
|
||||||
|
Loading…
Reference in New Issue
Block a user