def createpill(self, pillx, pilly): """ Create pill. :param pillx: integer X position :param pilly: integer Y position :return: """ pill = Entity() pill.addartifact( SpriteArtifact(PillSprite(self.tile_size), pillx, pilly, GameState.GAME)) pill.addartifact(TagArtifact(TagType.ITEM, TagSubType.PILL)) pill.addartifact(BehaviorArtifact(PillBehavior())) self.systems[DrawSystem.NAME].register(pill) self.systems[TagSystem.NAME].register(pill) self.systems[CollisionSystem.NAME].register(pill) self.elements.append(pill)
def createcap(self, capx, capy): """ Create beer cap. :param capx: integer X position :param capy: integer Y position :return: """ cap = Entity() cap.addartifact( SpriteArtifact(CapSprite(self.tile_size), capx, capy, GameState.GAME)) cap.addartifact(TagArtifact(TagType.ITEM, TagSubType.CAP)) cap.addartifact(BehaviorArtifact(CapBehavior())) self.systems[DrawSystem.NAME].register(cap) self.systems[TagSystem.NAME].register(cap) self.systems[CollisionSystem.NAME].register(cap) self.elements.append(cap)
def createteleport(self, teleportx, teleporty): """ Create teleport. :param teleportx: integer X position :param teleporty: integer Y position :return: """ teleport = Entity() teleport.addartifact( SpriteArtifact(DummySprite(self.tile_size), teleportx, teleporty, GameState.GAME)) teleport.addartifact(TagArtifact(TagType.FIXED, TagSubType.TELEPORT)) teleport.addartifact(BehaviorArtifact(TeleportBehavior())) self.systems[DrawSystem.NAME].register(teleport) self.systems[TagSystem.NAME].register(teleport) self.systems[CollisionSystem.NAME].register(teleport) self.elements.append(teleport)
def createdrug(self, drugx, drugy): """ Create drug (powder). :param drugx: integer X position :param drugy: integer Y position :return: """ drug = Entity() drug.addartifact( SpriteArtifact(DrugSprite(self.tile_size), drugx, drugy, GameState.GAME)) drug.addartifact(TagArtifact(TagType.ITEM, TagSubType.DRUG)) drug.addartifact(BehaviorArtifact(DrugBehavior())) self.systems[DrawSystem.NAME].register(drug) self.systems[TagSystem.NAME].register(drug) self.systems[CollisionSystem.NAME].register(drug) self.elements.append(drug)
def createbait(self, baitx, baity): """ Create bait for cops. :param baitx: integer X position :param baity: integer Y position :return: nothing """ bait = Entity() bait.addartifact( SpriteArtifact(BaitSprite(self.tile_size), baitx, baity, GameState.GAME)) bait.addartifact(TagArtifact(TagType.ITEM, TagSubType.BAIT)) bait.addartifact(BehaviorArtifact(BaitBehavior())) self.systems[DrawSystem.NAME].register(bait) self.systems[TagSystem.NAME].register(bait) self.systems[CollisionSystem.NAME].register(bait) self.elements.append(bait)
def createbeer(self, beerx, beery): """ Create bottle of beer. :param beerx: integer X position :param beery: integer Y position :return: nothing """ beer = Entity() beer.addartifact( SpriteArtifact(BeerSprite(self.tile_size), beerx, beery, GameState.GAME)) beer.addartifact(TagArtifact(TagType.ITEM, TagSubType.BEER)) beer.addartifact(BehaviorArtifact(BeerBehavior())) self.systems[DrawSystem.NAME].register(beer) self.systems[TagSystem.NAME].register(beer) self.systems[CollisionSystem.NAME].register(beer) self.elements.append(beer)
def createsupercop(self, supercopx, supercopy): """ Create super cop. :param supercopx: integer X position :param supercopy: integer Y position :return: """ cop = Entity() cop.addartifact( SpriteArtifact(CopSprite(self.tile_size), supercopx, supercopy, GameState.GAME)) cop.addartifact(MovementArtifact(1.25)) cop.addartifact(TagArtifact(TagType.ENEMY, TagSubType.SUPER_COP)) cop.addartifact(BehaviorArtifact(SimpleCopBehavior())) self.systems[AiMovementSystem.NAME].register(cop) self.systems[DrawSystem.NAME].register(cop) self.systems[TagSystem.NAME].register(cop) self.systems[CollisionSystem.NAME].register(cop) self.elements.append(cop)
def createkomesman(self, komesx, komesy): """ Create our hero - KomesMan. :param komesx: integer X position :param komesy: integer Y position :return: nothing """ komes_man = Entity() komes_man.addartifact( SpriteArtifact(KomesManSprite(self.tile_size), komesx, komesy, GameState.GAME)) komes_man.addartifact(MovementArtifact()) komes_man.addartifact(TagArtifact(TagType.KOMESMAN)) komes_man.addartifact(BehaviorArtifact(KomesManBehavior())) self.systems[TagSystem.NAME].register(komes_man) self.systems[UserMovementSystem.NAME].register(komes_man) self.systems[DrawSystem.NAME].register(komes_man) self.systems[CollisionSystem.NAME].register(komes_man) self.elements.append(komes_man)