Adding death zone to pesticide

This commit is contained in:
Dan Baker 2024-05-05 16:04:07 +01:00
parent 0127257d05
commit e88b2248b3
13 changed files with 177 additions and 8 deletions

View file

@ -55,7 +55,7 @@ _data = {
[sub_resource type="CircleShape2D" id="CircleShape2D_86nxf"]
radius = 22.0907
[node name="Bee" type="CharacterBody2D"]
[node name="Bee" type="CharacterBody2D" groups=["bee"]]
z_index = 99
collision_mask = 0
script = ExtResource("1_pnu7x")

View file

@ -62,6 +62,10 @@ func deposit_nectar():
latest_target_director = 0
just_gathering = false
func die():
# Move to the death state
# For now just remove the bee...
queue_free()

View file

@ -28,6 +28,10 @@ window/size/viewport_height=720
enabled=PackedStringArray("res://addons/log/plugin.cfg")
[gui]
theme/custom="res://resources/theme/game_theme.tres"
[layer_names]
2d_physics/layer_1="bees"

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dwdgp7kjweao7"
path="res://.godot/imported/Kaph-Italic.ttf-1ab006790939f5d710ad0b74d2c82e38.fontdata"
[deps]
source_file="res://resources/fonts/Kaph-Italic.ttf"
dest_files=["res://.godot/imported/Kaph-Italic.ttf-1ab006790939f5d710ad0b74d2c82e38.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View file

@ -0,0 +1,33 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://beyoaacc7uhy1"
path="res://.godot/imported/Kaph-Regular.ttf-2e09e72cc59e741e8ff9885a176f06d5.fontdata"
[deps]
source_file="res://resources/fonts/Kaph-Regular.ttf"
dest_files=["res://.godot/imported/Kaph-Regular.ttf-2e09e72cc59e741e8ff9885a176f06d5.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,3 +1,9 @@
[gd_resource type="Theme" format=3 uid="uid://cpkvret5gi66h"]
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cpkvret5gi66h"]
[ext_resource type="FontFile" uid="uid://beyoaacc7uhy1" path="res://resources/fonts/Kaph-Regular.ttf" id="1_fwiur"]
[resource]
default_font = ExtResource("1_fwiur")
default_font_size = 12
Fonts/fonts/large = ExtResource("1_fwiur")
Fonts/fonts/normal = ExtResource("1_fwiur")

View file

@ -0,0 +1,11 @@
extends Polygon2D
class_name Pesticide
@onready var death_box = $DeathBox
func _ready():
death_box.connect("body_entered", Callable(self, "_on_body_entered"))
func _on_body_entered(area):
if area.is_in_group("bee"):
area.die()

View file

@ -1,16 +1,22 @@
[gd_scene load_steps=9 format=3 uid="uid://mk5n0hrwk4yi"]
[gd_scene load_steps=13 format=3 uid="uid://mk5n0hrwk4yi"]
[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="Script" path="res://scenes/scripts/drone_manager.gd" id="2_474nc"]
[ext_resource type="Script" path="res://scenes/scripts/bee_spawner.gd" id="2_qqqq4"]
[ext_resource type="Script" path="res://scenes/scripts/pesticide.gd" id="3_gg2a6"]
[ext_resource type="Script" path="res://scenes/scripts/drone_controls.gd" id="3_rqkyv"]
[ext_resource type="Theme" uid="uid://cpkvret5gi66h" path="res://resources/theme/game_theme.tres" id="6_1kbwe"]
[ext_resource type="PackedScene" uid="uid://b7eeptlk47ymd" path="res://ui/UiComponent.tscn" id="6_xuemm"]
[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"]
[sub_resource type="CircleShape2D" id="CircleShape2D_usqp5"]
radius = 142.316
[sub_resource type="CircleShape2D" id="CircleShape2D_ewfly"]
radius = 252.15
[node name="TestLevel" type="Node2D"]
script = ExtResource("1_lgt1m")
@ -44,10 +50,15 @@ offset_bottom = 266.0
text = "Flower patch bro"
[node name="Pesticide" type="Polygon2D" parent="."]
position = Vector2(74.7948, -103.963)
scale = Vector2(0.851611, 0.815599)
position = Vector2(561, 76)
color = Color(0.682353, 0.137255, 0.203922, 1)
polygon = PackedVector2Array(441, 122, 520, 54, 548, 154, 625, 114, 593, 234, 686, 281, 581, 325, 605, 472, 512, 363, 399, 468, 429, 311, 239, 362, 322, 226, 152, 92, 345, 130, 346, 15)
polygon = PackedVector2Array(-201, -145, 111, -237, 250, -30, 185, 172, -80, 253, -259, 82)
script = ExtResource("3_gg2a6")
[node name="DeathBox" type="Area2D" parent="Pesticide"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Pesticide/DeathBox"]
shape = SubResource("CircleShape2D_ewfly")
[node name="Dog" type="Polygon2D" parent="."]
position = Vector2(-354, 53)
@ -123,6 +134,13 @@ layout_mode = 2
tooltip_text = "Spawn a dancing drone that will encourage bees to leave the hive. Best to put this near to the hive. "
text = "Dancer"
[node name="LevelCompleteComponent" parent="." instance=ExtResource("8_4k5cm")]
unique_name_in_owner = true
visible = false
offset_right = 1280.0
offset_bottom = 720.0
script = ExtResource("9_qrlto")
[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/SpawnDistractor" to="DroneManager" method="_on_spawn_distractor_pressed"]

View file

@ -0,0 +1,40 @@
[gd_scene load_steps=2 format=3 uid="uid://cwutwy11pityw"]
[sub_resource type="LabelSettings" id="LabelSettings_phhcy"]
font_size = 32
[node name="LevelCompleteComponent" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="BackgroundOverlay" type="Panel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="MarginContainer/CenterContainer"]
layout_mode = 2
text = "The Bees Are Happy!"
label_settings = SubResource("LabelSettings_phhcy")

View file

@ -0,0 +1,11 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready():
visible = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
if GameState.level_complete == true:
visible = true

View file

@ -1,16 +1,25 @@
class_name GameStateManager extends Node
var level_complete : bool = false
var gathered_nectar : int = 0 :
get:
return gathered_nectar
set(value):
gathered_nectar = value
if gathered_nectar > required_nectar:
game_win()
@export var required_nectar : int = 200
@export var required_nectar : int = 100
func _ready():
Log.pr("GameStateManager ready")
func add_nectar():
gathered_nectar += 1
Log.pr("Nectar gathered", gathered_nectar)
Log.pr("Nectar gathered", gathered_nectar)
func game_win():
Log.pr("Game win")
level_complete = true
# get_tree().paused = true