Browse Source

Set title, only show sub name when picking team

master
bertieb 3 years ago
committed by Rob Hallam
parent
commit
dc53f6cca7
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      teampicker.py

+ 10
- 1
teampicker.py View File

@@ -41,6 +41,7 @@ RED = (186, 20, 31)
PURPLE = (121, 35, 158) PURPLE = (121, 35, 158)


screen = pygame.display.set_mode(SIZE) screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption("Sub Crown Nov 2020 Team Picker")


# Set up team text positioning references # Set up team text positioning references
# #
@@ -108,12 +109,14 @@ class Sub(object):


def __init__(self, sub): def __init__(self, sub):
self.sub = sub self.sub = sub
self._sub = ""
self.team = "" self.team = ""
self.x = 20 self.x = 20
self.y = 0 self.y = 0


def draw(self): def draw(self):
draw_text(self.sub, SUBFONT, BLUE, self.x, self.y)
if self._sub != "":
draw_text(self.sub, SUBFONT, BLUE, self.x, self.y)
if self.team != "": if self.team != "":
draw_text(self.team, SUBFONT, PURPLE, draw_text(self.team, SUBFONT, PURPLE,
self.x, int(self.y+SUBFONTHEIGHT)) self.x, int(self.y+SUBFONTHEIGHT))
@@ -200,6 +203,12 @@ while True:
if sub.team == "": if sub.team == "":
sub.team = TEAMS.pop().team sub.team = TEAMS.pop().team
elif event.key == 32: elif event.key == 32:
# Display who we're choosing for
for sub in SUBS:
if sub._sub == "":
sub._sub = sub.sub
break
# Start the "who's it going to pick?" animation
pygame.time.set_timer(HIGHLIGHTEVENT, 100) # every 100ms pygame.time.set_timer(HIGHLIGHTEVENT, 100) # every 100ms
print(event.key) print(event.key)
elif event.type == HIGHLIGHTEVENT: elif event.type == HIGHLIGHTEVENT:


Loading…
Cancel
Save