Skip to content

Commit

Permalink
Pedantic changes to chess example (piece names and order) (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikkemperman authored May 5, 2019
1 parent b1dd78a commit 148d61e
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions examples/chess/chess.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from os.path import dirname, join

import pygame

Expand All @@ -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")

Expand All @@ -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)
Expand All @@ -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])
Expand Down
File renamed without changes
Binary file removed examples/chess/chess_horse.png
Binary file not shown.
Binary file removed examples/chess/chess_horse_white.png
Binary file not shown.
File renamed without changes
Binary file added examples/chess/chess_knight_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/chess/chess_knight_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 148d61e

Please sign in to comment.