123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- --
- -- 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/gladiator.png",
- defaultState = "inactiveright",
- states = {
- inactiveright = { -- the name of the state is arbitrary
- frameCount = 5,
- 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
- attackright = {
- frameCount = 7,
- offsetX = 0,
- offsetY = 64,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 4rd line
- hurtright = {
- frameCount = 3,
- offsetX = 0,
- offsetY = 96,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveright",
- switchDelay = 0.1
- },
- -- 5a linio
- ripright = {
- frameCount = 2,
- offsetX = 0,
- offsetY = 128,
- frameW = 32,
- frameH = 32,
- switchDelay = 0.1
- },
- -- 1a linio
- inactiveleft = { -- the name of the state is arbitrary
- frameCount = 5,
- offsetX = 0,
- offsetY = 160,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft", -- we loop the running state
- switchDelay = 0.1
- },
- -- 2nd line
- walkleft = {
- frameCount = 8,
- offsetX = 0,
- offsetY = 192,
- 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
- attackleft = {
- frameCount = 7,
- offsetX = 0,
- offsetY = 224,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 4rd line
- hurtleft = {
- frameCount = 3,
- offsetX = 0,
- offsetY = 256,
- frameW = 32,
- frameH = 32,
- nextState = "inactiveleft",
- switchDelay = 0.1
- },
- -- 5a linio
- ripleft = {
- frameCount = 2,
- offsetX = 0,
- offsetY = 288,
- frameW = 32,
- frameH = 32,
- switchDelay = 0.1
- }
- }
- }
|