Ejemplo n.º 1
0
 def render(self,p,screen):
     screenrect=screen.get_rect()
     sh,sw=screenrect.h,screenrect.w
     awscale=scales[self.wscale]
     aiscale=scales[self.invscale]
     riscale=self.invscale+1
     m=(sw/float(awscale)+1)/2.0
     rm=int(ceil(m))
     wconvmult=awscale/64.0
     if not (p.shop or (p.dead and not p.dt)):
         asx=p.x*awscale+ir(p.xoff)*wconvmult-(m-1)*awscale
         asy=p.y*awscale+ir(p.yoff)*wconvmult-(m-1)*awscale-aiscale
         r=(p.rumbling-1)//10+1
         rx=randint(-r,r)
         ry=randint(-r,r)
         sx=p.x
         sy=p.y
         for y in range(sy-rm-1,sy+rm+1):
             for x in range(sx-rm-1,sx+rm+1):
                 screen.blit(Tiles.tiles[self.get_t(x,y)].get_img()[self.wscale],(x*awscale-asx+rx,y*awscale-asy+ry))
         for y in range(sy-rm-1,sy+rm+1):
             for x in range(sx-rm-1,sx+rm+1):
                 objs=self.get_os(x,y)
                 for o in objs:
                     if not o.is_hidden(self,p):
                         screen.blit(o.get_img(self)[self.wscale],(x*awscale+ir(o.xoff)*wconvmult-asx+rx,y*awscale+ir(o.yoff)*wconvmult-asy-o.o3d*(self.wscale+1)+ry))
         pygame.draw.rect(screen,(200,200,200),pygame.Rect(0,0,sw,aiscale))
         for n,i in enumerate(p.iinv.inv if p.iinv else p.inv):
             screen.blit(i.get_img(p,self)[self.invscale],(n*aiscale,0))
             if i.stack>1:
                 screen.blit(numerals[i.stack-2][self.invscale],(n*aiscale+(11 if i.stack<10 else 9)*(self.invscale+1),36))
             if n==p.isel:
                 pygame.draw.rect(screen,p.col,pygame.Rect(n*aiscale,15*riscale,aiscale,riscale))
         if p.statuseffects:
             maxt=max([se[1] for se in p.statuseffects])
             maxse=[se for se in p.statuseffects if se[1]==maxt][0]
             pygame.draw.rect(screen,p.col,pygame.Rect(0,sh-9,maxt*sw//Players.etimes[maxse[0]],12))
     elif p.shop:
         screen.fill((150,150,150))
         pygame.draw.rect(screen,(200,200,200),pygame.Rect(0,0,sw,64))
         Img.bcentrex(bcfont,p.shop.title,screen,-16)
         for n,i in enumerate(p.shop.items):
             Img.cxblit(i[0].img[self.invscale],screen,n*aiscale+aiscale,-8*riscale)
             Img.bcentrex(cashfont,str(i[1]),screen,n*aiscale+aiscale,(255,255,0),8*riscale)
         screen.blit(p.simg[self.invscale],(0,p.ssel*aiscale+aiscale))
     else:
         p.dead.render(screen)
     Img.bcentrex(cashfont,str(p.cash),screen,sh-48,(255,255,0))
     pygame.draw.rect(screen,p.col,pygame.Rect(0,0,sw,sh),2)