物件添加血量判断

This commit is contained in:
aozhiwei 2019-04-19 11:24:11 +08:00
parent 0d59588df1
commit 02ce6baf9a
3 changed files with 16 additions and 2 deletions

View File

@ -88,8 +88,8 @@ void Bullet::OnHit(std::vector<Entity*>& objects)
{
Obstacle* obstacle = (Obstacle*)target;
if (!obstacle->dead && obstacle->meta->i->attack_type() == 1) {
obstacle->health = std::min(0.0f, obstacle->health - 10);
obstacle->dead = std::min(obstacle->health, 0.001f) <= 0.01f;
obstacle->health = std::max(0.0f, obstacle->health - 10);
obstacle->dead = obstacle->health <= 0.01f;
obstacle->dead_frameno = room->frame_no;
if (obstacle->dead) {
obstacle->ClearColliders();

View File

@ -614,6 +614,7 @@ bool Human::HasLiveTeammate()
void Human::Land()
{
a8::UnSetBitFlag(status, HS_Jump);
FindLocation();
SyncAroundPlayers();
}
@ -635,3 +636,15 @@ void Human::DoJump()
&xtimer_attacher.timer_list_);
}
}
void Human::FindLocation()
{
{
std::vector<Entity*> objects;
int detection_flags = 0;
{
a8::SetBitFlag(detection_flags, ET_Building);
}
room->CollisionDetection(this, detection_flags, objects);
}
}

View File

@ -119,6 +119,7 @@ class Human : public Entity
bool HasLiveTeammate();
void Land();
void DoJump();
void FindLocation();
protected: