Humble beginnings!
This isn't much more than my own naive implementation for sprite-animation. The little cat can walk (looping animation), look up, lie down (transitional animation), and meow(non-interuptable animation). The current sprite is displayed in a box at the bottom left, together with some variables.
It may be bad and basic but I'm still a BIT proud of it.
I'll prolly expand this into an actual game at some point, would be a shame to let the cat sprites go to waste, nyohohee~
[0x0] | |
@JCD
This is the first thing I ever coded in Pico8.
(Do have some coding experience in Python and Haskell however, so Lua was actually easier than previous languages haha)
Is the complexity good or bad? I was just attempting to make my code modular so I can expand it easily later on and reuse as much code as possible, hence the anims() function
ALSO, most of the scary looking code is just that stuff inside the _draw function! thats just for when you hold the button down for displaying all the "debug info" haha
@JCD
I shouldve been nicer to code-readers and document my code, so I'll just qwuickly do it here:
{
x=16, -- these two are coords
y=64,
lf=false, -- "lf" is a variable short for "left-facing". keeps track of wether I need to flip my sprite
t=0, -- short for "tick", a tick counter used for the animation
s=0, -- "state", needed to check what the character was doing the previous frame for animations
ns=0, -- "new state", like state, but for the current frame instead for the previous
vel=0, -- velocity
acc=.5, -- acceleration
spr=0 -- current sprite
}
[Please log in to post a comment]