score label vfx; increase building collider size
This commit is contained in:
parent
69faf54dc3
commit
962c4cb469
6 changed files with 60 additions and 18 deletions
|
|
@ -23,9 +23,10 @@ func _process(delta: float) -> void:
|
|||
|
||||
shake_duration = move_toward(shake_duration, 0., delta)
|
||||
|
||||
func _show_score_label() -> void:
|
||||
func _show_score_label(score: int) -> void:
|
||||
%ScoreLabel.position.x += randf_range(-2, 2)
|
||||
%ScoreLabel.position.y += randf_range(-2, 2)
|
||||
%ScoreLabel.text = "+%d" % score
|
||||
%ScoreLabel.show()
|
||||
create_tween().tween_property(%ScoreLabel, "position:y", %ScoreLabel.position.y + 2., 1.)
|
||||
await get_tree().create_timer(.5, false).timeout
|
||||
|
|
@ -39,14 +40,15 @@ func _show_score_label() -> void:
|
|||
func hit(_proj: Node3D, damage: float) -> bool:
|
||||
health -= damage
|
||||
if health <= 0.:
|
||||
SignalBus.building_destroyed.emit(self)
|
||||
var score := randi_range(10, 20)
|
||||
SignalBus.building_destroyed.emit(self, score)
|
||||
collision_layer = 1 # World collision only
|
||||
|
||||
%Shaker.hide()
|
||||
%DestroyedMesh.show()
|
||||
%GPUParticles3D.preprocess = randf()
|
||||
|
||||
_show_score_label()
|
||||
_show_score_label(score)
|
||||
|
||||
else:
|
||||
shake_duration += 0.5
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue