Super-Mario-Bros-Remastered.../Scripts/Classes/Entities/Objects/BobOmbHeld.gd
SkyanUltra b66c459ebd Relatively minor sound tweaks + print cleanup
The player's death sound is now split up into 2 sounds, the sting which plays on the sound track, and the usual jingle, which plays on the music track. The jingle was also upgraded to a wav for that sweet, juicy lack of delay on start.

Thwomps falling, Bob-ombs exploding and P-Switches getting pressed are all classified as their own sounds now as well, separate from "cannon".
2025-11-25 06:38:21 -05:00

37 lines
927 B
GDScript

extends Enemy
const EXPLOSION = preload("uid://clbvyne1cr8gp")
@export var timer := 5.0
var can_move := true
func _ready() -> void:
$Movement.auto_call = can_move
func _physics_process(delta: float) -> void:
timer -= delta
if timer <= 2.0:
%FlashAnimation.play("Flash")
if timer <= 0:
explode()
timer = 99
%Sprite.scale.x = direction
func explode() -> void:
$AnimationPlayer.play("Explode")
await $AnimationPlayer.animation_finished
summon_explosion()
queue_free()
func kick(object: Node2D) -> void:
AudioManager.play_sfx("kick", global_position)
object.kick_anim()
var kick_dir = sign(global_position.x - object.global_position.x)
velocity.x = 150 * kick_dir
direction = kick_dir
velocity.y = -100
func summon_explosion() -> void:
var node = EXPLOSION.instantiate()
node.global_position = global_position + Vector2(0, -8)
AudioManager.play_sfx("explode", node.global_position)
add_sibling(node)