-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
50 lines (40 loc) · 1.23 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
44
45
46
47
48
#from operator import truediv
import sys
import pygame
import os
import random
from AnimatedSprite import*
pygame.init()
width_screen = 1200
height_screen = 600
display_surface = pygame.display.set_mode((width_screen, height_screen))
time_clok = pygame.time.Clock()
pygame.display.set_caption("Santa run")
WHITE = (255,255,255)
BLACK = (0,0,0)
GREY = (0xec, 0xec, 0xec)
clock = pygame.time.Clock()
FPS = 30
BACKGROUND_COLOR = pygame.Color('white')
player = AnimatedSprite(position=(100, 440))
all_sprites = pygame.sprite.Group(player)
grounds = pygame.sprite.Group()
grounds.add(Ground(0, 550, 600, 200, GREY))
grounds.add(Ground(600, 550, 600, 200, GREY))
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
player.isJump = True
player.jump()
all_sprites.update()
display_surface.fill(BACKGROUND_COLOR)
all_sprites.draw(display_surface)
grounds.draw(display_surface)
pygame.display.update()
clock.tick(FPS)
pygame.quit()