Files
Super-Mario-Bros.-Remastere…/Scripts/Classes/Entities/Enemies/Barrel.gd
John Cooper McDonald 8474bc3c19 Properly implement the Hammer item (#599)
* Properly implement the Hammer item

* Update Boo.gd

* Update LongFirebar.tscn
2025-10-15 18:14:19 +01:00

34 lines
865 B
GDScript

extends Enemy
const MOVE_SPEED := 30
const BARREL_DESTRUCTION_PARTICLE = preload("res://Scenes/Prefabs/Particles/BarrelDestructionParticle.tscn")
func _physics_process(delta: float) -> void:
handle_movement(delta)
func handle_movement(delta: float) -> void:
if is_on_wall() and is_on_floor() and get_wall_normal().x == -direction:
die()
func die() -> void:
destroy()
func die_from_object(_node: Node2D) -> void:
destroy()
func die_from_hammer(_node: Node2D) -> void:
AudioManager.play_sfx("hammer_hit", global_position)
destroy()
func summon_particle() -> void:
var node = BARREL_DESTRUCTION_PARTICLE.instantiate()
node.global_position = global_position - Vector2(0, 8)
add_sibling(node)
func destroy() -> void:
summon_particle()
AudioManager.play_sfx("block_break", global_position)
queue_free()
func bounce_up() -> void:
velocity.y = -200