Added hit indicator
This commit is contained in:
@@ -10,6 +10,8 @@ const MAX_HEALTH = 100.0
|
||||
const CAMERA_OFFSET_FACTOR = 0.4
|
||||
const CAMERA_OFFSET_TIME = 1.0
|
||||
|
||||
const SHADER_DAMAGE_INDICATOR = "shader_parameter/intensity"
|
||||
|
||||
|
||||
@export_group("Movement", "move")
|
||||
@export_range(0.0, 1000.0) var move_max_speed_normal := 350
|
||||
@@ -35,6 +37,7 @@ const CAMERA_OFFSET_TIME = 1.0
|
||||
|
||||
var _slow_down_tween: Tween
|
||||
var _camera_offset_tween: Tween
|
||||
var _damage_indicator_tween: Tween
|
||||
|
||||
var _last_wall_normal: = 0.0
|
||||
|
||||
@@ -155,6 +158,14 @@ func _input(event: InputEvent) -> void:
|
||||
|
||||
|
||||
func deal_damage(value: float) -> void:
|
||||
if _damage_indicator_tween and _damage_indicator_tween.is_running():
|
||||
_damage_indicator_tween.kill()
|
||||
_damage_indicator_tween = create_tween()
|
||||
|
||||
_damage_indicator_tween.tween_property(player_sprite.material, SHADER_DAMAGE_INDICATOR, 0, 0.0)
|
||||
_damage_indicator_tween.tween_property(player_sprite.material, SHADER_DAMAGE_INDICATOR, 1, 0.1)
|
||||
_damage_indicator_tween.tween_property(player_sprite.material, SHADER_DAMAGE_INDICATOR, 0, 0.1)
|
||||
|
||||
_current_health -= value
|
||||
health_changed.emit(_current_health)
|
||||
if _current_health < 0.0 or is_zero_approx(_current_health):
|
||||
|
||||
Reference in New Issue
Block a user