-
Notifications
You must be signed in to change notification settings - Fork 0
/
Constants.py
39 lines (33 loc) · 954 Bytes
/
Constants.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
29
30
31
32
33
34
35
36
37
38
39
import pygame
#Screen dimensions
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
# Colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
# class to load images from sprite sheets
class SpriteSheet():
sprite_sheet = None
def __init__(self, file_name):
self.sprite_sheet = pygame.image.load(file_name).convert()
def get_image(self, x, y, width, height):
image = pygame.Surface([width, height]).convert()
image.blit(self.sprite_sheet, (0, 0), (x, y, width, height))
image.set_colorkey(BLACK)
return image
PLAYER1_NAME = "PLAYER 1"
PLAYER1_LEFT = pygame.K_LEFT
PLAYER1_RIGHT = pygame.K_RIGHT
PLAYER1_UP = pygame.K_UP
PLAYER1_DOWN = pygame.K_DOWN
PLAYER1_BOMB_DROP = pygame.K_o
PLAYER1_BOMB_EXPLODE = pygame.K_p
PLAYER2_NAME = "PLAYER 2"
PLAYER2_LEFT = pygame.K_a
PLAYER2_RIGHT = pygame.K_d
PLAYER2_UP = pygame.K_w
PLAYER2_DOWN = pygame.K_s
PLAYER2_BOMB_DROP = pygame.K_SPACE
PLAYER2_BOMB_EXPLODE = pygame.K_e