Add hurt, die animation when taking damage
This commit is contained in:
@@ -744,6 +744,62 @@ static bool entityHasAnimation(EntityType entity, AnimType type) {
|
||||
}
|
||||
}
|
||||
|
||||
static f32 entityGetAnimationLength(EntityType entity, AnimType type) {
|
||||
switch (entity) {
|
||||
case ENTITY_WORKER:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.9000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_SOLDIER:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.7000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_WARRIOR:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.7000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_MAGE:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.7000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_ORC:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.7000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_GOBLIN:
|
||||
switch (type) {
|
||||
case ANIM_IDLE: return 0.4f;
|
||||
case ANIM_WALK: return 0.72f;
|
||||
case ANIM_HURT: return 0.42000000000000004f;
|
||||
case ANIM_DIE: return 0.7000000000000001f;
|
||||
default: break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
BZ_ASSERT(0);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
static AnimationSequence entityGetAnimationSequence(EntityType entity, AnimType type) {
|
||||
switch (entity) {
|
||||
case ENTITY_WORKER:
|
||||
@@ -807,7 +863,7 @@ static AnimationFrame entityGetAnimationFrame(EntityType entity, AnimType type,
|
||||
case ANIM_IDLE: return ((AnimationFrame []) {{27, 0.2000f}, {28, 0.2000f}}) [frameIdx];
|
||||
case ANIM_WALK: return ((AnimationFrame []) {{29, 0.1800f}, {30, 0.1800f}, {31, 0.1800f}, {30, 0.1800f}}) [frameIdx];
|
||||
case ANIM_HURT: return ((AnimationFrame []) {{32, 0.1400f}, {33, 0.1400f}, {34, 0.1400f}}) [frameIdx];
|
||||
case ANIM_DIE: return ((AnimationFrame []) {{32, 0.1400f}, {33, 0.1400f}, {34, 0.1400f}, {35, 0.1400f}, {36, 0.1400f}}) [frameIdx];
|
||||
case ANIM_DIE: return ((AnimationFrame []) {{32, 0.1400f}, {33, 0.1400f}, {34, 0.1400f}, {35, 0.1400f}, {36, 0.3400f}}) [frameIdx];
|
||||
default: break;
|
||||
}
|
||||
case ENTITY_SOLDIER:
|
||||
|
||||
Reference in New Issue
Block a user