adventurer.lua 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. --
  2. -- LOVE2D ANIMATION
  3. --
  4. --
  5. -- This file will be loaded through love.filesystem.load
  6. -- This file describes the different states and frames of the animation
  7. --
  8. --[[
  9. Each sprite sheet contains one or multiple states
  10. Each states is represented as a line in the image file
  11. The following object describes the different states
  12. Switching between different states can be done through code
  13. members ->
  14. imageSrc : path to the image (png, tga, bmp or jpg)
  15. defaultState : the first state
  16. states : a table containing each state
  17. (State)
  18. Each state contains the following members ->
  19. frameCount : the number of frames in the state
  20. offsetX : starting from the left, the position (in px) of the first frame of the state (aka on the line)
  21. offsetY : starting from the top, the position of the line (px)
  22. framwW : the width of each frame in the state
  23. frameH : the height of each frame in the state
  24. nextState : the state which will follow after the last frame is reached
  25. switchDelay : the time between each frame (seconds as floating point)
  26. ]]
  27. -- the return statement is mandatory
  28. return {
  29. imageSrc = "art/adventurer.png",
  30. defaultState = "inactiveright",
  31. states = {
  32. inactiveright = { -- the name of the state is arbitrary
  33. frameCount = 13,
  34. offsetX = 0,
  35. offsetY = 0,
  36. frameW = 32,
  37. frameH = 32,
  38. nextState = "inactiveright", -- we loop the running state
  39. switchDelay = 0.1
  40. },
  41. -- 2nd line
  42. walkright = {
  43. frameCount = 8,
  44. offsetX = 0,
  45. offsetY = 32,
  46. frameW = 32,
  47. frameH = 32, -- the frame height can change between states
  48. nextState = "walkright", -- after the jump is finished, we switch back to running
  49. switchDelay = 0.1
  50. },
  51. -- 3rd line
  52. jump_attackright = {
  53. frameCount = 10,
  54. offsetX = 0,
  55. offsetY = 64,
  56. frameW = 32,
  57. frameH = 32,
  58. nextState = "inactiveright",
  59. switchDelay = 0.1
  60. },
  61. -- 4rd line
  62. attackright = {
  63. frameCount = 10,
  64. offsetX = 0,
  65. offsetY = 96,
  66. frameW = 32,
  67. frameH = 32,
  68. nextState = "inactiveright",
  69. switchDelay = 0.1
  70. },
  71. -- 5a linio
  72. strangeright = {
  73. frameCount = 10,
  74. offsetX = 0,
  75. offsetY = 128,
  76. frameW = 32,
  77. frameH = 32,
  78. nextState = "strangeright",
  79. switchDelay = 0.1
  80. },
  81. -- 6a linio
  82. jumpright = {
  83. frameCount = 6,
  84. offsetX = 0,
  85. offsetY = 160,
  86. frameW = 32,
  87. frameH = 32,
  88. nextState = "inactiveright",
  89. switchDelay = 0.1
  90. },
  91. -- 7a linio
  92. hurtright = {
  93. frameCount = 4,
  94. offsetX = 0,
  95. offsetY = 192,
  96. frameW = 32,
  97. frameH = 32,
  98. nextState = "inactiveright",
  99. switchDelay = 0.1
  100. },
  101. -- 8a linio
  102. ripright = {
  103. frameCount = 7,
  104. offsetX = 0,
  105. offsetY = 224,
  106. frameW = 32,
  107. frameH = 32,
  108. switchDelay = 0.5
  109. },
  110. -- 1st line
  111. inactiveleft = { -- the name of the state is arbitrary
  112. frameCount = 13,
  113. offsetX = 0,
  114. offsetY = 256,
  115. frameW = 32,
  116. frameH = 32,
  117. nextState = "inactiveright", -- we loop the running state
  118. switchDelay = 0.1
  119. },
  120. -- 2nd line
  121. walkleft = {
  122. frameCount = 8,
  123. offsetX = 0,
  124. offsetY = 288,
  125. frameW = 32,
  126. frameH = 32, -- the frame height can change between states
  127. nextState = "walkleft", -- after the jump is finished, we switch back to running
  128. switchDelay = 0.1
  129. },
  130. -- 3rd line
  131. jump_attackleft = {
  132. frameCount = 10,
  133. offsetX = 0,
  134. offsetY = 320,
  135. frameW = 32,
  136. frameH = 32,
  137. nextState = "inactiveleft",
  138. switchDelay = 0.1
  139. },
  140. -- 4rd line
  141. attackleft = {
  142. frameCount = 10,
  143. offsetX = 0,
  144. offsetY = 352,
  145. frameW = 32,
  146. frameH = 32,
  147. nextState = "inactiveleft",
  148. switchDelay = 0.1
  149. },
  150. -- 5a linio
  151. strangeleft = {
  152. frameCount = 10,
  153. offsetX = 0,
  154. offsetY = 384,
  155. frameW = 32,
  156. frameH = 32,
  157. nextState = "strangeleft",
  158. switchDelay = 0.1
  159. },
  160. -- 6a linio
  161. jumpleft = {
  162. frameCount = 6,
  163. offsetX = 0,
  164. offsetY = 416,
  165. frameW = 32,
  166. frameH = 32,
  167. nextState = "inactiveleft",
  168. switchDelay = 0.1
  169. },
  170. -- 7a linio
  171. hurtleft = {
  172. frameCount = 4,
  173. offsetX = 0,
  174. offsetY = 448,
  175. frameW = 32,
  176. frameH = 32,
  177. nextState = "inactiveleft",
  178. switchDelay = 0.1
  179. },
  180. -- 8a linio
  181. ripleft = {
  182. frameCount = 7,
  183. offsetX = 0,
  184. offsetY = 480,
  185. frameW = 32,
  186. frameH = 32,
  187. switchDelay = 0.5
  188. }
  189. }
  190. }