gladiator.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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/gladiator.png",
  30. defaultState = "inactiveright",
  31. states = {
  32. inactiveright = { -- the name of the state is arbitrary
  33. frameCount = 5,
  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. attackright = {
  53. frameCount = 7,
  54. offsetX = 0,
  55. offsetY = 64,
  56. frameW = 32,
  57. frameH = 32,
  58. nextState = "inactiveright",
  59. switchDelay = 0.1
  60. },
  61. -- 4rd line
  62. hurtright = {
  63. frameCount = 3,
  64. offsetX = 0,
  65. offsetY = 96,
  66. frameW = 32,
  67. frameH = 32,
  68. nextState = "inactiveright",
  69. switchDelay = 0.1
  70. },
  71. -- 5a linio
  72. ripright = {
  73. frameCount = 2,
  74. offsetX = 0,
  75. offsetY = 128,
  76. frameW = 32,
  77. frameH = 32,
  78. switchDelay = 0.1
  79. },
  80. -- 1a linio
  81. inactiveleft = { -- the name of the state is arbitrary
  82. frameCount = 5,
  83. offsetX = 0,
  84. offsetY = 160,
  85. frameW = 32,
  86. frameH = 32,
  87. nextState = "inactiveleft", -- we loop the running state
  88. switchDelay = 0.1
  89. },
  90. -- 2nd line
  91. walkleft = {
  92. frameCount = 8,
  93. offsetX = 0,
  94. offsetY = 192,
  95. frameW = 32,
  96. frameH = 32, -- the frame height can change between states
  97. nextState = "walkleft", -- after the jump is finished, we switch back to running
  98. switchDelay = 0.1
  99. },
  100. -- 3rd line
  101. attackleft = {
  102. frameCount = 7,
  103. offsetX = 0,
  104. offsetY = 224,
  105. frameW = 32,
  106. frameH = 32,
  107. nextState = "inactiveleft",
  108. switchDelay = 0.1
  109. },
  110. -- 4rd line
  111. hurtleft = {
  112. frameCount = 3,
  113. offsetX = 0,
  114. offsetY = 256,
  115. frameW = 32,
  116. frameH = 32,
  117. nextState = "inactiveleft",
  118. switchDelay = 0.1
  119. },
  120. -- 5a linio
  121. ripleft = {
  122. frameCount = 2,
  123. offsetX = 0,
  124. offsetY = 288,
  125. frameW = 32,
  126. frameH = 32,
  127. switchDelay = 0.1
  128. }
  129. }
  130. }