adjust platform and boss health hud for smaller resolution, add donation button to web site

disable-sound
ohsqueezy 1 year ago
parent 7555d3fca4
commit a94dfbedcf

32
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 <https://scrape.nugget.fun/>.
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()

@ -92,4 +92,4 @@ nw_color = #00FF88
ne_color = #FF88FF
se_color = #2222FF
sw_color = #FF2222
center = 427, 376
center_y = 376

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 B

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,3 @@
42263 0
53560 0
72005 2

@ -542,6 +542,8 @@
d(⌒ー⌒) (❁´◡`❁) ヽ(^Д^)ノ (。>‿‿<(*´∇`)ノ (●⌒v⌒●) ´・ᴗ・` (✿^-^) ヾ(^ヮ^)ノ
</p>
<!-- PROMO VIDEO -->
<div id="comedy">
<iframe src="https://www.youtube.com/embed/ai9WlJdfbvI" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
@ -592,6 +594,15 @@
</style>
<!-- DONATION WIDGET -->
<iframe id='kofiframe' src='https://ko-fi.com/scrapeboard/?hidefeed=true&widget=true&embed=true&preview=true' scrolling="no"
style='border:none;padding:0px;margin:auto;margin-top:50px;height:600px;background:rgba(0, 0, 0, 0);overflow:hidden;display:block'
title='scrapeboard'>
</iframe>
<!-- FOLLOW BUTTONS -->
<p id="credits-heading">
Follow the developers!
</p>

Loading…
Cancel
Save