"""Square tile based engine.""" from pgu.vid import * import pygame class Tilevid(Vid): """Based on [[vid]] -- see for reference.""" def paint(self,s): sw,sh = s.get_width(),s.get_height() self.view.w,self.view.h = sw,sh tiles = self.tiles tw,th = tiles[0].image.get_width(),tiles[0].image.get_height() w,h = self.size if self.bounds != None: self.view.clamp_ip(self.bounds) ox,oy = self.view.x,self.view.y tlayer = self.tlayer blayer = self.blayer alayer = self.alayer sprites = self.sprites blit = s.blit yy = - (self.view.y%th) my = (oy+sh)/th if (oy+sh)%th: my += 1 if blayer != None: for y in xrange(oy/th,my): if y >=0 and y < h: trow = tlayer[y] brow = blayer[y] arow = alayer[y] xx= - (self.view.x%tw) mx = (ox+sw)/tw #if (ox+sh)%tw: mx += 1 for x in xrange(ox/tw,mx+1): if x >=0and x=0 and y=0 and x