Guest User

Sprite Sheet Maker for http://opengameart.org/content/tuscan

a guest
Dec 9th, 2014
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.59 KB | None | 0 0
  1. def getFileNumber(fileName)
  2.     parts = fileName.split('_')
  3.     return parts[parts.length-1].split('.')[0];
  4. end
  5.  
  6. source      = ARGV[0]
  7. destination = ARGV[1]
  8.  
  9. direction = 0
  10. command = "convert \\("
  11. images = Dir.entries("./#{source}").sort
  12. images.each do |imageFile|
  13.     next if imageFile == '.' or imageFile == '..'
  14.  
  15.     fileNumber = getFileNumber(imageFile)
  16.     if (fileNumber[0].to_i > direction)
  17.         direction += 1
  18.         command.concat(" +append \\) \\(")
  19.     end
  20.     command.concat(" #{source}/#{imageFile} ")
  21. end
  22.  
  23. command.concat(" +append \\) -background none -append #{destination}")
  24. system(command)
Add Comment
Please, Sign In to add comment