def load(self): super().load() self.drawBoarder() self.addGameObject( GameObject(self.__titleX, self.__titleY, Image.stringToImage(self.title))) if not (isinstance(self, MainMenu)): message = "Press ESC to return" x = Game.curGame.width - len(message) - 1 y = Game.curGame.height - 1 self.addGameObject(GameObject(x, y, Image.stringToImage(message)))
def __init__(self, *options): self.__options = options self.__activeOption = 0 self.__focusedOn = True image = self.generateCurrentImage() image = Image.stringToImage(image) super().__init__(18, 15, image) self.canPause = False
def update(self): kb = Game.curGame.keyboard if (kb.keyPressed(KeyCode.w)): self.__activeOption -= 1 elif (kb.keyPressed(KeyCode.s)): self.__activeOption += 1 self.__activeOption = clamp(self.__activeOption, 0, len(self.__options)) image = self.generateCurrentImage() self.image = Image.stringToImage(image)
def update(self): scene = Game.curGame.curScene player = scene.player image = "" if isinstance(scene, level.Level): image += "Health: " + str(player.health) + "/" + str( player.maxHealth) image += " │ Gold: " + str(player.gold) + " │ Level: " + str( player.level) + "/" + str(level.Level.MAX_LEVEL) image += "\n\n" image += "Controls: W(Up/Jump) │ A(Left) │ S(Down) │ D(Right)" + "\n" image += "Enemies: Basic <<Ö │ Pusher ╠═Ö │ Digger ««ö │" + "\n" image += "Blocks: Dirt ▒▒▒ │ Gold [$] │ Stone [#] │ Bomb [3]" + "\n" image += "Pick ups: Gold $ │ Health + │ Press ESC for Pause/Menu" + "\n" image += "Instructions: Find your way to the exit while collecting gold" + "\n" image += " Moving onto blocks and enemies deals damage" + "\n" if isinstance(scene, levelEditor.LevelEditor): gameObjects = scene.getGameObjectsAtPos(player.x, player.y) gameObject = None for gO in gameObjects: if gO != player and not isinstance(gO, blocks.EditMarker): gameObject = gO if isinstance(gameObject, characters.Enemy): pass elif isinstance(gameObject, blocks.Block): pass if gameObject: image += str(gameObject) image += "\n" image += " Controls:" + "\n" image += " W) (Up) │ A) (Left) │ S) (Down) │ D) (Right)" + "\n" image += " 0) Delete │ .) [3] │ ENTER) Explode Bomb " + "\n" image += " 1) ███ │ 2) ▒▒▒ │ 3) [#] " + "\n" image += " 4) [$] │ 5) $ │ 6) + " + "\n" image += " 7) [P] │ 8) [D] │ 9) ö>> │ Press ESC for Pause/Menu" + "\n" image += "Move around and place blocks to make your own custom level" self.image = Image.stringToImage(image)
def update(self): scene = Game.curGame.curScene dt = Game.curGame.deltaTime #if(isinstance(scene, level.Level)): player = scene.player image = "" image += "Player: (" + str(player.x) + ", " + str( player.y) + ") " + "\n" image += "Delta Time: " + str(dt) + "\n" image += "Game Objects: " + str(scene.len()) + "\n" image += "Player isFalling: " + str(player.falling) + "\n" self.image = Image.stringToImage(image)
def __init__(self, x, y, health=2): image = Image.stringToImage("▓▓▓") super().__init__(x, y, image) self.health = 2 self.collision = False
def __init__(self, x, y): image = Image.stringToImage(" *") super().__init__(x, y, image)
def updateImage(self): self.image = Image.stringToImage("Name :" + self.__text)
def __init__(self, x, y, text): super().__init__(x, y) self.__text = text self.image = Image.stringToImage(text)
def __init__(self, x, y): super().__init__(x, y) self.image = Image.stringToImage("=>")
def addShape(self, x, y, char): image = Image.stringToImage(char) gO = GameObject(x, y, image) self.addGameObject(gO, 2)
def __init__(self, x, y, health = 10): image = Image.stringToImage("{") super().__init__(x, y, image, health)