4.6, new attack, enemy spawning, shaders, bunch of stuff

This commit is contained in:
Daniel Kauss Serna 2026-02-17 01:24:05 +01:00
parent e08e3ebb13
commit 19517a3176
84 changed files with 13348 additions and 91399 deletions

View file

@ -12,17 +12,16 @@ var target_node: Node2D
func _ready() -> void:
add_to_group("enemy")
nav_agent.velocity_computed.connect(_on_velocity_computed)
target_node = get_tree().get_first_node_in_group("player")
func _physics_process(delta: float) -> void:
if not target_node: return
nav_agent.target_position = target_node.global_position
var dist = global_position.distance_to(target_node.global_position)
nav_agent.target_position = target_node.position
var dist = position.distance_to(target_node.position)
var next_path_pos = nav_agent.get_next_path_position()
var dir = global_position.direction_to(next_path_pos)
var dir = position.direction_to(next_path_pos)
if dist > approach_range:
velocity += dir * move_speed
current_charge = 0
@ -32,9 +31,9 @@ func _physics_process(delta: float) -> void:
else:
_handle_attack_charge(delta)
sprite.flip_h = target_node.global_position.x > global_position.x
sprite.flip_h = target_node.position.x > position.x
scale = Vector2.ONE * (1 + (current_charge * 0.2))
super._physics_process(delta)
func _handle_attack_charge(delta):
@ -47,6 +46,10 @@ func _handle_attack_charge(delta):
func _on_velocity_computed(safe_vel: Vector2):
velocity = safe_vel
func damage(amount: int = 1) -> void:
super.damage(amount)
SoundManager.play_sfx(SoundManager.SFX_DEATH)
func knockback():
velocity += global_position.direction_to(nav_agent.target_position).normalized() * -2000