012d038025
Assets (CC0 license): - 3D models: Blaster gun, walls, platforms, grass, clouds, enemy - Sounds: blaster fire, impacts, footsteps, jumps, weapon change - Sprites: crosshair, hit marker, muzzle flash, skybox, blob shadow - Font: Lilita One Code changes: - weapon_manager.gd: load blaster.glb as gun model (replaces box mesh) - player.tscn: use Kenney sounds (blaster.ogg, enemy_hurt/destroy) and crosshair Test suite (100 unit tests + 4 integration scenarios): - weapon_data.gd: 27 tests — all 6 weapons every stat verified - economy.gd: 19 tests — constants, loss streak, buy thresholds - bomb.gd: 15 tests — state machine, timing constants - round_manager.gd: 10 tests — win conditions, elimination logic - team_manager.gd: 8 tests — auto-balance, team assignment - headless_test_bot.gd: integration bot with movement/idle/rounds scenarios - run_multi_bot.sh: multi-client launcher
36 lines
837 B
GDScript
36 lines
837 B
GDScript
extends Node
|
|
|
|
# Code adapted from KidsCanCode
|
|
|
|
var num_players = 12
|
|
var bus = "master"
|
|
|
|
var available = [] # The available players.
|
|
var queue = [] # The queue of sounds to play.
|
|
|
|
func _ready():
|
|
for i in num_players:
|
|
var p = AudioStreamPlayer.new()
|
|
add_child(p)
|
|
|
|
available.append(p)
|
|
|
|
p.volume_db = -10
|
|
p.finished.connect(_on_stream_finished.bind(p))
|
|
p.bus = bus
|
|
|
|
func _on_stream_finished(stream):
|
|
available.append(stream)
|
|
|
|
func play(sound_path): # Path (or multiple, separated by commas)
|
|
var sounds = sound_path.split(",")
|
|
queue.append("res://" + sounds[randi() % sounds.size()].strip_edges())
|
|
|
|
func _process(_delta):
|
|
if not queue.is_empty() and not available.is_empty():
|
|
available[0].stream = load(queue.pop_front())
|
|
available[0].play()
|
|
available[0].pitch_scale = randf_range(0.9, 1.1)
|
|
|
|
available.pop_front()
|