我有一个敌人ai问题。
我试图实现的是
If(hero is between enemie's x position and the enemies x position + 100( the max range) { then make enemy attack}
当英雄在射程内时,我希望敌人开火。
我尝试过hitTestPoint,但
if(hero.hitTestPoint(goblin,x + 100, goblin.y, true)
但只有当x点和y点之间发生碰撞时,这才是真的。
我想停止使用hitTestPoint,开始使用Math。
我试过了,
if (_character.x > redGoblin.x && _character.x < redGoblin.x - 300)
但没有结果。
有什么建议吗?
逻辑不好,你希望角色同时在妖精的右边和左边
这个必须工作:
if (_character.x > redGoblin.x && _character.x < redGoblin.x + 100)