SZI2020Project/helpler.py

23 lines
579 B
Python
Raw Normal View History

2020-03-30 20:34:43 +02:00
from config import MAP
from models.Road import Road
from models.Grass import Grass
from models.House import House
2020-04-21 22:18:37 +02:00
from config import MAP_HEIGHT, MAP_WIDTH
2020-04-02 19:53:39 +02:00
from models.Trash import Trash
2020-03-30 20:34:43 +02:00
def Render_Element(x, y):
item = MAP[y][x]
if item == "Road":
return Road(x, y)
elif item == "Grass":
return Grass(x, y)
elif item == "House":
return House(x, y)
2020-04-02 19:53:39 +02:00
else:
return Trash(x, y, item)
2020-04-21 22:18:37 +02:00
def is_within_width(item): return item[0] >= 0 and item[0] < MAP_WIDTH
def is_within_height(item): return item[1] >= 0 and item[1] < MAP_HEIGHT