Skip to content

Commit

Permalink
Update to ChamberCourt’s fallback asset paths
Browse files Browse the repository at this point in the history
All assets must be in a `levels` directory, but we no longer need symlinks
to sound files in the test levels.
  • Loading branch information
rrthomas committed Jan 10, 2025
1 parent 26467d1 commit ca4776a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion test-levels/02 Map with missing tiles.tmx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.8.2" orientation="orthogonal" renderorder="right-down" width="8" height="8" tilewidth="16" tileheight="16" infinite="0" backgroundcolor="#000000" nextlayerid="2" nextobjectid="1">
<properties>
<property name="Title" value="Tiny map"/>
<property name="Title" value="Map with missing tiles"/>
</properties>
<tileset firstgid="1" source="WinColl.tsx"/>
<layer id="1" name="Tile Layer 1" width="8" height="8">
Expand Down
1 change: 0 additions & 1 deletion test-levels/Collect.wav

This file was deleted.

1 change: 0 additions & 1 deletion test-levels/Die.wav

This file was deleted.

1 change: 0 additions & 1 deletion test-levels/Slide.wav

This file was deleted.

1 change: 0 additions & 1 deletion test-levels/Unlock.wav

This file was deleted.

File renamed without changes
File renamed without changes
14 changes: 7 additions & 7 deletions wincoll/wincoll_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import gettext
import importlib
import importlib.resources
import os
import warnings
from enum import StrEnum, auto
from pathlib import Path

from chambercourt.game import DEFAULT_VOLUME, Game

Expand Down Expand Up @@ -89,16 +89,16 @@ def instructions() -> str:

window_scale = 2

def load_assets(self, path: Path, levels_path: Path) -> None:
super().load_assets(path, levels_path)
def load_assets(self) -> None:
super().load_assets()
global DIAMOND_IMAGE
global COLLECT_SOUND, SLIDE_SOUND, UNLOCK_SOUND
DIAMOND_IMAGE = pygame.image.load(levels_path / "Diamond.png")
COLLECT_SOUND = pygame.mixer.Sound(levels_path / "Collect.wav")
DIAMOND_IMAGE = pygame.image.load(self.find_asset("Diamond.png"))
COLLECT_SOUND = pygame.mixer.Sound(self.find_asset("Collect.wav"))
COLLECT_SOUND.set_volume(DEFAULT_VOLUME)
SLIDE_SOUND = pygame.mixer.Sound(levels_path / "Slide.wav")
SLIDE_SOUND = pygame.mixer.Sound(str(self.find_asset("Slide.wav")))
SLIDE_SOUND.set_volume(DEFAULT_VOLUME)
UNLOCK_SOUND = pygame.mixer.Sound(levels_path / "Unlock.wav")
UNLOCK_SOUND = pygame.mixer.Sound(str(self.find_asset("Unlock.wav")))
UNLOCK_SOUND.set_volume(DEFAULT_VOLUME)

def init_physics(self) -> None:
Expand Down

0 comments on commit ca4776a

Please sign in to comment.