-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_game.py
45 lines (38 loc) · 1.44 KB
/
main_game.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
import pygame
from Settings.settings import Settings
import Game_Functions.game_functions as gf
from Actors.player import PlayerShip
import Interface.controls as ctrl
from pygame.sprite import Group
from Settings.stats import GameStats
from Interface.scoreboard import Scoreboard
from Interface.button import Button
def run_game():
pygame.init()
stg = Settings()
stats = GameStats(stg)
screen = pygame.display.set_mode((stg.screen_width, stg.screen_height))
clock = pygame.time.Clock()
pygame.display.set_caption("Super Moon Attack")
#bg_color = stg.bg_color
p_shot = Group()
aliens_1 = Group()
#initialize player character
sb = Scoreboard(stg, screen, stats)
button = Button(stg, screen)
player = PlayerShip(stg, screen)
gf.create_alien_1(stg, screen, aliens_1)
while True:
clock.tick(stg.fps)
#screen.blit(stg.bg_img, stg.bg_rect)
gf.bg_scroll(stg, screen)
ctrl.check_events(stg, screen, stats, player, p_shot, sb, button, aliens_1)
gf.alien_1_random(stg, screen, aliens_1)
gf.p_shot_update(stg, screen, player, p_shot, aliens_1, stats)
'''break order and put enemies at end. *arg will recieve list'''
gf.update_aliens(stg, screen, player, p_shot, stats, sb, aliens_1)
player.update()
gf.update_aliens_1(stg, screen, aliens_1)
sb.prep_score()
gf.update_screen(stg, screen, player, p_shot, aliens_1, sb)
run_game()