Skip to content

Instantly share code, notes, and snippets.

@ISSOtm
Created July 29, 2021 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ISSOtm/88e0174d3be338e832c11112172d08d7 to your computer and use it in GitHub Desktop.
Save ISSOtm/88e0174d3be338e832c11112172d08d7 to your computer and use it in GitHub Desktop.
Metasprite animation definition
MACRO nb_cels
REDEF NB_CELS equs "_NB_CELS\@"
db {NB_CELS}
DEF {NB_CELS} = 0
ENDM
MACRO cel
db (\1) ; Amount of frames to display this cel during
REDEF {NB_CELS} = {NB_CELS} + (\1)
dw (\2) ; Ptr to cel
ENDM
PlayerDownWalkingDraw:
nb_cels ; Total animation length (it wraps after this)
cel $10, PlayerDownStandingFrame
cel $10, .frame0
cel $10, PlayerDownStandingFrame
cel $10, .frame1
; (it would be nice to also guarantee that $40 = $10 + $10 + $10 + $10 somehow)
MACRO nb_objs
REDEF _NUM_OBJS EQUS "_NUM_OBJS_\@"
db {_NUM_OBJS}
DEF {_NUM_OBJS} = 0
ENDM
MACRO obj
db (\1), (\2), (\3), (\4) ; y, x, tile, attr
REDEF {_NUM_OBJS} = {_NUM_OBJS} + 1
ENDM
dw PlayerDownWalkingTiles ; ... the player is a bit special, ignore this
.frame0
nb_objs
obj -27, -12, 0, 0 ; (-12, -27) from the actor position, which is between its feet
obj -27, -4, 2, 0
obj -27, 4, 4, 0
obj -11, -8, 6, 0
obj -11, 0, 8, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment