-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawing.py
More file actions
36 lines (29 loc) · 1.41 KB
/
Copy pathdrawing.py
File metadata and controls
36 lines (29 loc) · 1.41 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
import pygame
from settings import *
from ray_casting import ray_casting
class Drawing:
def __init__(self, sc):
self.sc = sc
self.font = pygame.font.SysFont('Arial', 36, bold=True)
self.textures = {1: pygame.image.load('img/wall1.png').convert(),
2: pygame.image.load('img/wall2.png').convert(),
3: pygame.image.load('img/wall3.png').convert(),
4: pygame.image.load('img/wall4.png').convert(),
5: pygame.image.load('img/pro.png').convert(),
'S': pygame.image.load('img/sky2.png').convert()
}
def background(self, angle):
sky_offset = -10 * math.degrees(angle) % WIDTH
self.sc.blit(self.textures['S'], (sky_offset, 0))
self.sc.blit(self.textures['S'], (sky_offset - WIDTH, 0))
self.sc.blit(self.textures['S'], (sky_offset + WIDTH, 0))
pygame.draw.rect(self.sc, DARKGRAY, (0, HALF_HEIGHT, WIDTH, HALF_HEIGHT))
def world(self, world_objects):
for obj in sorted(world_objects, key=lambda n: n[0], reverse=True):
if obj[0]:
_, object, object_pos = obj
self.sc.blit(object, object_pos)
def fps(self, clock):
display_fps = str(int(clock.get_fps()))
render = self.font.render(display_fps, 0, DARKORANGE)
self.sc.blit(render, FPS_POS)