significant work on game logic

This commit is contained in:
2025-03-21 17:24:21 -04:00
parent d080ac5c3b
commit 0f4083a263
19 changed files with 360 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
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