def backbuffer_blit(self): if self.big == False: pic = Castle.castle_pic else: pic = Castle.bigcastle_pic common.backbuffer_blit(pic, multiply(self.pos, common.block_size))
def remote_new_house(self, pos): from field import Field if self.field[pos] == Field.EMPTY: for pl in self.players: if pl.secured[pos]: raise common.ActionNotPossible self.field[pos] = Field.HOUSE common.backbuffer_blit(Field.obstacle_pic[Field.HOUSE], multiply(pos, common.block_size)) else: raise common.ActionNotPossible
def update_screen(old_secured, foreign_walls): # get some local vars for speed block_size = common.block_size field_size = common.field_size[1] # check which parts have changed changed_fields = np.argwhere(old_secured != player.secured) for x, y in changed_fields: # the screen has changed at x, y => update the screen if not old_secured[x, y]: screen_pos = (x * block_size, y * block_size) if self[x, y] in (self.HOUSE, self.GRUNT) or foreign_walls[x, y]: self.kill_grunt_if_there_is_one((x, y)) self.blit_background((x, y)) self[x, y] = self.EMPTY common.backbuffer_blit(player.ground_pic, screen_pos) else: self.blit_background((x, y)) self.update((x, y), restart_at == None)
def backbuffer_blit(self): common.backbuffer_blit( self.static_pic, (self.pos[0] * common.block_size, self.pos[1] * common.block_size), )
def blit_background(self, pos): screen_pos = (pos[0] * common.block_size, pos[1] * common.block_size) common.backbuffer_blit(self.surface, screen_pos, screen_pos + (common.block_size, ) * 2)
def backbuffer_blit(self): assert game.field[self.pos] == Field.GRUNT common.backbuffer_blit(self.grunt_pics[self.direction], multiply(self.pos, common.block_size))