Permalink
Browse files

calculate how many windows to place per floor

in each building
  • Loading branch information...
1 parent 07d8edd commit f152dd7cdc921501ba2e8b638d052f9511cbeac2 @despo committed Apr 2, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 views/gorillas.coffee
View
@@ -24,11 +24,11 @@ class Building
build_windows:(x, y) ->
rows = Math.round (@height)/31
- window_positions = [ 10, 25, 40, 55, 70, 85 ]
+ windows_per_floor = Math.floor(@width/15)
current_distance = 30
total_height = 30
for row in [0...rows]
- @create_window x+position, 620+total_height-@height for position in window_positions
+ @create_window x+(position*15), 620+total_height-@height for position in [1...windows_per_floor]
total_height += current_distance
create_window:(x, y) ->

0 comments on commit f152dd7

Please sign in to comment.