物件添加血量判断
This commit is contained in:
parent
0d59588df1
commit
02ce6baf9a
@ -88,8 +88,8 @@ void Bullet::OnHit(std::vector<Entity*>& objects)
|
|||||||
{
|
{
|
||||||
Obstacle* obstacle = (Obstacle*)target;
|
Obstacle* obstacle = (Obstacle*)target;
|
||||||
if (!obstacle->dead && obstacle->meta->i->attack_type() == 1) {
|
if (!obstacle->dead && obstacle->meta->i->attack_type() == 1) {
|
||||||
obstacle->health = std::min(0.0f, obstacle->health - 10);
|
obstacle->health = std::max(0.0f, obstacle->health - 10);
|
||||||
obstacle->dead = std::min(obstacle->health, 0.001f) <= 0.01f;
|
obstacle->dead = obstacle->health <= 0.01f;
|
||||||
obstacle->dead_frameno = room->frame_no;
|
obstacle->dead_frameno = room->frame_no;
|
||||||
if (obstacle->dead) {
|
if (obstacle->dead) {
|
||||||
obstacle->ClearColliders();
|
obstacle->ClearColliders();
|
||||||
|
@ -614,6 +614,7 @@ bool Human::HasLiveTeammate()
|
|||||||
void Human::Land()
|
void Human::Land()
|
||||||
{
|
{
|
||||||
a8::UnSetBitFlag(status, HS_Jump);
|
a8::UnSetBitFlag(status, HS_Jump);
|
||||||
|
FindLocation();
|
||||||
SyncAroundPlayers();
|
SyncAroundPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -635,3 +636,15 @@ void Human::DoJump()
|
|||||||
&xtimer_attacher.timer_list_);
|
&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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -119,6 +119,7 @@ class Human : public Entity
|
|||||||
bool HasLiveTeammate();
|
bool HasLiveTeammate();
|
||||||
void Land();
|
void Land();
|
||||||
void DoJump();
|
void DoJump();
|
||||||
|
void FindLocation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user