-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
executable file
·91 lines (65 loc) · 1.95 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
#This program was written in comic sans
import os,sys,pygame
from pygame.locals import *
from path import path
from screen import clock, screen
from pics import rock, timgs
from units import massx, massy
#getting the world
from chunk import chunk
from fake_chunk import fake_chunk
import time
real = chunk()
screen_rect = screen.get_rect()
camera = screen_rect.copy()
dx = dy = 0
black = Color('black')
xback = 0
yback = 0
run = False
dash = False
#starting the loop
while True:
clock.tick(30)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == QUIT:
pygame.quit()
sys.exit()
elif event.type == KEYDOWN and event.key == K_q:
pygame.quit()
sys.exit()
elif event.type == KEYDOWN and event.key == K_UP:
dy = -1
elif event.type == KEYDOWN and event.key == K_DOWN:
dy = 1
elif event.type == KEYDOWN and event.key == K_LEFT:
dx = -1
elif event.type == KEYDOWN and event.key == K_RIGHT:
dx = 1
elif event.type == KEYUP and event.key == K_UP:
dy = 0
elif event.type == KEYUP and event.key == K_DOWN:
dy = 0
elif event.type == KEYUP and event.key == K_LEFT:
dx = 0
elif event.type == KEYUP and event.key == K_RIGHT:
dx = 0
elif event.type == KEYDOWN and event.key == K_r:
run = True
elif event.type == KEYUP and event.key == K_r:
run = False
elif event.type == KEYDOWN and event.key == K_t:
dash = True
elif event.type == KEYUP and event.key == K_t:
dash = False
dx = dx
dy = dy
screen.fill(black)
real.update(dx, dy, run, dash)
screen.blit(real.img, real.p_pos)
# screen.blit(sams_health.img, sams_health.position)
pygame.display.update()