sprite animation testing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.4KB

4 years ago
3 years ago
4 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. = tA's terribleAssembly =
  2. just me messing about trying to learn gameboy assembly
  3. currently have an animation engine supporting:
  4. * arbitary sized frames
  5. * multiple actors
  6. * multiple animation states per actor (up to 128)
  7. * arbitary number of frames
  8. * arbitary time per frame of animation
  9. * distinct animation timers per actor
  10. * distinct colour palletes per tile in frame (limit 2 as per hardware)
  11. * arbitary position of tiles in the tile bank per actor type
  12. * arbitary positioning of tiles in each frame, including overlapping
  13. == requisites ==
  14. built using `rgbds`, will need to be installed for makefile to compile
  15. == running ==
  16. simply run `make` in the root directory to build the ROM
  17. will appear as a `.gb` file in `./build`
  18. == actor format ==
  19. each actor has the following header:
  20. ```
  21. ActorROM::
  22. .structs:
  23. dw ActorIdle
  24. dw VillagerWaving
  25. ```
  26. where each pointer under `.structs` is another structure in memory. these pointers may be shared between different actor definitions, however the tilesets for each actor will need to be compatible with the same animation for this to work.
  27. each animation state has the following definition:
  28. ```
  29. VillagerWaving::
  30. db 90
  31. db 15
  32. dw .vwFrame01
  33. db 15
  34. dw .vwFrame02
  35. db 15
  36. dw .vwFrame03
  37. db 15
  38. dw .vwFrame04
  39. db 15
  40. dw .vwFrame05
  41. db 15
  42. dw .vwFrame06
  43. ```
  44. the first byte contains the total number of frames this animation will run for, and then each following set of 3 bytes contains:
  45. * the number of ticks this animation frame persists for
  46. * a pointer to the frame data
  47. each frame has the following data:
  48. ```
  49. .vwFrame01
  50. db (.vwFrame01End - @) / 4
  51. db 8, -16, 17, 0
  52. db 8, -8, 18, 0
  53. db 0, -16, 19, OAMF_PAL1
  54. db 0, -8, 20, OAMF_PAL1
  55. db -8, -16, 21, 0
  56. db -8, -8, 22, 0
  57. .vwFrame01End
  58. ```
  59. the first byte is the number of tiles present in this frame of animation (analogous to the number of lines in the frame struct).
  60. each following line is 4 bytes, pertaining to (respectively):
  61. * the x offset of this tile
  62. * the y offset of this tile
  63. * the tile offset
  64. * the attributes byte
  65. the position offsets do not need to take into account the gameboys blanket sprite offsets, and the tile offset is zero indexed, and will be added to another offset based on where this actors tiles lie in memory.
  66. the attribute byte is `xor`ed with the defaults in order to facilitate other pallettes or tile flips.