Skip to content

Commit

Permalink
bugfix: hud not updating when head
Browse files Browse the repository at this point in the history
  • Loading branch information
SonuTheNecro committed Nov 16, 2024
1 parent 82516d8 commit 15203c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion scenes/enemy/ice_drop.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,5 @@ polygon = PackedVector2Array(18, -33, 17, -29, 17, -25, 16, -22, 15, -19, 14, -1

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="explosion_hitbox"]
polygon = PackedVector2Array(-25, -5, -23, -6, -23, -8, -22, -9, -21, -9, -20, -10, -20, -11, -19, -12, -17, -13, -18, -15, -16, -16, -15, -17, -15, -21, -33, -21, -32, -23, -29, -24, -22, -25, -15, -26, -15, -29, -22, -30, -25, -31, -31, -33, -35, -34, -35, -36, -15, -36, -15, -39, -12, -42, -11, -42, -10, -43, -12, -45, -13, -47, -13, -53, -12, -56, -11, -56, -10, -54, -8, -52, -6, -50, -5, -49, -3, -48, -3, -47, 0, -47, 0, -48, 5, -48, 5, -50, 7, -50, 7, -56, 8, -58, 10, -60, 12, -60, 12, -47, 17, -48, 18, -46, 20, -46, 21, -48, 23, -49, 24, -50, 25, -52, 28, -53, 30, -54, 31, -54, 31, -50, 30, -47, 28, -45, 27, -44, 27, -42, 25, -42, 25, -41, 26, -40, 29, -37, 29, -33, 30, -33, 38, -32, 38, -30, 44, -30, 41, -29, 35, -28, 30, -27, 31, -25, 31, -22, 40, -21, 44, -20, 48, -19, 50, -17, 44, -16, 34, -15, 34, -14, 31, -13, 31, -9, 28, -7, 27, -6, 27, -4, 28, -2, 29, -1, 30, -1, 30, 2, 31, 3, 28, 3, 25, 2, 23, 0, 21, -1, 20, -2, 20, -3, 19, -4, 18, -4, 15, -3, 11, -3, 10, -1, 7, 3, 5, 3, 4, 3, 4, -3, 2, -4, -2, -5, -4, -6, -6, -7, -6, -9, -12, -9, -12, -8, -15, -8, -15, -6, -18, -6, -18, -4)
disabled = true

[connection signal="body_entered" from="explosion_hitbox" to="." method="_on_explosion_hitbox_body_entered"]
2 changes: 1 addition & 1 deletion scripts/enemy/ice_drop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ func attacked():
$drop_component.delete_timer.start()
$drop_component.isActive = false
$StaticBody2D.set_deferred("disable_mode",true)
$StaticBody2D/CollisionShape2D.set_deferred("disabled",true)
$StaticBody2D/CollisionPolygon2D.set_deferred("disabled",true)
self.timer_timeout_event()
2 changes: 2 additions & 0 deletions scripts/player/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ func increase_health():
if health > 10:
health = 10
func player_death():
self.get_parent().update_hud_when_dead()
self.health = 0
self.isDead = true
$body.play("death")
$head.visible = false
Expand Down
5 changes: 5 additions & 0 deletions scripts/world/world.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ func _process(_delta: float) -> void:
func get_player_position() -> Vector2:
#print(get_node("player").global_position.x, ":", get_node("player").global_position.y)
return get_node("player").global_position

# Final hud update when dead
func update_hud_when_dead():
$Panel/score.text = "Score: %d" % score
$Panel/health.text = "Health: %d" % $player.get_health()

0 comments on commit 15203c7

Please sign in to comment.