Fix overflow with room max height and width
This commit is contained in:
parent
df033d257c
commit
1539bcc057
1 changed files with 3 additions and 3 deletions
|
@ -10,7 +10,7 @@ import random
|
||||||
TILE_SIZE_X = 16
|
TILE_SIZE_X = 16
|
||||||
TILE_SIZE_Y = 16
|
TILE_SIZE_Y = 16
|
||||||
|
|
||||||
MIN_LEAF_SIZE = 7
|
MIN_LEAF_SIZE = 8
|
||||||
|
|
||||||
|
|
||||||
class Leaf:
|
class Leaf:
|
||||||
|
@ -71,8 +71,8 @@ class Leaf:
|
||||||
def generate_room(self):
|
def generate_room(self):
|
||||||
x = random.randint(self.x+1, self.x+2)
|
x = random.randint(self.x+1, self.x+2)
|
||||||
y = random.randint(self.y+1, self.y+2)
|
y = random.randint(self.y+1, self.y+2)
|
||||||
w = random.randint(3, self.width-1)
|
w = random.randint(MIN_LEAF_SIZE / 2, self.width - 2)
|
||||||
h = random.randint(3, self.height-1)
|
h = random.randint(MIN_LEAF_SIZE / 2, self.height - 2)
|
||||||
return Room(x, y, w, h, self.id)
|
return Room(x, y, w, h, self.id)
|
||||||
|
|
||||||
def draw(self, ground):
|
def draw(self, ground):
|
||||||
|
|
Loading…
Reference in a new issue