Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: use consistent map levels #8

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/data/maps/0.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/maps/1.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/maps/2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/maps/3.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/maps/4.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/maps/5.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/data/maps_in_progress/0.json

This file was deleted.

1 change: 1 addition & 0 deletions src/data/maps_in_progress/the_1001_tryhard.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/data/maps_in_progress/tutoral_huh.json

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions src/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def __init__(self) -> None:
# B.I.Y. Inspired Color Scheme
self.colorscheme_green3 = pre.hex_to_rgb("425238")
self.colorscheme_green4 = pre.hex_to_rgb("597119")
self.colorscheme_green5 = pre.hex_to_rgb("6a822a")

self.scroll_ease: Final[pg.Vector2] = pg.Vector2(1 / 30, 1 / 30)
self.camerasize = self.display.get_size()
Expand All @@ -328,7 +329,7 @@ def __init__(self) -> None:
# Edit level manually for quick feedback gameplay iterations
##############################################################################

self.level = 7 # 20240623122916UTC: level 3 has a lovely color palette
self.level = 0 # 20240623122916UTC: level 3 has a lovely color palette
self.levels_space_theme = {0, 1, 2, 3, 4, 5, 6, 7} # ^_^ so all levels??!!!

##############################################################################
Expand Down Expand Up @@ -976,16 +977,6 @@ def update(self) -> None:

# Update(and HACK: Draw) Game Stats HUD
# ---------------------------------------------------------------------
# Create HUD surface.
hud_size: Final[Tuple[int, int]] = (256, 48)
hud_surf = pg.Surface(hud_size, flags=pg.SRCALPHA).convert_alpha()

# Add semi-transparent background.
hud_bg_surf = pg.Surface(hud_size, flags=pg.SRCALPHA).convert_alpha()
hud_bg_surf.set_colorkey(pg.Color("black"))
hud_bg_surf.fill(pre.CHARCOAL)
hud_bg_surf.set_alpha(255 // 20)
hud_surf.blit(hud_bg_surf, (0, 0))

# Draw enemy icons.
enemy_icon_surf: Final[pg.SurfaceType] = self.assets.entity["enemy"].copy()
Expand All @@ -1002,7 +993,7 @@ def update(self) -> None:
for enemy in self.enemies:
# Draw icons.
# -----------------------------------------------------------------
icon_rect: pg.Rect = hud_surf.blit(
icon_rect: pg.Rect = self.hud_surf.blit(
source=enemy_icon_surf,
dest=(hud_dest + ((icon_offset_x + accumulator_x), icon_offset_y)),
)
Expand All @@ -1014,13 +1005,13 @@ def update(self) -> None:
status_center: Tuple[int, int] = (icon_rect.x, (icon_rect.y + (icon_rect.h // 2) + int(icon_status_radius)))

if enemy.is_collected_by_player:
pg.draw.circle(hud_surf, self.colorscheme_green4, status_center, icon_status_radius, 0)
pg.draw.circle(self.hud_surf, self.colorscheme_green5, status_center, icon_status_radius, 0)
else:
pg.draw.circle(hud_surf, self.colorscheme_green3, status_center, icon_status_radius, 1)
pg.draw.circle(self.hud_surf, self.colorscheme_green4, status_center, icon_status_radius, 1)
# -----------------------------------------------------------------

# Draw HUD with pre-rendered buffer on display.
self.display.blit(hud_surf, hud_dest, special_flags=pg.BLEND_ALPHA_SDL2)
self.display.blit(self.hud_surf, hud_dest, special_flags=pg.BLEND_ALPHA_SDL2)
# ---------------------------------------------------------------------

# Update (and HACK: Draw) Debugging HUD
Expand Down Expand Up @@ -1073,6 +1064,17 @@ def lvl_load_level(self, map_id: int, progressbar: Optional[queue.Queue[int]] =
self.projectiles: list[pre.Projectile] = []
self.sparks: list[Spark] = []

# Create HUD surface.
self.hud_size: Tuple[int, int] = (256, 48)
self.hud_surf = pg.Surface(self.hud_size, flags=pg.SRCALPHA).convert_alpha()

# Add semi-transparent background.
self.hud_bg_surf = pg.Surface(self.hud_size, flags=pg.SRCALPHA).convert_alpha()
self.hud_bg_surf.set_colorkey(pg.Color("black"))
self.hud_bg_surf.fill(pre.CHARCOAL)
self.hud_bg_surf.set_alpha(127)
self.hud_surf.blit(self.hud_bg_surf, (0, 0))

bg_blue_sky_surf = self.assets.misc_surf["bg1"]
bg_blue_sky_surf_yflipped = pg.transform.flip(bg_blue_sky_surf.copy(), 0, 1)

Expand Down