Update hitboxes for consistency (#608)

Co-authored-by: Joe H <97353363+JHDev2006@users.noreply.github.com>
This commit is contained in:
John Cooper McDonald
2025-10-17 11:12:57 -05:00
committed by GitHub
parent ed297891fd
commit 9a17f140e0
27 changed files with 246 additions and 209 deletions

View File

@@ -1,20 +1,14 @@
extends Node2D
extends Enemy
var target_player: Player = null
var velocity := Vector2.ZERO
const MOVE_SPEED := 30
const SMOKE_PARTICLE = preload("uid://d08nv4qtfouv1")
var direction := -1
signal killed
func _physics_process(delta: float) -> void:
target_player = get_tree().get_first_node_in_group("Players")
if $TrackJoint.is_attached == false:
handle_movement(delta)
$Sprite.scale.x = direction
$Sprite.scale.x = -direction
func handle_movement(delta: float) -> void:
var target_direction = sign(target_player.global_position.x - global_position.x)
@@ -30,22 +24,6 @@ func handle_movement(delta: float) -> void:
velocity = lerp(velocity, Vector2.ZERO, delta * 5)
global_position += velocity * delta
func on_area_entered(area: Area2D) -> void:
if area.owner is Player:
if area.owner.is_invincible or area.name == "HammerHitbox":
die()
else:
area.owner.damage()
func die() -> void:
summon_smoke_particle()
queue_free()
killed.emit()
func flag_die() -> void:
die()
func summon_smoke_particle() -> void:
var particle = SMOKE_PARTICLE.instantiate()
particle.global_position = global_position