init python:
class panBackground(renpy.Displayable):
def __init__(self, background, xSpeed=10, ySpeed=10, **kwargs):
super(panBackground, self).__init__(**kwargs)
(x, y) = renpy.image_size( background )
self.xLimit = x - config.screen_width
self.yLimit = y - config.screen_height
self.bg = renpy.displayable( background )
self.xSpeed = xSpeed
self.ySpeed = ySpeed
def event(self, ev, x, y, st):
if x < 0 or y < 0: return None
if x < 100: store.panScreenX = 0 if panScreenX < self.xSpeed else panScreenX - self.xSpeed
elif x > config.screen_width - 100: store.panScreenX = self.xLimit if panScreenX > self.xLimit - self.xSpeed else panScreenX + self.xSpeed
if y < 100: store.panScreenY = 0 if panScreenY < self.ySpeed else panScreenY - self.ySpeed
elif y > config.screen_height - 100: store.panScreenY = self.yLimit if panScreenY > self.yLimit - self.ySpeed else panScreenY + self.ySpeed
renpy.restart_interaction()
renpy.redraw(self, 0)
def render(self, width, height, st, at):
rv = renpy.Render(width, height)
rv.blit( renpy.render(Crop( (panScreenX, panScreenY, config.screen_width, config.screen_height), self.bg ), width, height, st, at), (0, 0))
return rv
default panScreenX = 0
default panScreenY = 0
screen panBackground( background ):
add panBackground( background, xSpeed=5, ySpeed=5 )
label start:
show screen panBackground( "images/wide.jpg" )
"And here you put the dialogs, or whatever you want"