plunger.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/plunger.png",
  30. defaultState = "inactiveright",
  31. states = {
  32. inactiveright = { -- the name of the state is arbitrary
  33. frameCount = 4,
  34. offsetX = 0,
  35. offsetY = 0,
  36. frameW = 16,
  37. frameH = 16,
  38. nextState = "inactiveright", -- we loop the running state
  39. switchDelay = 0.1
  40. },
  41. -- 1st line
  42. inactiveleft = { -- the name of the state is arbitrary
  43. frameCount = 4,
  44. offsetX = 0,
  45. offsetY = 0,
  46. frameW = 16,
  47. frameH = 16,
  48. nextState = "inactiveleft", -- we loop the running state
  49. switchDelay = 0.1
  50. },
  51. ripright = { -- the name of the state is arbitrary
  52. frameCount = 4,
  53. offsetX = 0,
  54. offsetY = 16,
  55. frameW = 16,
  56. frameH = 16,
  57. switchDelay = 0.5
  58. },
  59. ripleft = { -- the name of the state is arbitrary
  60. frameCount = 4,
  61. offsetX = 0,
  62. offsetY = 16,
  63. frameW = 16,
  64. frameH = 16,
  65. switchDelay = 0.5
  66. }
  67. }
  68. }