Add idle animation

This commit is contained in:
2023-12-05 11:25:56 +01:00
parent abc8cf2b48
commit 0d137ffb25
14 changed files with 344 additions and 30 deletions

47
game/utils/entity_types.h Normal file
View File

@@ -0,0 +1,47 @@
#ifndef ENTITY_TYPES
#define ENTITY_TYPES
#include <breeze.h>
typedef enum EntityType {
ENTITY_WORKER = 0,
ENTITY_AXE = 64,
} EntityType;
typedef enum AnimationType {
ANIM_WALK,
ANIM_IDLE,
} AnimationType;
typedef struct AnimationSequence {
i32 startFrame;
i32 frameCount;
} AnimationSequence;
static bool entityHasAnimation(EntityType entity, AnimationType anim) {
switch (entity) {
case ENTITY_WORKER: {
switch (anim) {
case ANIM_IDLE:
case ANIM_WALK:
return true;
}
break;
}
}
return false;
}
static AnimationSequence getEntityAnimation(EntityType entity, AnimationType anim) {
switch (entity) {
case ENTITY_WORKER: {
switch (anim) {
case ANIM_IDLE: return (AnimationSequence) {0, 2};
case ANIM_WALK: return (AnimationSequence) {2, 4};
}
}
}
BZ_ASSERT(0);
}
#endif // ENTITY_TYPES