rest of milestone 4
This commit is contained in:
parent
f958517574
commit
69faf54dc3
73 changed files with 3739 additions and 4560 deletions
|
|
@ -4,11 +4,13 @@ extends CollisionObject3D
|
|||
@export var health := 10.
|
||||
|
||||
@export var shake_noise: FastNoiseLite
|
||||
@export var randomize_height := true
|
||||
var shake_duration := 0.
|
||||
@onready var initial_shaker_pos: Vector3 = %Shaker.position
|
||||
|
||||
func _ready() -> void:
|
||||
scale.y = randf_range(.5, 1.25)
|
||||
if randomize_height:
|
||||
scale.y = randf_range(.5, 1.25)
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
|
@ -21,6 +23,19 @@ func _process(delta: float) -> void:
|
|||
|
||||
shake_duration = move_toward(shake_duration, 0., delta)
|
||||
|
||||
func _show_score_label() -> void:
|
||||
%ScoreLabel.position.x += randf_range(-2, 2)
|
||||
%ScoreLabel.position.y += randf_range(-2, 2)
|
||||
%ScoreLabel.show()
|
||||
create_tween().tween_property(%ScoreLabel, "position:y", %ScoreLabel.position.y + 2., 1.)
|
||||
await get_tree().create_timer(.5, false).timeout
|
||||
|
||||
var t := create_tween()
|
||||
t.tween_property(%ScoreLabel, "modulate:a", 0., .5)
|
||||
t.parallel().tween_property(%ScoreLabel, "outline_modulate:a", 0., .5)
|
||||
t.finished.connect(%ScoreLabel.queue_free)
|
||||
|
||||
|
||||
func hit(_proj: Node3D, damage: float) -> bool:
|
||||
health -= damage
|
||||
if health <= 0.:
|
||||
|
|
@ -30,6 +45,9 @@ func hit(_proj: Node3D, damage: float) -> bool:
|
|||
%Shaker.hide()
|
||||
%DestroyedMesh.show()
|
||||
%GPUParticles3D.preprocess = randf()
|
||||
|
||||
_show_score_label()
|
||||
|
||||
else:
|
||||
shake_duration += 0.5
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue