diff options
| author | realtradam <[email protected]> | 2021-05-07 03:25:52 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-05-07 03:25:52 -0400 |
| commit | 625042cef2f11211ab4cae145ea5cf309994312e (patch) | |
| tree | 90411ea9a754d45e0dc0174d965f80158268ea86 /tileset.rb | |
| parent | 200d6ec73caf9c070375a972677c4c0af7c444ba (diff) | |
| download | tileset-map-editor-625042cef2f11211ab4cae145ea5cf309994312e.tar.gz tileset-map-editor-625042cef2f11211ab4cae145ea5cf309994312e.zip | |
added input wrapper
Diffstat (limited to 'tileset.rb')
| -rw-r--r-- | tileset.rb | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -7,7 +7,6 @@ class Tileset :width, :height def initialize(directory, width, height) - puts directory @width = width @height = height if directory[-1] == '/' @@ -16,20 +15,16 @@ class Tileset directory = "#{directory}/*" end - puts directory images = Dir[directory].sort factors = divisors_of(images.length) - puts factors @columns = factors[factors.length / 2] @rows = factors[(factors.length / 2) - 1] - @tileset = Array.new(@columns, nil) { Array.new(@rows, nil) } + @tileset = Array.new(@columns) { Array.new(@rows, nil) } images.each_with_index do |image, index| x = index % @columns - puts "Image #{index} is #{image}" #@tileset[x] = [] if @tileset[x].nil? @tileset[x][((index - x) / @columns)] = image - #puts @tileset[x][((index - x) / 23)] end end |
