mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-22 08:04:23 +00:00
Merge branch 'main' of https://github.com/Steffo99/ld55
This commit is contained in:
commit
227e4ddc8a
19 changed files with 227 additions and 0 deletions
34
behaviours/spawner_choice.gd
Normal file
34
behaviours/spawner_choice.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
extends Node
|
||||
class_name SpawnerChoice
|
||||
|
||||
|
||||
@export var spawners: Array[Spawner] = []
|
||||
@export var weights: Array[int] = []
|
||||
|
||||
|
||||
func compute_total_weight() -> int:
|
||||
var total = 0
|
||||
for weight in weights:
|
||||
if weight < 0:
|
||||
Log.e(self, "Weight with negative value detected.")
|
||||
total += weight
|
||||
return total
|
||||
|
||||
func select_spawner() -> Spawner:
|
||||
var total = compute_total_weight()
|
||||
var sampled = Random.rng.randi_range(0, total - 1)
|
||||
var idx = -1
|
||||
while sampled >= 0:
|
||||
idx += 1
|
||||
sampled -= weights[idx]
|
||||
return spawners[idx]
|
||||
|
||||
func spawn():
|
||||
select_spawner().spawn()
|
||||
|
||||
|
||||
func _ready():
|
||||
if len(spawners) != len(weights):
|
||||
Log.e(self, "Spawners and weights are different lengths.")
|
||||
if compute_total_weight() <= 0:
|
||||
Log.e(self, "Weight total is less or equal to 0.")
|
6
behaviours/spawner_choice.tscn
Normal file
6
behaviours/spawner_choice.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cokdfsk6rgeup"]
|
||||
|
||||
[ext_resource type="Script" path="res://behaviours/spawner_choice.gd" id="1_jkwdb"]
|
||||
|
||||
[node name="SpawnerChoice" type="Node"]
|
||||
script = ExtResource("1_jkwdb")
|
BIN
temp/bones.wav
BIN
temp/bones.wav
Binary file not shown.
24
temp/bones.wav.import
Normal file
24
temp/bones.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dq3xf4i2wpt50"
|
||||
path="res://.godot/imported/bones.wav-53a2d1735511ef1f1bf2921348b332aa.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/bones.wav"
|
||||
dest_files=["res://.godot/imported/bones.wav-53a2d1735511ef1f1bf2921348b332aa.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
Binary file not shown.
24
temp/click&pop.wav.import
Normal file
24
temp/click&pop.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://byn68h5qg6p5x"
|
||||
path="res://.godot/imported/click&pop.wav-72c07aaf987d2bd80254015b6c36b256.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/click&pop.wav"
|
||||
dest_files=["res://.godot/imported/click&pop.wav-72c07aaf987d2bd80254015b6c36b256.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
temp/gore.wav
BIN
temp/gore.wav
Binary file not shown.
24
temp/gore.wav.import
Normal file
24
temp/gore.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dlp0oo8tbp3w1"
|
||||
path="res://.godot/imported/gore.wav-c74757bf12b5b41aaaf2eb9a0f1110a0.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/gore.wav"
|
||||
dest_files=["res://.godot/imported/gore.wav-c74757bf12b5b41aaaf2eb9a0f1110a0.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
Binary file not shown.
BIN
temp/place.wav
BIN
temp/place.wav
Binary file not shown.
24
temp/place.wav.import
Normal file
24
temp/place.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://buxgivpkh8dyl"
|
||||
path="res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/place.wav"
|
||||
dest_files=["res://.godot/imported/place.wav-6f3a5aef81053f3b0b94fbbb722a0c32.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
temp/pop.wav
BIN
temp/pop.wav
Binary file not shown.
24
temp/pop.wav.import
Normal file
24
temp/pop.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dgd1ldpffk6ql"
|
||||
path="res://.godot/imported/pop.wav-5c8ab1a460889e6b7e24366eae5d4a3a.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/pop.wav"
|
||||
dest_files=["res://.godot/imported/pop.wav-5c8ab1a460889e6b7e24366eae5d4a3a.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
temp/puff.wav
BIN
temp/puff.wav
Binary file not shown.
24
temp/puff.wav.import
Normal file
24
temp/puff.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cwvdddro7u38g"
|
||||
path="res://.godot/imported/puff.wav-5458e43df0efe164a3d8534b8a23be21.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/puff.wav"
|
||||
dest_files=["res://.godot/imported/puff.wav-5458e43df0efe164a3d8534b8a23be21.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
temp/sheep.wav
BIN
temp/sheep.wav
Binary file not shown.
24
temp/sheep.wav.import
Normal file
24
temp/sheep.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://bmfscpnugaejk"
|
||||
path="res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/sheep.wav"
|
||||
dest_files=["res://.godot/imported/sheep.wav-5e192fa241f3aae906a657036a0b94de.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
Binary file not shown.
19
temp/tollbell.mp3.import
Normal file
19
temp/tollbell.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://bwfscrmf25vkv"
|
||||
path="res://.godot/imported/tollbell.mp3-eacf00af005e4b329c6241109d68c18b.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/tollbell.mp3"
|
||||
dest_files=["res://.godot/imported/tollbell.mp3-eacf00af005e4b329c6241109d68c18b.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
Loading…
Reference in a new issue