-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtile.py
More file actions
27 lines (22 loc) · 939 Bytes
/
Copy pathtile.py
File metadata and controls
27 lines (22 loc) · 939 Bytes
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
import const
import math
import pygame
class Tile:
def redraw_tile(self, screen):
pygame.draw.rect(screen, self.color,
pygame.Rect(self.location_for_draw[0],
self.location_for_draw[1], const.TILE_SIZE,
const.TILE_SIZE), 2)
def __init__(self, screen, size, location_arr, color, state, tile_type,
is_path=None):
self.location_for_draw = location_arr
self.location = [math.ceil(location_arr[0] + const.TILE_SIZE / 2),
math.ceil(location_arr[1] + const.TILE_SIZE / 2)]
self.color = color
self.state = state
self.type = tile_type
self.previous = None
self.next = None
self.is_path = is_path
pygame.draw.rect(screen, color, pygame.Rect(location_arr[0],
location_arr[1], size, size), 2)