-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
126 lines (112 loc) · 9.58 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""The constants used throughout the game"""
from __future__ import absolute_import
import pygame
class Game:
"""The constants pertaining to the general game"""
TITLE = 'Basic Python Game'
GAME_SIZE = 960, 480
BLOCK_GRID = (GAME_SIZE[0]//20, GAME_SIZE[1]//20)
FRAME_RATE = 60
GRAVITY = -0.5
COLLISION_THRESHOLD = 4
class Colors:
"""The constants pertaining to colors used in the game"""
CYAN = (50, 200, 222)
class Sprites:
"""The constants pertaining to the sprites used"""
BRICK_SIZE = (20, 20)
BRICK = pygame.transform.scale(pygame.image.load('./Assets/brick_block.png'), BRICK_SIZE)
COIN_SIZE = (16, 16)
COIN = pygame.transform.scale(pygame.image.load('./Assets/coin.png'), COIN_SIZE)
class Player:
"""The constants pertaining to the player"""
PLAYER_SIZE = (int(619 * 0.06), int(941 * 0.06))
PLAYER_SPRITE = pygame.transform.scale(pygame.image.load('./Assets/player.png'), PLAYER_SIZE)
PLAYER_DEFAULT_SPEED = (4, 8)
PLAYER_DEFAULT_LOCATION = (30, 165)
class Levels:
"""The constants pertaining to the general game"""
def _draw_level_one():
level = '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#.....................................OOOOOO....................................................'
level += '#.....................................OOOOOO....................................................'
level += '#..........................O..........OOOOOO....................................................'
level += '#.........................O##...................................................................'
level += '#........................O##....................................................................'
level += '#.......................O##.....................................................................'
level += '################################################################################################'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
level += '#...............................................................................................'
return level
def _draw_level_two():
level = '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
return level
def _draw_level_three():
level = '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
level += '................................................................................................'
return level
LEVEL_WIDTH = 96
LEVEL_HEIGHT = 24
LEVEL_DIMENSIONS = (LEVEL_WIDTH, LEVEL_HEIGHT)
LEVEL_ONE = _draw_level_one()
LEVEL_TWO = _draw_level_two()
LEVEL_THREE = _draw_level_three()