styling
This commit is contained in:
parent
72d63e04ae
commit
6fe1829459
@ -1,12 +1,12 @@
|
||||
from models.__garbage_collector__ import GarbageCollector
|
||||
from helpler import Render_Element
|
||||
from helpler import __render_element__
|
||||
from config import MAP_WIDTH, MAP_HEIGHT
|
||||
|
||||
|
||||
class GcEnv:
|
||||
|
||||
def __init__(self):
|
||||
self.draw_items = {(x, y): Render_Element(x, y)
|
||||
self.draw_items = {(x, y): __render_element__(x, y)
|
||||
for x in range(MAP_WIDTH) for y in range(MAP_HEIGHT)}
|
||||
self.__gc__ = GarbageCollector(self.draw_items)
|
||||
self.actions = {
|
||||
|
29
helpler.py
29
helpler.py
@ -1,22 +1,25 @@
|
||||
from config import MAP
|
||||
from models.Road import Road
|
||||
from models.Grass import Grass
|
||||
from models.House import House
|
||||
from config import MAP_HEIGHT, MAP_WIDTH
|
||||
from models.Trash import Trash
|
||||
from config import MAP_HEIGHT, MAP_WIDTH, MAP
|
||||
|
||||
|
||||
def Render_Element(x, y):
|
||||
item = MAP[y][x]
|
||||
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)
|
||||
else:
|
||||
return Trash(x, y, item)
|
||||
return Road(__x__, __y__)
|
||||
if item == "Grass":
|
||||
return Grass(__x__, __y__)
|
||||
if item == "House":
|
||||
return House(__x__, __y__)
|
||||
|
||||
return Trash(__x__, __y__, item)
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user