Code: Select all
init 800 python:
class MouseParallax(renpy.Displayable):
def __init__(self,layer_info):
super(renpy.Displayable,self).__init__()
self.xoffset,self.yoffset=0.0,0.0
self.sort_layer=sorted(layer_info,reverse=True)
cflayer=[]
masteryet=False
for m,n in self.sort_layer:
if(not masteryet)and(m<41):
cflayer.append("master") <<<<=====
masteryet=True
cflayer.append(n)
if not masteryet:
cflayer.append("master") <<<<=====
cflayer.extend(["transient","screens","overlay"])
config.layers=cflayer
config.overlay_functions.append(self.overlay) <<<<=====
return
def render(self,width,height,st,at):
return renpy.Render(width,height)
def parallax(self,m):
func = renpy.curry(trans)(disp=self, m=m)
return Transform(function=func)
def overlay(self):
ui.add(self)
for m,n in self.sort_layer:
renpy.layer_at_list([self.parallax(m)],n)
return
def event(self,ev,x,y,st):
import pygame
if ev.type==pygame.MOUSEMOTION:
self.xoffset,self.yoffset=((float)(x)/(config.screen_width))-0.5,((float)(y)/(config.screen_height))-0.5
return
MouseParallax([(40,"farback"),(20,"back"),(-20,"front"),(-40,"inyourface")])
def trans(d, st, at, disp=None, m=None):
d.xoffset, d.yoffset = int(round(m*disp.xoffset)), int(round(m*disp.yoffset))
return 0
Their appearance is decided by a dress-up game, basically; that code is in the LayeredImage tutorial. If I do not display the character on the layered parallax, there is no issue; however when the character is on the 'front' layer, this error appears:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 195, in script
p_thought "oh..."
AttributeError: 'NoneType' object has no attribute 'append'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 195, in script
p_thought "oh..."
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ast.py", line 690, in execute
renpy.exports.say(who, what, *args, **kwargs)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/exports.py", line 1316, in say
who(what, *args, **kwargs)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 1131, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 842, in do_display
**display_args)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 591, in display_say
rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ui.py", line 289, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2687, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 3171, in interact_core
self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2083, in draw_screen
renpy.config.screen_height,
File "render.pyx", line 516, in renpy.display.render.render_screen
File "render.pyx", line 244, in renpy.display.render.render
File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 722, in render
surf = render(child, width, height, cst, cat)
File "render.pyx", line 151, in renpy.display.render.render
File "render.pyx", line 253, in renpy.display.render.render
AttributeError: 'NoneType' object has no attribute 'append'
Darwin-18.0.0-x86_64-i386-64bit
Ren'Py 7.2.0.424
Desruc Dolls 1.0
Thu Apr 11 20:11:33 2019