Permalink
Browse files

Minimum height difference for BuildingGenerator

  • Loading branch information...
1 parent 2a05348 commit df3300e3079f52e21eb7618299c945c9eabe1ed7 @dhotson dhotson committed Jan 15, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 asc.rb
View
5 asc.rb
@@ -234,7 +234,10 @@ def maximum_height_delta; 10 end
def minimum_height_clearance; 20; end
def next_y previous_building
p = previous_building
- delta = maximum_height_delta * -1 + rand(2 * maximum_height_delta + 1)
+ delta = 0
+ while delta.abs <= 1
+ delta = maximum_height_delta * -1 + rand(2 * maximum_height_delta + 1)
+ end
[25, [previous_building.y - delta, minimum_height_clearance].max].min
end
def build x, y, width

0 comments on commit df3300e

Please sign in to comment.