-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.py
67 lines (55 loc) · 1.44 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import pygame
import sys
from random import randint
from game_functions import check_events
from background import Background
from mario import Mario
from physics import Physics
from goomba import Goomba
from block import Block
from pygame.sprite import Group
def run_game():
pygame.init()
screen_size = (600, 385)
screen = pygame.display.set_mode(screen_size)
mario = Mario(screen)
background = Background(screen, './mario_pics/full_background_no_sky.png', mario)
question_block = Block(screen, 300)
physics = Physics()
# first_goomba = Goomba(screen)
enemies = Group()
game_on = True
tick = 0
background_color = (93,148,251)
# r = randint(0, 255)
# g = randint(0,255)
# b = randint(0,255)
while game_on == True:
# tick += 1
# background_color = (r, g, b)
# if tick % 5 == 0:
# r += 10
# g += 15
# b += 16
# if r > 230:
# r -= 150
# if g > 230:
# g -= 150
# if b > 230:
# b -= 150
# print tick
for i in background.goomba_spawn_points:
if background.x == i:
enemies.add(Goomba(screen))
check_events(background, mario, question_block, screen)
screen.fill(background_color)
background.draw_background(mario)
mario.draw_mario(physics, background)
question_block.draw_block(mario)
print enemies
for enemy in enemies:
enemy.draw_goomba(mario, physics, background)
mario.check_mario_is_alive(background, enemy)
# first_goomba.draw_goomba(mario)
pygame.display.flip()
run_game()