def onUpdate(self): BaseController.onUpdate(self) if self.health <= 0: Systenm.exit(0) if Keyboard.isKeyDown(Keyboard.KEY_UP) and self.a and self.shit > 0: ESG.addEntity(AIThrownShit(Point(-(self.pos.x+4), -(self.pos.y+40)), 1, Point(0, -1))) self.a = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_UP) and not self.a: self.a = True if Keyboard.isKeyDown(Keyboard.KEY_DOWN) and self.b and self.shit > 0: ESG.addEntity(AIThrownShit(Point(-(self.pos.x+4), -(self.pos.y-40)), 1, Point(0, 1))) self.b = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_DOWN) and not self.b: self.b = True if Keyboard.isKeyDown(Keyboard.KEY_RIGHT) and self.c and self.shit > 0: ESG.addEntity(AIThrownShit(Point(-(self.pos.x-20), -(self.pos.y)), 1, Point(1, 0))) self.c = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_RIGHT) and not self.c: self.c = True if Keyboard.isKeyDown(Keyboard.KEY_LEFT) and self.d and self.shit > 0: ESG.addEntity(AIThrownShit(Point(-(self.pos.x+25), -(self.pos.y)), 1, Point(-1, 0))) self.d = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_LEFT) and not self.d: self.d = True
def __init__(self, pos, speed): BaseController.__init__(self, pos, speed) self.a = True self.b = True self.c = True self.d = True self.shit = 0
def onUpdate(self): BaseController.onUpdate(self) if self.health <= 0: Systenm.exit(0) if Keyboard.isKeyDown(Keyboard.KEY_UP) and self.a and self.shit > 0: ESG.addEntity( AIThrownShit(Point(-(self.pos.x + 4), -(self.pos.y + 40)), 1, Point(0, -1))) self.a = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_UP) and not self.a: self.a = True if Keyboard.isKeyDown(Keyboard.KEY_DOWN) and self.b and self.shit > 0: ESG.addEntity( AIThrownShit(Point(-(self.pos.x + 4), -(self.pos.y - 40)), 1, Point(0, 1))) self.b = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_DOWN) and not self.b: self.b = True if Keyboard.isKeyDown(Keyboard.KEY_RIGHT) and self.c and self.shit > 0: ESG.addEntity( AIThrownShit(Point(-(self.pos.x - 20), -(self.pos.y)), 1, Point(1, 0))) self.c = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_RIGHT) and not self.c: self.c = True if Keyboard.isKeyDown(Keyboard.KEY_LEFT) and self.d and self.shit > 0: ESG.addEntity( AIThrownShit(Point(-(self.pos.x + 25), -(self.pos.y)), 1, Point(-1, 0))) self.d = False self.shit = self.shit - 1 if not Keyboard.isKeyDown(Keyboard.KEY_LEFT) and not self.d: self.d = True