Death because of death
This commit is contained in:
parent
347a990421
commit
dfcb7020ea
2 changed files with 8 additions and 1 deletions
|
|
@ -109,7 +109,7 @@ size = Vector3(7.2811394, 2.1549835, 16.348633)
|
||||||
material = ExtResource("5_bno23")
|
material = ExtResource("5_bno23")
|
||||||
|
|
||||||
[node name="CSGBox3D9" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D6"]
|
[node name="CSGBox3D9" type="CSGBox3D" parent="CSGCombiner3D/CSGBox3D6"]
|
||||||
transform = Transform3D(0.91243464, -0.40922245, 0, 0.40922245, 0.91243464, 0, 0, 0, 1, -2.315074, 0.8311236, 0)
|
transform = Transform3D(0.91243464, -0.40922245, 0, 0.40922245, 0.91243464, 0, 0, 0, 1, -2.2474291, 0.6802974, 0)
|
||||||
layers = 5
|
layers = 5
|
||||||
operation = 2
|
operation = 2
|
||||||
size = Vector3(7.1386776, 2.1549835, 16.348633)
|
size = Vector3(7.1386776, 2.1549835, 16.348633)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ const MAX_HP = 100
|
||||||
|
|
||||||
@export var hp: int = 100:
|
@export var hp: int = 100:
|
||||||
set(value):
|
set(value):
|
||||||
|
if dead:
|
||||||
|
return
|
||||||
if value < 0:
|
if value < 0:
|
||||||
hp = 0
|
hp = 0
|
||||||
else:
|
else:
|
||||||
|
|
@ -27,10 +29,13 @@ const MAX_HP = 100
|
||||||
health_changed.emit(hp)
|
health_changed.emit(hp)
|
||||||
if hp == 0:
|
if hp == 0:
|
||||||
die()
|
die()
|
||||||
|
dead = true
|
||||||
|
|
||||||
get:
|
get:
|
||||||
return hp
|
return hp
|
||||||
|
|
||||||
|
var dead: bool
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(_delta: float) -> void:
|
||||||
if not multiplayer.is_server():
|
if not multiplayer.is_server():
|
||||||
return
|
return
|
||||||
|
|
@ -58,6 +63,8 @@ func depassive() -> void:
|
||||||
passived = false
|
passived = false
|
||||||
|
|
||||||
func take_damage(damage: int):
|
func take_damage(damage: int):
|
||||||
|
if dead:
|
||||||
|
return
|
||||||
hp -= damage
|
hp -= damage
|
||||||
damaged.emit()
|
damaged.emit()
|
||||||
$DamageAudio.multiplayer_play()
|
$DamageAudio.multiplayer_play()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue