Added covers, cross-fade

This commit is contained in:
Vladislav Khorev committed 2026-05-15 14:59:58 +03:00
1 parent 0f2b2e55af
commit e618c91415
29 files changed
+40462 -29

No files matched your search

+6 -2
View File
@@ -13,6 +13,7 @@ namespace ZL {
extern float x;
extern float y;
const float ATTACK_RANGE = 1.25f;
const float VISIBLE_RANGE = 6.f;
void Character::loadAnimation(AnimationState state, const std::string& filename, const std::string& zipFile) {
auto& data = animations[state];
@@ -180,7 +181,7 @@ void Character::update(int64_t deltaMs) {
if (attackTarget != nullptr)
{
float distToGhost = (attackTarget->position - position).norm();
if (distToGhost >= 10.f)
if (distToGhost >= VISIBLE_RANGE)
{
if (isPlayer)
{
@@ -189,7 +190,7 @@ void Character::update(int64_t deltaMs) {
battle_state = 0;
}
else if (distToGhost < 10.0f && distToGhost >= ATTACK_RANGE) {
else if (distToGhost < VISIBLE_RANGE && distToGhost >= ATTACK_RANGE) {
setTarget(attackTarget->position);
battle_state = 0;
}
@@ -721,6 +722,9 @@ void Character::drawWithShadow(Renderer& renderer, const Eigen::Matrix4f& lightF
hitSparkEmitter.draw(renderer, 1.0f, Environment::width, Environment::height, false);
}
renderer.RenderUniform1f("uAlpha", 1.0f);
glDisable(GL_BLEND);
if (!isPlayer && hp <= 0)
{
return;