Advertisement
Stegnewe

Sprites.py

Apr 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.24 KB | None | 0 0
  1. import pygame
  2.  
  3. spriteOffset = 10
  4. boxWidth = 80
  5.  
  6. #Set up the sprites for every peice
  7. class bPawn(pygame.sprite.Sprite):
  8.     def __init__(self, x, y):
  9.         pygame.sprite.Sprite.__init__(self)
  10.         self.image = pygame.image.load("peices/bPawn.png")
  11.         self.rect = self.image.get_rect()
  12.         self.rect.x = x
  13.         self.rect.y = y
  14.         self.moved = 0
  15.  
  16. class wPawn(pygame.sprite.Sprite):
  17.     def __init__(self, x, y):
  18.         pygame.sprite.Sprite.__init__(self)
  19.         self.image = pygame.image.load("peices/wPawn.png")
  20.         self.rect = self.image.get_rect()
  21.         self.rect.x = x
  22.         self.rect.y = y
  23.         self.moved = 0
  24.  
  25. class bBishop(pygame.sprite.Sprite):
  26.     def __init__(self, x, y):
  27.         pygame.sprite.Sprite.__init__(self)
  28.         self.image = pygame.image.load("peices/bBishop.png")
  29.         self.rect = self.image.get_rect()
  30.         self.rect.x = x
  31.         self.rect.y = y
  32.         self.moved = 0
  33.  
  34. class wBishop(pygame.sprite.Sprite):
  35.     def __init__(self, x, y):
  36.         pygame.sprite.Sprite.__init__(self)
  37.         self.image = pygame.image.load("peices/wBishop.png")
  38.         self.rect = self.image.get_rect()
  39.         self.rect.x = x
  40.         self.rect.y = y
  41.         self.moved = 0
  42.  
  43. class bKing(pygame.sprite.Sprite):
  44.     def __init__(self, x, y):
  45.         pygame.sprite.Sprite.__init__(self)
  46.         self.image = pygame.image.load("peices/bKing.png")
  47.         self.rect = self.image.get_rect()
  48.         self.rect.x = x
  49.         self.rect.y = y
  50.         self.moved = 0
  51.  
  52. class wKing(pygame.sprite.Sprite):
  53.     def __init__(self, x, y):
  54.         pygame.sprite.Sprite.__init__(self)
  55.         self.image = pygame.image.load("peices/wKing.png")
  56.         self.rect = self.image.get_rect()
  57.         self.rect.x = x
  58.         self.rect.y = y
  59.         self.moved = 0
  60.  
  61. class bKnight(pygame.sprite.Sprite):
  62.     def __init__(self, x, y):
  63.         pygame.sprite.Sprite.__init__(self)
  64.         self.image = pygame.image.load("peices/bKnight.png")
  65.         self.rect = self.image.get_rect()
  66.         self.rect.x = x
  67.         self.rect.y = y
  68.         self.moved = 0
  69.  
  70. class wKnight(pygame.sprite.Sprite):
  71.     def __init__(self, x, y):
  72.         pygame.sprite.Sprite.__init__(self)
  73.         self.image = pygame.image.load("peices/wKnight.png")
  74.         self.rect = self.image.get_rect()
  75.         self.rect.x = x
  76.         self.rect.y = y
  77.         self.moved = 0
  78.  
  79. class bQueen(pygame.sprite.Sprite):
  80.     def __init__(self, x, y):
  81.         pygame.sprite.Sprite.__init__(self)
  82.         self.image = pygame.image.load("peices/bQueen.png")
  83.         self.rect = self.image.get_rect()
  84.         self.rect.x = x
  85.         self.rect.y = y
  86.         self.moved = 0
  87.  
  88. class wQueen(pygame.sprite.Sprite):
  89.     def __init__(self, x, y):
  90.         pygame.sprite.Sprite.__init__(self)
  91.         self.image = pygame.image.load("peices/wQueen.png")
  92.         self.rect = self.image.get_rect()
  93.         self.rect.x = x
  94.         self.rect.y = y
  95.         self.moved = 0
  96.  
  97. class bRook(pygame.sprite.Sprite):
  98.     def __init__(self, x, y):
  99.         pygame.sprite.Sprite.__init__(self)
  100.         self.image = pygame.image.load("peices/bRook.png")
  101.         self.rect = self.image.get_rect()
  102.         self.rect.x = x
  103.         self.rect.y = y
  104.         self.moved = 0
  105.  
  106. class wRook(pygame.sprite.Sprite):
  107.     def __init__(self, x, y):
  108.         pygame.sprite.Sprite.__init__(self)
  109.         self.image = pygame.image.load("peices/wRook.png")
  110.         self.rect = self.image.get_rect()
  111.         self.rect.x = x
  112.         self.rect.y = y
  113.         self.moved = 0
  114.  
  115. #The sprite for outlining tiles for debugging purposes
  116. class dbhighlight(pygame.sprite.Sprite):
  117.     def __init__(self, x, y):
  118.         pygame.sprite.Sprite.__init__(self)
  119.         self.image = pygame.image.load("otherSprites/dbhighlight.png")
  120.         self.rect = self.image.get_rect()
  121.         self.rect.x = x
  122.         self.rect.y = y
  123.  
  124. #The sprite for the outline that shows available moves of a selected peice
  125. class highlight(pygame.sprite.Sprite):
  126.     def __init__(self, x, y):
  127.         pygame.sprite.Sprite.__init__(self)
  128.         self.image = pygame.image.load("otherSprites/highlight.png")
  129.         self.rect = self.image.get_rect()
  130.         self.rect.x = x
  131.         self.rect.y = y
  132.  
  133. #The sprite for the outline that shows the currently selected piece
  134. class highlightCurr(pygame.sprite.Sprite):
  135.     def __init__(self, x, y):
  136.         pygame.sprite.Sprite.__init__(self)
  137.         self.image = pygame.image.load("otherSprites/highlightCurr.png")
  138.         self.rect = self.image.get_rect()
  139.         self.rect.x = x
  140.         self.rect.y = y
  141.  
  142. class checkmate(pygame.sprite.Sprite):
  143.     def __init__(self):
  144.         pygame.sprite.Sprite.__init__(self)
  145.         self.image = pygame.image.load("otherSprites/checkmate.png")
  146.         self.rect = self.image.get_rect()
  147.         self.rect.x = boxWidth
  148.         self.rect.y = 3*boxWidth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement