Guest User

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

a guest
Dec 9th, 2014
283
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data