Finished Part 3. Turned off tunnels for now. Will probably rework it a little before continuing to Part 4. The way they're handled now is messy.
This commit is contained in:
@@ -10,4 +10,22 @@ class Tile:
|
||||
if block_sight is None:
|
||||
block_sight = blocked
|
||||
|
||||
self.block_sight = block_sight
|
||||
self.block_sight = block_sight
|
||||
|
||||
|
||||
class Rect:
|
||||
def __init__(self, x, y, w, h):
|
||||
self.x1 = x
|
||||
self.y1 = y
|
||||
self.x2 = x + w
|
||||
self.y2 = y + h
|
||||
|
||||
def center(self):
|
||||
center_x = int((self.x1 + self.x2) /2 )
|
||||
center_y = int((self.y1 + self.y2) /2 )
|
||||
return (center_x, center_y)
|
||||
|
||||
def intersect(self, other):
|
||||
# returns true if this room overlaps another
|
||||
return (self.x1 <= other.x2 and self.x2 >= other.x1 and
|
||||
self.y1 <= other.y2 and self.y2 >= other.y1)
|
||||
Reference in New Issue
Block a user