This commit is contained in:
aozhiwei 2022-09-30 15:47:49 +08:00
parent a7ffcdfd06
commit e8bdd3096d
2 changed files with 11 additions and 2 deletions

View File

@ -808,9 +808,7 @@ void Bullet::ProcFlyHook(Entity* target)
if (target->IsCreature(room)) {
Creature* c = (Creature*)target;
#if 0
room->frame_event.AddPropChg(c->GetWeakPtrRef(), kPropBeHook, 0, sender.Get()->GetUniId());
#endif
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2);
} else {
sender.Get()->AutoNavigation(GetPos(), gun_meta->i->bullet_speed() * 2);

View File

@ -3647,6 +3647,17 @@ void Creature::AutoNavigation(a8::Vec2 target_pos, float speed)
a8::Vec2 new_pos = context->src_pos + dir * move_distance;
c->SetPos(new_pos);
#ifdef DEBUG
a8::XPrintf("speed:%d src_pos:%f,%f new_pos:%f,%f move_distance:%f\n",
{
context->speed,
context->src_pos.x,
context->src_pos.y,
new_pos.x,
new_pos.y,
move_distance
});
#endif
bool ok = false;
if (c->CheckCollision()) {
c->SetPos(old_pos);