generated from mwc/project_game
wip
This commit is contained in:
51
roll.py
Normal file
51
roll.py
Normal file
@@ -0,0 +1,51 @@
|
||||
from retro.game import Game
|
||||
from random import randint
|
||||
import config
|
||||
|
||||
class Die:
|
||||
#rolls a die and returns the result for display
|
||||
color = "white_on_black"
|
||||
def __init__(self, position, name):
|
||||
self.position = position
|
||||
self.name = name
|
||||
self.roll_die()
|
||||
|
||||
def __str__(self):
|
||||
return str(self.face)
|
||||
|
||||
def roll_die(self):
|
||||
self.face = randint(1, 6)
|
||||
self.character = str(self.face)
|
||||
|
||||
|
||||
class Roller:
|
||||
display = False
|
||||
|
||||
def handle_keystroke(self, keystroke, game):
|
||||
if keystroke == " ":
|
||||
|
||||
die1 = game.get_agent_by_name("die1")
|
||||
die1.roll_die()
|
||||
die2 = game.get_agent_by_name("die2")
|
||||
die2.roll_die()
|
||||
die3 = game.get_agent_by_name("die3")
|
||||
die3.roll_die()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
three_dice = [1,3,4]
|
||||
roll_score = score.RollScore().get_score(three_dice, game.state['Current Round'])
|
||||
print (roll_score)
|
||||
|
||||
if roll_score < 21:
|
||||
#is the round over?
|
||||
if game.state['Current Team'] == 1:
|
||||
#Add the score for the roll to the approriate team
|
||||
game.state['Blue Team Score'] += roll_score
|
||||
else:
|
||||
game.state['Red Team Score'] += roll_score
|
||||
else:
|
||||
game.end()"""
|
||||
Reference in New Issue
Block a user