level + enemy spawner refactor
This commit is contained in:
parent
ebdb9c7074
commit
2cc3eaa859
15 changed files with 942 additions and 93 deletions
|
|
@ -1,11 +1,11 @@
|
|||
class_name Building
|
||||
extends CollisionObject3D
|
||||
|
||||
var health := 10.
|
||||
@export var health := 10.
|
||||
|
||||
@export var shake_noise: FastNoiseLite
|
||||
var shake_duration := 0.
|
||||
@onready var initial_mesh_pos: Vector3 = %Mesh.position
|
||||
@onready var initial_shaker_pos: Vector3 = %Shaker.position
|
||||
|
||||
func _ready() -> void:
|
||||
scale.y = randf_range(.5, 1.25)
|
||||
|
|
@ -13,11 +13,11 @@ func _ready() -> void:
|
|||
|
||||
func _process(delta: float) -> void:
|
||||
if shake_duration <= 0:
|
||||
%Mesh.position = initial_mesh_pos
|
||||
%Shaker.position = initial_shaker_pos
|
||||
else:
|
||||
var x := shake_noise.get_noise_1d(shake_duration * 10000)
|
||||
var y := shake_noise.get_noise_1d(-shake_duration * 10000)
|
||||
%Mesh.position = initial_mesh_pos + (Vector3(x, 0, y) * 0.75)
|
||||
%Shaker.position = initial_shaker_pos + (Vector3(x, 0, y) * 0.75)
|
||||
|
||||
shake_duration = move_toward(shake_duration, 0., delta)
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ func hit(_proj: PlayerProjectile, damage: float) -> bool:
|
|||
SignalBus.building_destroyed.emit(self)
|
||||
collision_layer = 1 # World collision only
|
||||
|
||||
%Mesh.hide()
|
||||
%Shaker.hide()
|
||||
%DestroyedMesh.show()
|
||||
%GPUParticles3D.preprocess = randf()
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue