-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.py
28 lines (22 loc) · 959 Bytes
/
items.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pygame
from nax import COLORS
class Platform(pygame.sprite.Sprite):
""" Wall the player can run into. """
def __init__(self, x, y, width, height, color='BLUE'):
""" Constructor for the wall that the player can run into. """
# Call the parent's constructor
super().__init__()
# Make a blue wall, of the size specified in the parameters
self.image = pygame.Surface([width, height])
self.image.fill(COLORS.get(color))
# Make our top-left corner the passed-in location.
self.rect = self.image.get_rect()
self.rect.y = y
self.rect.x = x
self.is_end = False
class Background(pygame.sprite.Sprite):
def __init__(self, image_file, location):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
self.image = pygame.image.load(image_file)
self.rect = self.image.get_rect()
self.rect.left, self.rect.top = location