马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
在同时使用鼠标视差功能和摄像机功能时遇到了冲突,发现是:
鼠标视差的:config.layers=cflayer 和摄像机功能的 config.layers = ['master', 'background', 'middle', 'forward', 'transient', 'screens', 'overlay'] 起了冲突,请问有什么两全其美的方法吗?
本人艺术生来的,编程真的一窍不通。。。大佬们救救!!!
以下是鼠标视差功能的内容;摄像机的文本太长就不发上来了。
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<0):
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))-1.0
return
def trans(d, st, at, disp=None, m=None):
d.xoffset, d.yoffset = int(round(m*disp.xoffset)), int(round(m*disp.yoffset))
if persistent.bg_parallax is False:
d.xoffset, d.yoffset=0,0
return 0
#MouseParallax([(2000,"background"),(0,"middle"),(0,"forward"),(0,"transient"),(0,"screens"),(0,"overlay")])
MouseParallax([(-15,"farthestBack"),(-40,"farBack"),(-70,"back"),(-30,"front"),(50,"inyourface")])
config.tag_layer = {
'effects': 'back', # particle effects etc.
'formovie': 'farBack',
'sprite': 'front',
'bg' : 'farthestBack'
}
|