-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
43 lines (31 loc) · 1 KB
/
main.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
import pygame
from hero import Hero
from random import randint
import game_function as gf
from setting import Setting
from static_enity import StaticEntity
setting = Setting()
pygame.init()
screen = pygame.display.set_mode((setting.width, setting.height))
doodle = Hero(screen, setting, 'images/stay.png')
doodle.start_position([setting.width / 2, setting.height - doodle.rect.height * 5])
platforms = []
for i in range(5):
plt = StaticEntity(screen, setting, 'images/block.png')
plt.start_position([randint(0, setting.width - plt.rect.width), setting.height / 6 * i + plt.rect.height])
platforms.append(plt)
plt = StaticEntity(screen, setting, 'images/block.png')
plt.start_position()
platforms.append(plt)
while True:
gf.check_events(doodle)
doodle.move()
doodle.move_y(platforms)
doodle.animation(platforms)
screen.blit(setting.bg_image, (0, 0))
for plt in platforms:
plt.blit()
doodle.shoot()
doodle.blit()
pygame.display.flip()
pygame.time.delay(24)