generated from cis3296f22/project-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.py
152 lines (124 loc) · 4.46 KB
/
config.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import pygame
pygame.init()
WIN_WIDTH = 800
WIN_HEIGHT = 800
# create "scree" that way we can load our images here once
screen = pygame.display.set_mode((WIN_WIDTH, WIN_HEIGHT))
TILESIZE = 16
#42 by 42 tile size
#Asteroid Sizes
BIG_ASTEROID_SIZE = TILESIZE * 7
MED_ASTEROID_SIZE = TILESIZE * 5
SM_ASTEROID_SIZE = TILESIZE * 3
#target FPS
FPS = 60
#layers
PLAYER_LAYER = 4
SHIP_LAYER = 3
ASTEROID_LAYER = 3
SHIP_BULLET_LAYER = 2
#Lives
PLAYER_LIVES = 3
# vulnerability time in ms
DAMAGE_LOOP = 0
# speeds (temporary)
PLAYER_SPEED = 3
ASTEROID_SPEED = 1
#colors
GREEN = (0, 255, 0)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)
WHITE = (255, 255, 255)
# saucer bullets
BULLET_SPEED = 8
BULLET_COLOR = BLACK
BULLET_SIZE = 5
SPECIAL_BULLET_COLOR = RED
SPECIAL_BULLET_SPEED = 8
# player ship images
SHIP_A = [
pygame.image.load('Images/ships/ship-a/ship-a1.png').convert_alpha(),
pygame.image.load('Images/ships/ship-a/ship-a2.png').convert_alpha(),
pygame.image.load('Images/ships/ship-a/ship-a3.png').convert_alpha(),
pygame.image.load('Images/ships/ship-a/ship-a-damaged.png').convert_alpha()
]
SHIP_A_BUTTON = [
pygame.transform.scale(SHIP_A[0], (200,200)),
pygame.transform.scale(SHIP_A[1], (200,200)),
pygame.transform.scale(SHIP_A[2], (200,200))
]
SHIP_B = [
pygame.image.load('Images/ships/ship-b/ship-b1.png').convert_alpha(),
pygame.image.load('Images/ships/ship-b/ship-b2.png').convert_alpha(),
pygame.image.load('Images/ships/ship-b/ship-b3.png').convert_alpha(),
pygame.image.load('Images/ships/ship-b/ship-b-damaged.png').convert_alpha()
]
SHIP_B_BUTTON = [
pygame.transform.scale(SHIP_B[0], (200,200)),
pygame.transform.scale(SHIP_B[1], (200,200)),
pygame.transform.scale(SHIP_B[2], (200,200))
]
SHIP_C = [
pygame.image.load('Images/ships/ship-c/ship-c1.png').convert_alpha(),
pygame.image.load('Images/ships/ship-c/ship-c2.png').convert_alpha(),
pygame.image.load('Images/ships/ship-c/ship-c3.png').convert_alpha(),
pygame.image.load('Images/ships/ship-c/ship-c-damaged.png').convert_alpha()
]
SHIP_C_BUTTON = [
pygame.transform.scale(SHIP_C[0], (200,200)),
pygame.transform.scale(SHIP_C[1], (200,200)),
pygame.transform.scale(SHIP_C[2], (200,200))
]
SHIP_D = [
pygame.image.load('Images/ships/ship-d/ship-d1.png').convert_alpha(),
pygame.image.load('Images/ships/ship-d/ship-d2.png').convert_alpha(),
pygame.image.load('Images/ships/ship-d/ship-d3.png').convert_alpha(),
pygame.image.load('Images/ships/ship-d/ship-d-damaged.png').convert_alpha()
]
SHIP_D_BUTTON = [
pygame.transform.scale(SHIP_D[0], (200,200)),
pygame.transform.scale(SHIP_D[1], (200,200)),
pygame.transform.scale(SHIP_D[2], (200,200))
]
SELECTED_SHIP = 0 # default ship-a
# images for explosion animation
EXPLOSION = [
pygame.image.load('Images/Explosions/explosions-a1.png').convert_alpha(),
pygame.image.load('Images/Explosions/explosions-a2.png').convert_alpha(),
pygame.image.load('Images/Explosions/explosions-a3.png').convert_alpha(),
pygame.image.load('Images/Explosions/explosions-a4.png').convert_alpha(),
pygame.image.load('Images/Explosions/explosions-a5.png').convert_alpha(),
pygame.image.load('Images/Explosions/explosions-a6.png').convert_alpha()
]
# player bullet variables
BULLET_SPEED = 4
BULLET_COLOR = WHITE
BULLET_SIZE = 5
SPECIAL_BULLET_COLOR = RED
SPECIAL_BULLET_SPEED = 4
SPAWN_DELAY_POWERUP = 30
# initialize Pygame mixer
import pygame
pygame.mixer.init()
# imports all the music and sound effects
BACKGROUND_MUSIC = pygame.mixer.Sound('Sounds/Background Music.mp3')
ASTEROID_MUSIC = pygame.mixer.Sound('Sounds/Asteroid Destroyed.mp3')
PLAYER_BULLET_MUSIC = pygame.mixer.Sound('Sounds/Player Bullet.mp3')
SHIP_MUSIC = pygame.mixer.Sound('Sounds/Ship Sounds.mp3')
PLAYER_DESTROYED_MUSIC = pygame.mixer.Sound('Sounds/Player Destroyed.mp3')
POWERUP_MUSIC = pygame.mixer.Sound('Sounds/Obtain Powerup.mp3')
BOMB_MUSIC = pygame.mixer.Sound('Sounds/Explosion.mp3')
# play music on separate channels
MUSIC_CHANNEL = pygame.mixer.Channel(0)
ASTEROID_CHANNEL = pygame.mixer.Channel(1)
PLAYER_CHANNEL = pygame.mixer.Channel(2)
PLAYER_DESTROYED_CHANNEL = pygame.mixer.Channel(3)
SHIP_CHANNEL = pygame.mixer.Channel(4)
POWERUP_CHANNEL = pygame.mixer.Channel(5)
# set volume, needs continuous testing
pygame.mixer.Channel(0).set_volume(2)
pygame.mixer.Channel(1).set_volume(10)
pygame.mixer.Channel(2).set_volume(3)
pygame.mixer.Channel(4).set_volume(0.5)
pygame.mixer.Channel(3).set_volume(10)