diff --git a/examples/chess/chess.py b/examples/chess/chess.py index 85c6a4cf0..7e7f739fa 100644 --- a/examples/chess/chess.py +++ b/examples/chess/chess.py @@ -1,4 +1,5 @@ import sys +from os.path import dirname, join import pygame @@ -14,7 +15,7 @@ def main(): pygame.init() - size = width, height = 500, 500 + size = 500, 500 screen = pygame.display.set_mode(size) pygame.display.set_caption("Rx for Python rocks") @@ -27,16 +28,18 @@ def main(): mousemove = Subject() - files = [ - "chess_tower.png", - "chess_bishop.png", - "chess_horse.png", - "chess_king.png", - "chess_queen.png", - "chess_horse.png", - "chess_bishop.png", - "chess_tower.png" - ] + color = "white" + base = dirname(__file__) + files = [join(base, img % color) for img in [ + "chess_rook_%s.png", + "chess_knight_%s.png", + "chess_bishop_%s.png", + "chess_king_%s.png", + "chess_queen_%s.png", + "chess_bishop_%s.png", + "chess_knight_%s.png", + "chess_rook_%s.png" + ]] images = [pygame.image.load(image).convert_alpha() for image in files] old = [None] * len(images) @@ -48,7 +51,7 @@ def handle_image(i, image): def on_next(ev): imagerect.top = ev[1] - imagerect.left = ev[0] + i * 30 + imagerect.left = ev[0] + i * 32 if old[i]: erase.append(old[i]) diff --git a/examples/chess/chess_bishop.png b/examples/chess/chess_bishop_black.png similarity index 100% rename from examples/chess/chess_bishop.png rename to examples/chess/chess_bishop_black.png diff --git a/examples/chess/chess_horse.png b/examples/chess/chess_horse.png deleted file mode 100644 index 7fb3d6c0d..000000000 Binary files a/examples/chess/chess_horse.png and /dev/null differ diff --git a/examples/chess/chess_horse_white.png b/examples/chess/chess_horse_white.png deleted file mode 100644 index 2300231de..000000000 Binary files a/examples/chess/chess_horse_white.png and /dev/null differ diff --git a/examples/chess/chess_king.png b/examples/chess/chess_king_black.png similarity index 100% rename from examples/chess/chess_king.png rename to examples/chess/chess_king_black.png diff --git a/examples/chess/chess_knight_black.png b/examples/chess/chess_knight_black.png new file mode 100644 index 000000000..a24334ced Binary files /dev/null and b/examples/chess/chess_knight_black.png differ diff --git a/examples/chess/chess_knight_white.png b/examples/chess/chess_knight_white.png new file mode 100644 index 000000000..4cc40b4d5 Binary files /dev/null and b/examples/chess/chess_knight_white.png differ diff --git a/examples/chess/chess_pawn.png b/examples/chess/chess_pawn_black.png similarity index 100% rename from examples/chess/chess_pawn.png rename to examples/chess/chess_pawn_black.png diff --git a/examples/chess/chess_queen.png b/examples/chess/chess_queen_black.png similarity index 100% rename from examples/chess/chess_queen.png rename to examples/chess/chess_queen_black.png diff --git a/examples/chess/chess_tower.png b/examples/chess/chess_rook_black.png similarity index 100% rename from examples/chess/chess_tower.png rename to examples/chess/chess_rook_black.png diff --git a/examples/chess/chess_tower_white.png b/examples/chess/chess_rook_white.png similarity index 100% rename from examples/chess/chess_tower_white.png rename to examples/chess/chess_rook_white.png