def all(self): self.inventory.append(items.DebugStick()) self.inventory.append(items.Daggers()) self.inventory.append(items.SoulKnife()) self.inventory.append(items.Cutlass()) self.inventory.append(items.Apple()) self.inventory.append(items.HealingPotion()) self.inventory.append(items.Porkchop()) self.inventory.append(items.Apple()) self.inventory.append(items.HealingPotion()) self.inventory.append(items.Porkchop()) self.emerald = self.emerald + 999999999 self.maxhp = 10000000 self.hp = self.maxhp self.player_level = 1000 self.enchantment_points = 9999 print("----------Inventory----------") print("Player Level {}".format(self.player_level)) print("") print("Max Hp: {}".format(self.maxhp)) print("") print("Inventory:") for item in self.inventory: print('* ' + str(item)) print("") print("Emeralds: {}".format(self.emerald)) print("") print("Enchantment Points: {}".format(self.enchantment_points)) print("")
def __init__(self): self.name = "Trader" self.emerald = 100 self.inventory = [items.Apple(), items.Apple(), items.Apple(), items.HealingPotion(), items.HealingPotion()]
def update_inventory(self, Apple_amt, Bread_amt, Water_amt): self.inventory = [ items.Apple(Apple_amt), items.Bread(Bread_amt), items.Water(Water_amt), items.Sword() ]
def __init__(self): self.inventory = [items.Rock(), 'Gold(5)', items.Apple()] self.x = 1 self.y = 2 self.hp = 100 self.cash = 15 self.victory = False
def reset_stats(self): self.inventory = [ items.Apple(5), items.Bread(2), items.Water(3), items.Sword() ] self.hp = 100 self.stamina = 50 self.glory = 0 self.glory_statement = "=======================\nYou failed. History will forget you"
def __init__(self): self.inventory = [items.Sword(), items.Apple()] self.x = world.start_tile_location[0] self.y = world.start_tile_location[1] self.enchantment_points = 1 self.player_level = 1 self.maxhp = 100 self.hp = self.maxhp self.emerald = 25 self.victory = False self.bufferSize = 64 * 1024 self.passwordtxt = ''.join((random.choice( 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()' ) for i in range(20)))
class FireElement(MapTile): items = [items.Apple("Collect apples if you come across them. You will need a minimum number of apples to earn the healing power of mother nature")] description = """You have entered the fire element! Don't get burt!"""
def mainLoop(game, playerControls): mapPosition = [0, 0] wall = engine.Carte(os.path.join("assets", "levels", str(mapPosition)), mode="load") # objet carte back = wall.renderSurface() # surface carte # coolframe = 0 px = wall.playerPosition[0] * wall.tileSize py = wall.playerPosition[1] * wall.tileSize ratio = game.resolution[0] / game.targetResolution[0] p1 = entities.Player(px, py, "1", wall, ratio) # joueur p1.direction = [0, 0, 0, 0] p1.keyConfig = playerControls events = [] p1.inventory.additem(items.Apple(12), 0) p1.inventory.additem(items.Apple(34), 1) p1.inventory.additem(items.PlasmaPickaxaxe(1), -1) while game.state == 1 or game.state == 2: # en jeu ou dans le menu pause if game.state == 1: pevents = events """ if p1.rect.x < 0 and p1.rect.y < 0 and p1.rect.x > wall.width and p1.rect.y > wall.height or coolframe > 0: coolframe -= 1 pevents = [] """ rects = wall.get_rects() p1.update(rects, wall.entities, pevents, wall.setNum) elif game.state == 2: p1.direction = [0, 0, 0, 0] game.screen.blit(back, (0, 0)) p1.render(game.screen) game.waitFramerate() if p1.rect.x < -wall.tileSize * (4 / 8): wall = changeMap(mapPosition, p1, -1, 0) back = wall.renderSurface() if p1.rect.y < -wall.tileSize * (4 / 8): wall = changeMap(mapPosition, p1, 0, -1) back = wall.renderSurface() if p1.rect.x > wall.width - wall.tileSize * (4 / 8): wall = changeMap(mapPosition, p1, +1, 0) back = wall.renderSurface() if p1.rect.y > wall.height - wall.tileSize * (4 / 8): wall = changeMap(mapPosition, p1, 0, +1) back = wall.renderSurface() events = game.runEvents() # en fin de boucle pour éviter les conflicts if p1.life <= 0: game.state = 0 return -1 entitiesL = wall.entities i = 0 for entity in entitiesL: if entity.life <= 0: del wall.entities[i] back = wall.renderSurface() i += 1
import items player_inventory = [ items.Rock(), items.WoodenShield(), items.Dagger(), items.Fist(), items.CrustyBread(), items.CrustyBread(), items.Apple(), items.StickWand() ] def get_inventory(): return player_inventory def get_player_inventory(item): player_inventory.append(item)