Working on viewing distance for enemies
This commit is contained in:
1 parent
33c2b313af
commit
38e45d67b8
6 files changed
+17
-5
No files matched your search
+3
-4
@@ -16,8 +16,7 @@ namespace ZL {
|
||||
extern float x;
|
||||
extern float y;
|
||||
const float ATTACK_RANGE = 1.25f;
|
||||
const float VISIBLE_RANGE = 6.f;
|
||||
|
||||
|
||||
Dialogue::TranslationDatabase Character::nameTranslations;
|
||||
|
||||
void Character::loadAnimation(AnimationState animState, const std::string& filename, const std::string& zipFile) {
|
||||
@@ -252,12 +251,12 @@ void Character::update(int64_t deltaMs, const CharacterResolver& resolver) {
|
||||
|
||||
if (attackTarget != nullptr) {
|
||||
float distToGhost = (attackTarget->state.position - state.position).norm();
|
||||
if (distToGhost >= VISIBLE_RANGE) {
|
||||
if (distToGhost >= state.visibleRange) {
|
||||
if (state.isPlayer) {
|
||||
setTarget(attackTarget->state.position);
|
||||
}
|
||||
state.battle_state = 0;
|
||||
} else if (distToGhost < VISIBLE_RANGE && distToGhost >= ATTACK_RANGE) {
|
||||
} else if (distToGhost < state.visibleRange && distToGhost >= ATTACK_RANGE) {
|
||||
setTarget(attackTarget->state.position);
|
||||
state.battle_state = 0;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user