1
0
This repository has been archived on 2025-06-02. You can view files and clone it, but cannot push or open issues or pull requests.
extremely-intense-mathematics/godot/scripts/rule_enforcement_device.gd

41 lines
1013 B
GDScript3
Raw Normal View History

2025-03-21 17:24:21 -04:00
extends Node3D
static var FUSE_SOUND:AudioStream = preload("res://assets/sounds/fuse.ogg")
static var EXPLOSION_SOUND:AudioStream = preload("res://assets/sounds/explode.wav")
var grow_explosion:bool = false
func reset_rule_enforcement_device() -> void:
'''
Start the fuse sound
'''
%SOUNDS.stream = FUSE_SOUND
%SOUNDS.volume_db = -10
%SOUNDS.play()
visible = true
%EXPLOSION.visible = false
grow_explosion = false
%EXPLOSION.scale = Vector3(0.355,0.355,0.355)
func explode() -> void:
'''
Make the rule enforcement device go boom
'''
%SOUNDS.stream = EXPLOSION_SOUND
%SOUNDS.volume_db = 0
%SOUNDS.play()
grow_explosion = true
%EXPLOSION.visible = true
func _ready() -> void:
reset_rule_enforcement_device()
func _process(_delta: float) -> void:
%TIME_LEFT.text = ("%.02f" % GLOBALVARS.seconds_left).replace(".",":")
if grow_explosion and %EXPLOSION.scale < Vector3(3,3,3):
%EXPLOSION.scale += Vector3(0.2,0.2,0.2)
elif grow_explosion:
%EXPLOSION.visible = false
visible = false