forked from karate/fuego-fighters
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
103 lines (90 loc) · 3.19 KB
/
Copy pathconstants.py
File metadata and controls
103 lines (90 loc) · 3.19 KB
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
from ArcadeFont import ArcadeFont
class Constants:
# Size of the window
WINDOW_SIZE = (400, 800)
X_CENTER = WINDOW_SIZE[0] / 2
# Basic colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# UI Settings
HP = GREEN
DAMAGE = RED
INERT = BLACK
HP_BAR_HEIGHT = 3
UPDATE_INTERVAL = 5000
DIR_L = -1
DIR_R = 1
# 2-point touch wall enumeration
# Outside is for first side touch
# Inside is for the second side touch
ENEMY_NO_TOUCH = 0
ENEMY_TOUCH_OUTSIDE = 1
ENEMY_TOUCH_INSIDE = 2
SPRITE_ENEMY_BULLET = {'spritesheet_filename': 'enemy_bullet.png',
'width': 8, 'height': 13, 'rows': 1, 'columns': 1}
SPRITE_PLAYER_BULLET = {'spritesheet_filename': 'player_bullet.png',
'width': 8, 'height': 13, 'rows': 1, 'columns': 1}
SPRITE_ENEMY_PLANE = {'spritesheet_filename': 'enemy.png',
'width': 31, 'height': 42, 'rows': 1, 'columns': 3}
SPRITE_PLAYER_PLANE = {'spritesheet_filename': 'player.png',
'width': 64, 'height': 64, 'rows': 1, 'columns': 3}
SPRITE_EXPLOSION = {'spritesheet_filename': 'explosion.png',
'width': 64, 'height': 64, 'rows': 3, 'columns': 8}
SPRITE_DAMAGE = {'spritesheet_filename': 'player_damage.png',
'width': 20, 'height': 17, 'rows': 1, 'columns': 4}
# Hordes formations
FORMATIONS = {
'v': [[1, 0, 0, 0, 0, 0, 1],
[0, 1, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 1, 0, 0],
[0, 0, 0, 1, 0, 0, 0]],
'dv': [[1, 0, 0, 0, 0, 0, 1],
[0, 1, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 1, 0, 0],
[0, 0, 0, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 1, 0, 0],
[0, 0, 0, 1, 0, 0, 0]],
'z': [[1, 1, 1, 1],
[0, 0, 1, 0],
[0, 1, 0, 0],
[1, 1, 1, 1]],
'/': [[0, 0, 0, 1],
[0, 0, 1, 0],
[0, 1, 0, 0],
[1, 0, 0, 0]],
"\\": [[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]]
}
@staticmethod
def get_available_text():
inst = ArcadeFont(15).get_text("Press SPACE to fire. Press 'q' to quit",
(0, 0, 124))
game_over = ArcadeFont(35).get_text("GAME OVER", (0, 0, 124))
restart = ArcadeFont(12).get_text(
"Press 'r' to restart. Press 'q' to quit", (0, 0, 124))
available_text = {
"instructions": {
'text': inst,
'pos': inst.get_rect(center=(Constants.X_CENTER, 50))},
"game_over": {
'text': game_over,
'pos': game_over.get_rect(center=(Constants.X_CENTER, 300))},
"restart": {
'text': restart,
'pos': restart.get_rect(center=(Constants.X_CENTER, 340))
}
}
return available_text
class Layer:
PLAYER = 1
PLAYER_BULLETS = 2
ENEMIES = 3
ENEMY_BULLETS = 4
POWER_UPS = 5
UI = 8
EXPLOSIONS = 9