SZI2020Project/helpler.py

26 lines
614 B
Python
Raw Normal View History

2020-03-30 20:34:43 +02:00
from models.Road import Road
2020-05-05 01:58:05 +02:00
from models.__grass__ import Grass
from models.__house__ import House
2020-04-02 19:53:39 +02:00
from models.Trash import Trash
2020-05-05 01:49:26 +02:00
from config import MAP_HEIGHT, MAP_WIDTH, MAP
2020-03-30 20:34:43 +02:00
2020-05-05 01:49:26 +02:00
def __render_element__(__x__, __y__):
item = MAP[__y__][__x__]
2020-03-30 20:34:43 +02:00
if item == "Road":
2020-05-05 01:49:26 +02:00
return Road(__x__, __y__)
if item == "Grass":
return Grass(__x__, __y__)
if item == "House":
return House(__x__, __y__)
2020-04-21 22:18:37 +02:00
2020-05-05 01:49:26 +02:00
return Trash(__x__, __y__, item)
2020-04-21 22:18:37 +02:00
2020-05-05 01:49:26 +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