added dog distractions
This commit is contained in:
parent
4834ebdda8
commit
51af0ea751
11 changed files with 117 additions and 5 deletions
|
|
@ -1,11 +1,22 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://ss2dg1i7j4ck"]
|
[gd_scene load_steps=3 format=3 uid="uid://ss2dg1i7j4ck"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://entities/scripts/distractor_drone.gd" id="1_vnjar"]
|
[ext_resource type="Script" path="res://entities/scripts/distractor_drone.gd" id="1_vnjar"]
|
||||||
|
|
||||||
[node name="DistractorDrone" type="Node2D"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_bxdlt"]
|
||||||
|
radius = 31.0161
|
||||||
|
|
||||||
|
[node name="DistractorDrone" type="CharacterBody2D" groups=["distractor"]]
|
||||||
script = ExtResource("1_vnjar")
|
script = ExtResource("1_vnjar")
|
||||||
|
|
||||||
|
[node name="Shape2" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_bxdlt")
|
||||||
|
|
||||||
[node name="Polygon2D" type="Polygon2D" parent="."]
|
[node name="Polygon2D" type="Polygon2D" parent="."]
|
||||||
position = Vector2(1, -1)
|
position = Vector2(1, -1)
|
||||||
color = Color(0.926224, 0.528901, 0.424107, 1)
|
color = Color(0.926224, 0.528901, 0.424107, 1)
|
||||||
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
polygon = PackedVector2Array(-28, -25, 25, -28, 26, 33, -32, 19)
|
||||||
|
|
||||||
|
[node name="HitBox" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="Shape" type="CollisionShape2D" parent="HitBox"]
|
||||||
|
shape = SubResource("CircleShape2D_bxdlt")
|
||||||
|
|
|
||||||
BIN
resources/SFX/bee.ogg
Normal file
BIN
resources/SFX/bee.ogg
Normal file
Binary file not shown.
19
resources/SFX/bee.ogg.import
Normal file
19
resources/SFX/bee.ogg.import
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://jdk681m35wt4"
|
||||||
|
path="res://.godot/imported/bee.ogg-2ae807cffcea1e18ac098b6092cda761.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/SFX/bee.ogg"
|
||||||
|
dest_files=["res://.godot/imported/bee.ogg-2ae807cffcea1e18ac098b6092cda761.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=true
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
BIN
resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav
Normal file
BIN
resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav
Normal file
Binary file not shown.
24
resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav.import
Normal file
24
resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://dpgl5huwc4yl8"
|
||||||
|
path="res://.godot/imported/mixkit-big-bee-hard-flying-sound-42.wav-772da984940bacc52c99d0787cc9adb8.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav"
|
||||||
|
dest_files=["res://.godot/imported/mixkit-big-bee-hard-flying-sound-42.wav-772da984940bacc52c99d0787cc9adb8.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
resources/SFX/mixkit-european-spring-forest-ambience-1219.wav
Normal file
BIN
resources/SFX/mixkit-european-spring-forest-ambience-1219.wav
Normal file
Binary file not shown.
|
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://dvsjpsh5dyixq"
|
||||||
|
path="res://.godot/imported/mixkit-european-spring-forest-ambience-1219.wav-d4f05387a508f164ac731bd7237091a8.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/SFX/mixkit-european-spring-forest-ambience-1219.wav"
|
||||||
|
dest_files=["res://.godot/imported/mixkit-european-spring-forest-ambience-1219.wav-d4f05387a508f164ac731bd7237091a8.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=2
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=0
|
||||||
BIN
resources/SFX/peaks/mixkit-bee-buzz-1926.wav.reapeaks
Normal file
BIN
resources/SFX/peaks/mixkit-bee-buzz-1926.wav.reapeaks
Normal file
Binary file not shown.
|
|
@ -4,11 +4,13 @@ class_name BeeSpawner
|
||||||
var bee = preload("res://entities/Bee.tscn")
|
var bee = preload("res://entities/Bee.tscn")
|
||||||
|
|
||||||
@onready var beehive = get_node("../Beehive")
|
@onready var beehive = get_node("../Beehive")
|
||||||
|
@onready var bee_sound = get_node("BigBeeSound")
|
||||||
|
|
||||||
var bee_count = 0
|
var bee_count = 0
|
||||||
var max_bees = 100
|
var max_bees = 100
|
||||||
var spawn_interval = 0.5
|
var spawn_interval = 0.5
|
||||||
var spawn_timer = 0.0
|
var spawn_timer = 0.0
|
||||||
|
var bee_sound_timer = 0.0
|
||||||
|
|
||||||
func spawn_bee():
|
func spawn_bee():
|
||||||
var bee_instance = bee.instantiate()
|
var bee_instance = bee.instantiate()
|
||||||
|
|
@ -23,3 +25,10 @@ func _process(delta):
|
||||||
spawn_timer = 0.0
|
spawn_timer = 0.0
|
||||||
bee_count += 1
|
bee_count += 1
|
||||||
Log.pr("Bee count: " + str(bee_count))
|
Log.pr("Bee count: " + str(bee_count))
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
bee_sound_timer += delta
|
||||||
|
if bee_sound_timer > 1.0:
|
||||||
|
bee_sound_timer = 0.0
|
||||||
|
if randf() > 0.9:
|
||||||
|
bee_sound.play()
|
||||||
|
|
@ -5,6 +5,7 @@ class_name Dog
|
||||||
|
|
||||||
var acquired_target : Bee = null
|
var acquired_target : Bee = null
|
||||||
var target_timer : float = 0.0
|
var target_timer : float = 0.0
|
||||||
|
var distracted : bool = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
death_box.connect("body_entered", Callable(self, "_on_body_entered"))
|
death_box.connect("body_entered", Callable(self, "_on_body_entered"))
|
||||||
|
|
@ -26,14 +27,23 @@ func _process(delta):
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(area):
|
func _on_body_entered(area):
|
||||||
if area.is_in_group("bee"):
|
if area.is_in_group("bee") and distracted == false:
|
||||||
if !acquired_target:
|
if !acquired_target:
|
||||||
Log.pr("Acquired target")
|
Log.pr("Acquired target")
|
||||||
target_timer = 0.0
|
target_timer = 0.0
|
||||||
acquired_target = area
|
acquired_target = area
|
||||||
|
|
||||||
|
if area.is_in_group("distractor"):
|
||||||
|
Log.pr("Distracted")
|
||||||
|
acquired_target = null
|
||||||
|
distracted = true
|
||||||
|
|
||||||
func _on_body_exited(area):
|
func _on_body_exited(area):
|
||||||
if area == acquired_target:
|
if area == acquired_target:
|
||||||
Log.pr("Lost target")
|
Log.pr("Lost target")
|
||||||
acquired_target = null
|
acquired_target = null
|
||||||
target_timer = 0.0
|
target_timer = 0.0
|
||||||
|
|
||||||
|
if area.is_in_group("distractor"):
|
||||||
|
Log.pr("No longer distracted")
|
||||||
|
distracted = false
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=15 format=3 uid="uid://mk5n0hrwk4yi"]
|
[gd_scene load_steps=18 format=3 uid="uid://mk5n0hrwk4yi"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scenes/scripts/test_level.gd" id="1_lgt1m"]
|
[ext_resource type="Script" path="res://scenes/scripts/test_level.gd" id="1_lgt1m"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dyu4mucawjlu6" path="res://entities/Beehive.tscn" id="2_5ueyo"]
|
[ext_resource type="PackedScene" uid="uid://dyu4mucawjlu6" path="res://entities/Beehive.tscn" id="2_5ueyo"]
|
||||||
|
|
@ -8,10 +8,13 @@
|
||||||
[ext_resource type="Script" path="res://scenes/scripts/drone_controls.gd" id="3_rqkyv"]
|
[ext_resource type="Script" path="res://scenes/scripts/drone_controls.gd" id="3_rqkyv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cfhoi2rqxa3up" path="res://entities/Dog.tscn" id="4_xlyy4"]
|
[ext_resource type="PackedScene" uid="uid://cfhoi2rqxa3up" path="res://entities/Dog.tscn" id="4_xlyy4"]
|
||||||
[ext_resource type="Theme" uid="uid://cpkvret5gi66h" path="res://resources/theme/game_theme.tres" id="6_1kbwe"]
|
[ext_resource type="Theme" uid="uid://cpkvret5gi66h" path="res://resources/theme/game_theme.tres" id="6_1kbwe"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://jdk681m35wt4" path="res://resources/SFX/bee.ogg" id="6_gqjhy"]
|
||||||
[ext_resource type="PackedScene" uid="uid://b7eeptlk47ymd" path="res://ui/UiComponent.tscn" id="6_xuemm"]
|
[ext_resource type="PackedScene" uid="uid://b7eeptlk47ymd" path="res://ui/UiComponent.tscn" id="6_xuemm"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://dpgl5huwc4yl8" path="res://resources/SFX/mixkit-big-bee-hard-flying-sound-42.wav" id="7_y3gwr"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cwutwy11pityw" path="res://ui/LevelCompleteComponent.tscn" id="8_4k5cm"]
|
[ext_resource type="PackedScene" uid="uid://cwutwy11pityw" path="res://ui/LevelCompleteComponent.tscn" id="8_4k5cm"]
|
||||||
[ext_resource type="Script" path="res://ui/scripts/level_complete_component.gd" id="9_qrlto"]
|
[ext_resource type="Script" path="res://ui/scripts/level_complete_component.gd" id="9_qrlto"]
|
||||||
[ext_resource type="AudioStream" uid="uid://bgcbd6xf0lyrr" path="res://resources/music/bee_background.ogg" id="12_5cn5j"]
|
[ext_resource type="AudioStream" uid="uid://bgcbd6xf0lyrr" path="res://resources/music/bee_background.ogg" id="12_5cn5j"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://dvsjpsh5dyixq" path="res://resources/SFX/mixkit-european-spring-forest-ambience-1219.wav" id="13_nttuq"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_usqp5"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_usqp5"]
|
||||||
radius = 142.316
|
radius = 142.316
|
||||||
|
|
@ -68,6 +71,14 @@ position = Vector2(705, 491)
|
||||||
[node name="BeeSpawner" type="Node2D" parent="."]
|
[node name="BeeSpawner" type="Node2D" parent="."]
|
||||||
script = ExtResource("2_qqqq4")
|
script = ExtResource("2_qqqq4")
|
||||||
|
|
||||||
|
[node name="BeeSound" type="AudioStreamPlayer" parent="BeeSpawner"]
|
||||||
|
stream = ExtResource("6_gqjhy")
|
||||||
|
autoplay = true
|
||||||
|
|
||||||
|
[node name="BigBeeSound" type="AudioStreamPlayer" parent="BeeSpawner"]
|
||||||
|
stream = ExtResource("7_y3gwr")
|
||||||
|
volume_db = -10.138
|
||||||
|
|
||||||
[node name="UiComponent" parent="." instance=ExtResource("6_xuemm")]
|
[node name="UiComponent" parent="." instance=ExtResource("6_xuemm")]
|
||||||
offset_right = 1280.0
|
offset_right = 1280.0
|
||||||
offset_bottom = 720.0
|
offset_bottom = 720.0
|
||||||
|
|
@ -146,6 +157,10 @@ stream = ExtResource("12_5cn5j")
|
||||||
volume_db = -18.0
|
volume_db = -18.0
|
||||||
autoplay = true
|
autoplay = true
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("13_nttuq")
|
||||||
|
autoplay = true
|
||||||
|
|
||||||
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnDirector" to="DroneManager" method="_on_spawn_director_pressed"]
|
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnDirector" to="DroneManager" method="_on_spawn_director_pressed"]
|
||||||
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnCollector" to="DroneManager" method="_on_spawn_collector_pressed"]
|
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnCollector" to="DroneManager" method="_on_spawn_collector_pressed"]
|
||||||
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnDistractor" to="DroneManager" method="_on_spawn_distractor_pressed"]
|
[connection signal="pressed" from="DroneManager/Control/MarginContainer/DroneControls/SpawnDistractor" to="DroneManager" method="_on_spawn_distractor_pressed"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue