-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.py
More file actions
43 lines (34 loc) · 1.51 KB
/
Tile.py
File metadata and controls
43 lines (34 loc) · 1.51 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
43
import Render_functions
import pygame
class Tile():
def __init__(self, coords, state, ID):
self.cor = coords # Положение блока на тайловой сетке
self.state = state # Статус блока: "passable" - проходимый, "impassable" - непроходимый
self.ID = ID
def set_coords(self, cor):
self.cor = cor
class Floor(Tile):
def __init__(self,coords, img, ID, state="passable"):
Tile.__init__(self,coords, state,ID)
self.image = Render_functions.load_image(img,alpha_cannel=True)
def render(self,screen):
screen.blit(self.image, (self.cor[0]*100,self.cor[1]*100))
class Wall(Tile):
def __init__(self,coords,img, ID, state="impassable",rotate = "D"):
Tile.__init__(self,coords, state, ID)
self.image = Render_functions.load_image(img,alpha_cannel=True)
self.render_image = self.image
self.rotate = rotate
self.set_rotate(self.rotate)
def set_rotate(self,rotate):
self.rotate = rotate
if rotate == "R":
self.render_image = pygame.transform.rotate(self.image,90)
elif rotate == "L":
self.render_image = pygame.transform.rotate(self.image,-90)
elif rotate == "U":
self.render_image = pygame.transform.rotate(self.image,180)
elif rotate == "D":
self.render_image = self.image
def render(self,screen):
screen.blit(self.render_image, (self.cor[0]*100,self.cor[1]*100))