|
|
|
@ -27,7 +27,6 @@ from pygame.mixer import Sound
|
|
|
|
|
from pygame.image import load, fromstring
|
|
|
|
|
from pygame.transform import rotate, flip, scale, smoothscale
|
|
|
|
|
from pygame.time import get_ticks
|
|
|
|
|
from pygame.font import Font
|
|
|
|
|
from pygame.draw import aalines, lines
|
|
|
|
|
from pygame.gfxdraw import aapolygon, arc, polygon, aaellipse, ellipse, filled_ellipse, filled_circle
|
|
|
|
|
from pygame.locals import *
|
|
|
|
@ -191,7 +190,7 @@ class NS(Game, Animation):
|
|
|
|
|
},
|
|
|
|
|
"input":
|
|
|
|
|
{
|
|
|
|
|
"bool": "serial"
|
|
|
|
|
"bool": ["serial", "pi"]
|
|
|
|
|
},
|
|
|
|
|
"display":
|
|
|
|
|
{
|
|
|
|
@ -243,9 +242,10 @@ class NS(Game, Animation):
|
|
|
|
|
# Initialize GPIO interface
|
|
|
|
|
gpio.initialize_gpio()
|
|
|
|
|
|
|
|
|
|
# Launch a separate thread for reading the GPIO (and allowing its custom delays/sleeps)
|
|
|
|
|
# Launch a separate thread for reading the GPIO (and allowing its custom delays/sleeps). Use the daemon flag to force
|
|
|
|
|
# exit when the main thread is killed (by a sigterm from systemctl stop) (?).
|
|
|
|
|
self.gpio_kill = False
|
|
|
|
|
self.gpio_thread = Thread(target=self.read_gpio)
|
|
|
|
|
self.gpio_thread = Thread(target=self.read_gpio, daemon=True)
|
|
|
|
|
self.gpio_thread.start()
|
|
|
|
|
|
|
|
|
|
# init Arduino
|
|
|
|
@ -1114,7 +1114,7 @@ class Title(Animation):
|
|
|
|
|
if ii == 0 or ii == 8:
|
|
|
|
|
y = 20
|
|
|
|
|
|
|
|
|
|
font = Font(self.get_resource(Dialogue.FONT_PATH), 18)
|
|
|
|
|
font = pygame.font.Font(self.get_resource(Dialogue.FONT_PATH), 18)
|
|
|
|
|
|
|
|
|
|
# Parse both strings and score objects
|
|
|
|
|
if isinstance(entry, NS.Score):
|
|
|
|
@ -1269,7 +1269,7 @@ class Dialogue(Animation):
|
|
|
|
|
self.avatar.location.center = self.avatar_box.location.center
|
|
|
|
|
|
|
|
|
|
def set_name(self, text):
|
|
|
|
|
font = Font(self.get_resource(self.FONT_PATH), self.FONT_SIZE)
|
|
|
|
|
font = pygame.font.Font(self.get_resource(self.FONT_PATH), self.FONT_SIZE)
|
|
|
|
|
self.name = Sprite(self)
|
|
|
|
|
self.name.add_frame(font.render(text, True, self.TEXT_COLOR).convert_alpha())
|
|
|
|
|
self.name.location.midleft = self.name_box.location.left + 5, self.name_box.location.centery
|
|
|
|
@ -1298,7 +1298,7 @@ class Dialogue(Animation):
|
|
|
|
|
self.name_box.update()
|
|
|
|
|
self.name.update()
|
|
|
|
|
self.text_box.update()
|
|
|
|
|
font = Font(self.get_resource(self.FONT_PATH), self.FONT_SIZE)
|
|
|
|
|
font = pygame.font.Font(self.get_resource(self.FONT_PATH), self.FONT_SIZE)
|
|
|
|
|
message = Sprite(self)
|
|
|
|
|
lines = self.full_text[:self.text_index].split("\n")
|
|
|
|
|
frame = Surface((self.text_box.location.w - 10, 30 * len(lines)), SRCALPHA)
|
|
|
|
@ -1330,7 +1330,7 @@ class SkipPrompt(GameChild):
|
|
|
|
|
self.buttons[-1].location.centery)
|
|
|
|
|
left += self.buttons[-1].location.width + AdvancePrompt.BUTTON_SPACING
|
|
|
|
|
self.text = Sprite(self)
|
|
|
|
|
font = Font(self.get_resource(Dialogue.FONT_PATH), 18)
|
|
|
|
|
font = pygame.font.Font(self.get_resource(Dialogue.FONT_PATH), 18)
|
|
|
|
|
self.text.add_frame(font.render("TO SKIP", True, (0, 0, 0)).convert_alpha())
|
|
|
|
|
self.text.location.midleft = (
|
|
|
|
|
self.buttons[2].location.right + 5,
|
|
|
|
@ -2807,7 +2807,7 @@ class Countdown(GameChild):
|
|
|
|
|
def __init__(self, parent):
|
|
|
|
|
GameChild.__init__(self, parent)
|
|
|
|
|
dsr = self.get_display_surface().get_rect()
|
|
|
|
|
font = Font(self.get_resource(Dialogue.FONT_PATH), 76)
|
|
|
|
|
font = pygame.font.Font(self.get_resource(Dialogue.FONT_PATH), 76)
|
|
|
|
|
self.heading = Sprite(self)
|
|
|
|
|
self.heading.add_frame(font.render("CONTINUE?", True, (0, 0, 0), (255, 255, 255)).convert_alpha())
|
|
|
|
|
self.heading.location.midtop = dsr.centerx, 50
|
|
|
|
@ -3141,8 +3141,8 @@ class Ending(Animation):
|
|
|
|
|
Animation.__init__(self, parent)
|
|
|
|
|
self.slime_bag = Chemtrails(self)
|
|
|
|
|
self.tony_avatar = load(self.get_resource("Introduction_tony_avatar.png")).convert()
|
|
|
|
|
self.time_font = Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 64)
|
|
|
|
|
self.rank_font = Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 26)
|
|
|
|
|
self.time_font = pygame.font.Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 64)
|
|
|
|
|
self.rank_font = pygame.font.Font(self.get_resource("rounded-mplus-1m-bold.ttf"), 26)
|
|
|
|
|
self.register(self.start, self.start_wipe)
|
|
|
|
|
self.register(self.append_sword, interval=1500)
|
|
|
|
|
self.swords = []
|
|
|
|
|