diff --git a/NS.py b/NS.py
index 924d1aa..e3bc23b 100644
--- a/NS.py
+++ b/NS.py
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
-#
# [SCRAPEBOARD] is an arcade game in development by [@diskmem] & [@snakesandrews]
#
# It requires custom hardware to play but can be tested in keyboard mode without
-# the hardware. For more information on setting up and running the game, see the
-# README, or for the game in general, visit https://scrape.nugget.fun/
-#
+# the hardware. For more information on setting up and running the game, see
+# README.md, or for the game in general, visit .
import argparse, pathlib, operator, subprocess, sys
from random import randint, choice, random
@@ -151,11 +149,14 @@ class NS(Game, Animation):
parser.add_argument("--no-serial", action="store_true")
parser.add_argument("--show-config", action="store_true")
arguments = parser.parse_known_args()[0]
+
# Pre-initialize the mixer to use the specified buffer size in bytes. The default is set to 1024 to prevent lagging
# on the Raspberry Pi.
pygame.mixer.pre_init(44100, -16, 2, 1024)
+
# Pygame will be loaded in here.
Game.__init__(self)
+
# Add type declarations for non-string config name/value pairs that aren't in the default PGFW config dict.
self.get_configuration().type_declarations.add_chart(
{
@@ -196,24 +197,30 @@ class NS(Game, Animation):
},
"pads":
{
- "int-list": "center"
+ "int": "center_y"
}
})
+
# If a serial port was passed on the command line, override the config file setting
if arguments.serial_port is not None:
self.get_configuration().set("input", "arduino-port", arguments.serial_port)
+
# Command line flag requesting minimal load time overrides config file setting
if arguments.minimize_load_time:
self.get_configuration().set("system", "minimize-load-time", True)
+
# Turn off effects if minimal load time is requested. Minimal load time setting overrides display effects setting.
if self.get_configuration("system", "minimize-load-time"):
self.get_configuration().set("display", "effects", False)
+
# Apply the no serial flag from the command line if requested
if arguments.no_serial:
self.get_configuration().set("input", "serial", False)
+
# Print the configuration if requested on the command line
if arguments.show_config:
print(self.get_configuration())
+
# Initialize the serial reader and launch a thread for reading from the serial port
if self.serial_enabled():
from serial import Serial, SerialException
@@ -238,14 +245,18 @@ class NS(Game, Animation):
self.reset_arduino()
self.serial_thread = Thread(target=self.read_serial)
self.serial_thread.start()
+
Animation.__init__(self, self)
+
# All events will pass through self.respond
self.subscribe(self.respond, KEYDOWN)
self.subscribe(self.respond, KEYUP)
self.subscribe(self.respond)
ds = self.get_display_surface()
+
# Child objects for managing more specific parts of the game
- self.platform = Platform(self, self.get_configuration("pads", "center"))
+ platform_cx = self.get_display_surface().get_width() // 2
+ self.platform = Platform(self, (platform_cx, self.get_configuration("pads", "center_y")))
self.tony = Tony(self)
self.logo = Logo(self)
self.title = Title(self)
@@ -255,6 +266,7 @@ class NS(Game, Animation):
self.boss = Boss(self)
self.level_select = LevelSelect(self)
self.ending = Ending(self)
+
self.last_press = get_ticks()
self.register(self.blink_score, interval=500)
self.register(self.close_pop_up)
@@ -1945,7 +1957,7 @@ class Timer(Meter):
dsr = self.get_display_surface().get_rect()
background = load(self.get_resource("HUD_timer.png")).convert()
rect = background.get_rect()
- rect.bottomright = dsr.right - 6, dsr.bottom - 4
+ rect.bottomright = dsr.right - 4, dsr.bottom - 4
self.setup(background, rect, 53, (0, 0, 255),
self.get_configuration("time", "timer-start-level-1"), "scrapeIcons/scrapeIcons_07.png")
@@ -2942,6 +2954,9 @@ class Sword(Animation):
class Health(Meter):
+ """
+ Track the boss's health and display the meter
+ """
OFFSET = 4
@@ -2960,8 +2975,7 @@ class Health(Meter):
icon_index = 17
elif level_index == 2:
icon_index = 19
- Meter.setup(self, self.background, self.rect, 52, (255, 0, 255), 100,
- "scrapeIcons/scrapeIcons_%i.png" % icon_index)
+ Meter.setup(self, self.background, self.rect, 52, (255, 0, 255), 100, "scrapeIcons/scrapeIcons_%i.png" % icon_index)
def reset(self):
self.setup()
diff --git a/config b/config
index a7e5c7a..91449e0 100644
--- a/config
+++ b/config
@@ -92,4 +92,4 @@ nw_color = #00FF88
ne_color = #FF88FF
se_color = #2222FF
sw_color = #FF2222
-center = 427, 376
+center_y = 376
diff --git a/resource/HUD_boss.png b/resource/HUD_boss.png
index dba91a4..74145a2 100644
Binary files a/resource/HUD_boss.png and b/resource/HUD_boss.png differ
diff --git a/resource/scores b/resource/scores
index e69de29..2e76aaa 100644
--- a/resource/scores
+++ b/resource/scores
@@ -0,0 +1,3 @@
+42263 0
+53560 0
+72005 2
diff --git a/www/index.php b/www/index.php
index bde937e..c32f5b7 100644
--- a/www/index.php
+++ b/www/index.php
@@ -542,6 +542,8 @@
d(⌒ー⌒) (❁´◡`❁) ヽ(^Д^)ノ (。>‿‿<。 )(*´∇`)ノ (●⌒v⌒●) ´・ᴗ・` (✿^-^) ヾ(^ヮ^)ノ