Code: Select all
image mapVision=DynamicDisplayable(show_map)
init python:
def show_map(st, at):
if map_centre==None:
return Solid("#000"), None
else:
return MapDisplayable(map, map_centre), None
class MapDisplayable(renpy.Displayable):
def __init__(self, map, xypair, **kwargs):
super(MapDisplayable,self).__init__(**kwargs)
self.map=map
self.centre=xypair
self.children=[]
self.width=11*48 # the tile grid fits within an 11x11 square of tiles, tiles are 48px square
self.height=11*48
def per_interact(self):
self.children= (something quite complicated omitted for brevity)
renpy.redraw(self,0)
def render(self, width, height, at, st):
render=renpy.Render(self.width,self.height)
for ii in range(len(self.children)):
render.blit(renpy.render(self.children[ii], self.children[ii].size, self.children[ii].size, st, at), (MapDisplayable.visible[ii][0]*48-24,MapDisplayable.visible[ii][1]*48-24)) # MapDisplayable.visible is an array of tuples that defines the offsets for the tiles to show
return render
def visit(self):
return self.children
label start:
$ map_centre=(3,3)
show mapVision at truecenter
"Start."