-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
42 lines (36 loc) · 1.07 KB
/
test.py
File metadata and controls
42 lines (36 loc) · 1.07 KB
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
import pygame
import person
import gui
from gui import Camera
import time
def draw_fps():
image = font.render(str(pygame.mouse.get_pos()[0]) + " " + str(camera.x), False, (255, 255, 255))
screen.blit(image, (0, 0))
pygame.init()
WIDTH = pygame.display.Info().current_w
HEIGHT = pygame.display.Info().current_h
FPS = 60
font = pygame.font.Font('fonts/font.ttf', 36)
screen = pygame.display.set_mode((WIDTH, HEIGHT))
layers = gui.Layers(file="level.npy")
player = person.Creator(11000, 0, 64, 64, layers.entity, state="Fly")
camera = Camera(player.rect)
selected_box = gui.SelectedBox(layers, camera)
clock = pygame.time.Clock()
running = True
while running:
start_time = time.time()
events = pygame.event.get()
player.update(events)
selected_box.update(events)
camera.update()
for event in events:
if event.type == pygame.QUIT:
running = False
screen.fill((0, 0, 0))
layers.draw(screen, camera)
draw_fps()
pygame.display.update()
# print("--- %s seconds ---" % (time.time() - start_time))
clock.tick(FPS)
pygame.quit()