def enter(self, app): self.app = app self.view = app.view self.palette = [ ] for name in get_all('entities'): newtype = entities.get(name) self.palette.append(newtype) self.level = Level(app) self.mode = 't' self.mark = None self.delmark = None self.markmat = entities.get('mark') self.ground = entities.get('ground') print "CURRENT BRUSH:", self.brush
def enter(self, app): self.app = app self.view = app.view self.palette = [] for name in get_all('entities'): newtype = entities.get(name) self.palette.append(newtype) self.level = Level(app) self.mode = 't' self.mark = None self.delmark = None self.markmat = entities.get('mark') self.ground = entities.get('ground') print "CURRENT BRUSH:", self.brush
def do_move(self, game, dx, dy): if self.coord_in_bounds(game, dx, dy): blocker = self.thing_at_dest(game, dx, dy) if blocker: if blocker.type == 'guard': game.remove(self) game.remove(blocker) game.add(get('key')(dx, dy)) super(KeyGuard, self).do_move(game, dx, dy)
def do_move(self, game, dx, dy): if self.coord_in_bounds(game, dx, dy): blocker = self.thing_at_dest(game, dx, dy) if blocker: if blocker.type in ['player', 'invis']: self.x = dx self.y = dy blocker.touched(game, self) elif blocker.type == 'guard': game.remove(blocker) game.add(get('scrap')(dx, dy)) self.checkfinish(game) self.stun += 2 elif not blocker.block: self.x = dx self.y = dy else: self.x = dx self.y = dy
def checkfinish(self, game): self.hp -= 1 if self.hp == 0: remove = [] for ent in game.level.entities: if ent.type == 'guard': remove.append(ent) game.add(get('scrap')(ent.x, ent.y)) elif ent.name in ['electricity', 'guardgenerator']: remove.append(ent) for ent in remove: game.level.entities.remove(ent) remove = [] for tile in game.level.tiles: if tile.type == 'electricity': remove.append(tile) for tile in remove: game.level.tiles.remove(tile) game.remove(self) game.set_frame(42, 5, "Defeating Screwloose has disabled the Master-Key security!", "Success!")
def checkfinish(self, game): self.hp -= 1 if self.hp == 0: remove = [] for ent in game.level.entities: if ent.type == 'guard': remove.append(ent) game.add(get('scrap')(ent.x, ent.y)) elif ent.name in ['electricity', 'guardgenerator']: remove.append(ent) for ent in remove: game.level.entities.remove(ent) remove = [] for tile in game.level.tiles: if tile.type == 'electricity': remove.append(tile) for tile in remove: game.level.tiles.remove(tile) game.remove(self) game.set_frame( 42, 5, "Defeating Screwloose has disabled the Master-Key security!", "Success!")
def touched(self, game, ent): if ent.name == 'robotguard': game.remove(ent) game.remove(self) game.add(get('scrap')(self.x, self.y))
def touched(self, game, ent): if ent.type == 'guard': game.remove(ent) game.remove(self) game.add(get('key')(self.x, self.y))
def touched(self, game, ent): if ent.type == 'guard': game.remove(ent) game.add(get('scrap')(self.x, self.y)) self.checkfinish(game) self.stun += 2