123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- --
- -- LOVE2D ANIMATION
- --
- --
- -- This file will be loaded through love.filesystem.load
- -- This file describes the different states and frames of the animation
- --
- --[[
- Each sprite sheet contains one or multiple states
- Each states is represented as a line in the image file
- The following object describes the different states
- Switching between different states can be done through code
- members ->
- imageSrc : path to the image (png, tga, bmp or jpg)
- defaultState : the first state
- states : a table containing each state
- (State)
- Each state contains the following members ->
- frameCount : the number of frames in the state
- offsetX : starting from the left, the position (in px) of the first frame of the state (aka on the line)
- offsetY : starting from the top, the position of the line (px)
- framwW : the width of each frame in the state
- frameH : the height of each frame in the state
- nextState : the state which will follow after the last frame is reached
- switchDelay : the time between each frame (seconds as floating point)
- ]]
- -- the return statement is mandatory
- return {
- imageSrc = "art/adventurer.png",
- defaultState = "inactiveright",
- states = {
- inactiveright = { -- the name of the state is arbitrary
- frameCount = 13,
- offsetX = 0,
- offsetY = 0,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright", -- we loop the running state
- switchDelay = 0.1
- },
- -- 2nd line
- walkright = {
- frameCount = 8,
- offsetX = 0,
- offsetY = 32,
- frameW = 32,
- frameH = 32, -- the frame height can change between states
- nextState = "walkright", -- after the jump is finished, we switch back to running
- switchDelay = 0.1
- },
- -- 3rd line
- jump_attackright = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 64,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 4rd line
- attackright = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 96,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 5a linio
- strangeright = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 128,
- frameW = 32,
- frameH = 32,
- nextState = "strangeright",
- switchDelay = 0.1
- },
- -- 6a linio
- jumpright = {
- frameCount = 6,
- offsetX = 0,
- offsetY = 160,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 7a linio
- hurtright = {
- frameCount = 4,
- offsetX = 0,
- offsetY = 192,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 8a linio
- ripright = {
- frameCount = 7,
- offsetX = 0,
- offsetY = 224,
- frameW = 32,
- frameH = 32,
- switchDelay = 0.5
- },
- -- 1st line
- inactiveleft = { -- the name of the state is arbitrary
- frameCount = 13,
- offsetX = 0,
- offsetY = 256,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright", -- we loop the running state
- switchDelay = 0.1
- },
- -- 2nd line
- walkleft = {
- frameCount = 8,
- offsetX = 0,
- offsetY = 288,
- frameW = 32,
- frameH = 32, -- the frame height can change between states
- nextState = "walkleft", -- after the jump is finished, we switch back to running
- switchDelay = 0.1
- },
- -- 3rd line
- jump_attackleft = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 320,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 4rd line
- attackleft = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 352,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 5a linio
- strangeleft = {
- frameCount = 10,
- offsetX = 0,
- offsetY = 384,
- frameW = 32,
- frameH = 32,
- nextState = "strangeleft",
- switchDelay = 0.1
- },
- -- 6a linio
- jumpleft = {
- frameCount = 6,
- offsetX = 0,
- offsetY = 416,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 7a linio
- hurtleft = {
- frameCount = 4,
- offsetX = 0,
- offsetY = 448,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 8a linio
- ripleft = {
- frameCount = 7,
- offsetX = 0,
- offsetY = 480,
- frameW = 32,
- frameH = 32,
- switchDelay = 0.5
- }
- }
- }
|