Advertisement
Guest User

Untitled

a guest
Jan 28th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. print ("""-- title: gen-gen
  2. -- author: catpants via a python script
  3. -- desc: uses rect() to generate patterns. lua script is generated via a python script since it's all really annoying math and who has time for editing lots of values when computers can do it?
  4. -- script: lua
  5. t=0
  6. x=0
  7. y=0
  8. function TIC()
  9.  
  10. if btn(0) then y=y-1 end
  11. if btn(1) then y=y+1 end
  12. if btn(2) then x=x-1 end
  13. if btn(3) then x=x+1 end
  14.  
  15. """)
  16.  
  17.  
  18.  
  19.  
  20.  
  21. resx = 240
  22. resy = 136
  23.  
  24. curxl = 0
  25. curxr = resx
  26. curyt = 0
  27. curyb = resy
  28.  
  29. diff = 2
  30. rdiff = diff * -1
  31. rangevar = int((240/2)/diff)
  32. rangevarv = int(((240/2)/diff)/1.7)
  33.  
  34. defaulttimevar = 0
  35.  
  36.  
  37. #left ((240/2)/diff)
  38. timeformula = defaulttimevar
  39. for each in range(rangevar):
  40. print ("""for borderx={},{} do""".format(curxl,curxl+diff))
  41. print (""" for bordery={},{} do""".format(curyt,curyb))
  42. print (" rect (borderx,bordery,1,1,((x+y)*(t/{})))".format(timeformula))
  43. print (""" end""")
  44. print ("""end""")
  45. curxl += diff
  46. curxr -= diff
  47. curyt += diff
  48. curyb -= diff
  49. timeformula += 1
  50.  
  51. curxl = 0
  52. curxr = resx
  53. curyt = 0
  54. curyb = resy
  55.  
  56. #right
  57. timeformula = defaulttimevar
  58. for each in range(rangevar):
  59. print ("""for borderx={},{} do""".format(curxr-diff,curxr))
  60. print (""" for bordery={},{} do""".format(curyt,curyb))
  61. print (""" rect (borderx,bordery,1,1,((x+y)*(t/{})))""".format(timeformula))
  62. print (""" end""")
  63. print ("""end""")
  64. curxl += diff
  65. curxr -= diff
  66. curyt += diff
  67. curyb -= diff
  68. timeformula += 1
  69.  
  70.  
  71.  
  72. #top
  73. curxl = diff
  74. curxr = resx-diff
  75. curyt = 0
  76. curyb = resy
  77. timeformula = defaulttimevar
  78. for each in range(rangevarv):
  79. print ("""for borderx={},{} do""".format(curxl,curxr))
  80. print (""" for bordery={},{} do""".format(curyt,curyt+diff))
  81. print (""" rect (borderx,bordery,1,1,((x+y)*(t/{})))""".format(timeformula))
  82. print (""" end""")
  83. print ("""end""")
  84. curxl += diff
  85. curxr -= diff
  86. curyt += diff
  87. curyb -= diff
  88. timeformula += 1
  89.  
  90. #bottom
  91. curxl = diff
  92. curxr = resx-diff
  93. curyt = 0
  94. curyb = resy
  95. timeformula = defaulttimevar
  96. for each in range(rangevarv):
  97. print ("""for borderx={},{} do""".format(curxl,curxr))
  98. print (""" for bordery={},{} do""".format(curyb-diff,curyb))
  99. print (""" rect (borderx,bordery,1,1,((x+y)*(t/{})))""".format(timeformula))
  100. print (""" end""")
  101. print ("""end""")
  102. curxl += diff
  103. curxr -= diff
  104. curyt += diff
  105. curyb -= diff
  106. timeformula += 1
  107.  
  108. print ("""
  109. t=t+1
  110. end""")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement