refactor: centralize system names, component types, entity types, and animation states into a new Constants module.

This commit is contained in:
Juan Sebastián Montoya 2026-01-06 18:58:12 -05:00
parent e9db84abd1
commit 3db2bb9160
20 changed files with 385 additions and 313 deletions

View file

@ -1,3 +1,5 @@
import { EntityType, AnimationState } from './Constants.js';
/**
* Sprite Library defining pixel art grids as 2D arrays.
* 0: Transparent
@ -7,8 +9,8 @@
*/
export const SpriteLibrary = {
// 8x8 Slime - Bottom-heavy blob
slime: {
idle: [
[EntityType.SLIME]: {
[AnimationState.IDLE]: [
[
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 1, 1, 0, 0], // Top
@ -30,7 +32,7 @@ export const SpriteLibrary = {
[1, 1, 1, 1, 1, 1, 1, 1] // Squashed base
]
],
walk: [
[AnimationState.WALK]: [
[
[0, 0, 1, 1, 1, 1, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 0],
@ -55,8 +57,8 @@ export const SpriteLibrary = {
},
// 8x8 Humanoid - Simple Walk Cycle
humanoid: {
idle: [
[EntityType.HUMANOID]: {
[AnimationState.IDLE]: [
[
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 2, 1, 1, 2, 0, 0],
@ -68,7 +70,7 @@ export const SpriteLibrary = {
[0, 0, 1, 0, 0, 1, 0, 0]
]
],
walk: [
[AnimationState.WALK]: [
[
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 2, 1, 1, 2, 0, 0],
@ -93,8 +95,8 @@ export const SpriteLibrary = {
},
// 8x8 Beast - Bounding Cycle
beast: {
idle: [
[EntityType.BEAST]: {
[AnimationState.IDLE]: [
[
[0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 0, 0, 1],
@ -106,7 +108,7 @@ export const SpriteLibrary = {
[0, 1, 0, 0, 0, 0, 1, 0]
]
],
walk: [
[AnimationState.WALK]: [
[
[1, 0, 0, 0, 0, 0, 0, 1],
[0, 1, 1, 1, 1, 1, 1, 0],
@ -131,8 +133,8 @@ export const SpriteLibrary = {
},
// 8x8 Elemental - Floating Pulse
elemental: {
idle: [
[EntityType.ELEMENTAL]: {
[AnimationState.IDLE]: [
[
[0, 0, 2, 1, 1, 2, 0, 0],
[0, 1, 1, 2, 2, 1, 1, 0],
@ -156,8 +158,8 @@ export const SpriteLibrary = {
]
},
projectile: {
idle: [
[EntityType.PROJECTILE]: {
[AnimationState.IDLE]: [
[
[1, 1],
[1, 1]