From f2ef5dfbb369db2722fbbd018ebf603d67345c61 Mon Sep 17 00:00:00 2001 From: zman27 Date: Fri, 28 Jan 2022 21:08:50 -0500 Subject: [PATCH] bad commit message --- Items/Item.gd | 11 +++++++++++ Items/Item.tscn | 18 ++++++++++++++++++ World.tscn | 6 +++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Items/Item.gd create mode 100644 Items/Item.tscn diff --git a/Items/Item.gd b/Items/Item.gd new file mode 100644 index 0000000..d449c5b --- /dev/null +++ b/Items/Item.gd @@ -0,0 +1,11 @@ +extends Area2D + + +func _ready(): + pass + + +func _on_Item_body_entered(body): + if body.is_in_group("Balls"): + print("item picked up") + queue_free() diff --git a/Items/Item.tscn b/Items/Item.tscn new file mode 100644 index 0000000..636b848 --- /dev/null +++ b/Items/Item.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://Items/Item.gd" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 35.0 + +[node name="Item" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Item_body_entered"] diff --git a/World.tscn b/World.tscn index 8498a36..9dc417d 100644 --- a/World.tscn +++ b/World.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://ServeArea.gd" type="Script" id=1] [ext_resource path="res://Cups/Cup.tscn" type="PackedScene" id=2] [ext_resource path="res://Art/LevelBackground.png" type="Texture" id=3] [ext_resource path="res://Levels/Level001.tscn" type="PackedScene" id=4] [ext_resource path="res://GUI.tscn" type="PackedScene" id=5] +[ext_resource path="res://Items/Item.tscn" type="PackedScene" id=6] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 269.25, 124 ) @@ -66,6 +67,9 @@ position = Vector2( 266, 918 ) [node name="GUI" parent="." instance=ExtResource( 5 )] +[node name="Item" parent="." instance=ExtResource( 6 )] +position = Vector2( 370, 627 ) + [connection signal="mouse_exited" from="ServeArea" to="ServeArea" method="_on_ServeArea_mouse_exited"] [connection signal="button_down" from="ServeArea/TextureButton" to="ServeArea" method="_on_TextureButton_button_down"] [connection signal="button_up" from="ServeArea/TextureButton" to="ServeArea" method="_on_TextureButton_button_up"]