Code cleanup
This commit is contained in:
@@ -39,8 +39,6 @@ class Level:
|
|||||||
|
|
||||||
rows = data.get("map", "").splitlines()
|
rows = data.get("map", "").splitlines()
|
||||||
# Strip a leading blank line from block-scalar formatting, keep shape.
|
# Strip a leading blank line from block-scalar formatting, keep shape.
|
||||||
rows = [r for r in rows if r.strip("\n") != "" or True]
|
|
||||||
rows = [r.rstrip("\n") for r in rows]
|
|
||||||
if rows and rows[0] == "":
|
if rows and rows[0] == "":
|
||||||
rows = rows[1:]
|
rows = rows[1:]
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ class Player:
|
|||||||
self.drop_through_timer = 0.0
|
self.drop_through_timer = 0.0
|
||||||
self.was_jump_held = False
|
self.was_jump_held = False
|
||||||
self.crushed = False
|
self.crushed = False
|
||||||
self.carry = (0.0, 0.0)
|
|
||||||
self._sync_rect()
|
self._sync_rect()
|
||||||
|
|
||||||
def _sync_rect(self):
|
def _sync_rect(self):
|
||||||
@@ -141,7 +140,6 @@ class Player:
|
|||||||
|
|
||||||
def _ride_platforms(self):
|
def _ride_platforms(self):
|
||||||
# If standing on a moving platform, inherit its motion this frame.
|
# If standing on a moving platform, inherit its motion this frame.
|
||||||
self.carry = (0.0, 0.0)
|
|
||||||
for rect, dx, dy in self.level.carriers():
|
for rect, dx, dy in self.level.carriers():
|
||||||
if (
|
if (
|
||||||
abs(self.rect.bottom - rect.top) <= 3
|
abs(self.rect.bottom - rect.top) <= 3
|
||||||
@@ -151,7 +149,6 @@ class Player:
|
|||||||
self.fx += dx
|
self.fx += dx
|
||||||
self.fy += dy
|
self.fy += dy
|
||||||
self._sync_rect()
|
self._sync_rect()
|
||||||
self.carry = (dx, dy)
|
|
||||||
break
|
break
|
||||||
|
|
||||||
def _horizontal(self, dt, inp):
|
def _horizontal(self, dt, inp):
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ FADE_TIME = 0.3 # seconds for each half of the fade-to-black transition
|
|||||||
# --- Colors (placeholder rendering) ------------------------------------------
|
# --- Colors (placeholder rendering) ------------------------------------------
|
||||||
COLOR_BG = (24, 26, 38)
|
COLOR_BG = (24, 26, 38)
|
||||||
COLOR_HUD = (235, 235, 245)
|
COLOR_HUD = (235, 235, 245)
|
||||||
COLOR_HUD_WARN = (240, 90, 90)
|
|
||||||
|
|
||||||
# Fallback colors + labels for placeholder rectangles, keyed by sprite name.
|
# Fallback colors + labels for placeholder rectangles, keyed by sprite name.
|
||||||
PLACEHOLDERS = {
|
PLACEHOLDERS = {
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ Nothing else in the engine needs to change.
|
|||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
from . import settings
|
|
||||||
|
|
||||||
# --- helpers -----------------------------------------------------------------
|
# --- helpers -----------------------------------------------------------------
|
||||||
_DIRS = {
|
_DIRS = {
|
||||||
"up": (0, -1),
|
"up": (0, -1),
|
||||||
|
|||||||
Reference in New Issue
Block a user