-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
50 lines (39 loc) · 1.49 KB
/
settings.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
import pygame
class Settings():
"""A class to store all settings for the game"""
def __init__(self):
#screen settings
self.screen_width = 1000
self.screen_height = 600
self.bg = pygame.transform.scale(pygame.image.load("images/background.png"), (self.screen_width, self.screen_height))
# self.bg_color = (204, 204, 204)
#ship speed
self.ship_speed_factor = 1
self.ship_limit = 3
self.bullet_speed_factor = 3
self.bullet_width = 20
self.bullet_height = 20
self.bullet_color = (255, 51, 51)
self.bullets_allowed = 7
self.alien_speed_factor = 1.2
self.fleet_drop_speed = 6
# 1 = right ; -1 = left
self.fleet_direction = 1
#game speed on lvlup
self.speedup_scale = 1.3
#alien point value incr
self.score_scale = 1.5
self.initialize_dynamic_settings()
def initialize_dynamic_settings(self):
"""init settg that change throughout the game"""
self.ship_speed_factor = 1
self.bullet_speed_factor = 3
self.alien_speed_factor = 1.2
self.fleet_direction = 1
#scoring
self.alien_points = 10
def increase_speed(self):
self.ship_speed_factor *= self.speedup_scale
self.bullet_speed_factor *= self.speedup_scale
self.alien_speed_factor *= self.speedup_scale
self.alien_points = int(self.alien_points * self.score_scale)