generated from mwc/project_game
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
#This is the Treasure class where the Player gets 10 points for each treasure found.
|
|
# The game ends once the player has found all the treasures scoring 60 points before losing 3 lives.
|
|
|
|
|
|
class Treasure:
|
|
character = '█'
|
|
color = 'black'
|
|
passable = True
|
|
|
|
@classmethod
|
|
def treasure(cls, origin, height):
|
|
agents = []
|
|
x, y = origin
|
|
for dx in range(height):
|
|
treasure = Treasure(x + dx, y)
|
|
agents.append(treasure)
|
|
return agents
|
|
|
|
def __init__(self, position, score, message):
|
|
self.position = position
|
|
self.score = score
|
|
self.message = message
|
|
|
|
def collided_with_player(self, player, game):
|
|
game.state["score"] += 10
|
|
game.remove_agent(self)
|
|
player.color = "red_on_chartreuse2"
|
|
game.state['message'] = self.message
|
|
|
|
def collided_with_player(self, player, game):
|
|
game.state["score"] += 10
|
|
game.remove_agent(self)
|
|
player.color = "red_on_chartreuse2"
|
|
game.state['message'] = self.message
|
|
if game.state["score"] >= 60:
|
|
game.state['message'] = "You Win Expert Treasure Hunter!"
|
|
game.end()
|
|
|
|
|
|
"""At final score, how do I add, 0-30 Beginner, 30-50 Novice, 60 Expert?"""
|