From 8617bafe71dfdf631563d80236150ad4658af171 Mon Sep 17 00:00:00 2001 From: OddlyTimbot Date: Sun, 4 Aug 2024 18:53:22 -0400 Subject: [PATCH] added box trap --- ...state-6d8e6ff1e6f20a36e0402d27c623c86c.cfg | 2 +- ...state-b6bd7a241034177d7fe082a7597ba8ea.cfg | 2 +- ...state-65637dc57c83dac3d15ec1cb22439bd7.cfg | 2 +- .../.godot/editor/create_recent.Node | 2 +- .../.godot/editor/editor_layout.cfg | 6 +-- .../.godot/editor/filesystem_cache8 | 14 +++---- .../.godot/editor/filesystem_update4 | 1 + ...state-c2a7af834e91ff64325daddf58e45dc0.cfg | 4 +- ...lding-c2a7af834e91ff64325daddf58e45dc0.cfg | 4 +- ...lding-f1f331c27a8a747c68def87f3a691aa7.cfg | 3 ++ ...state-cc2f727180cd42d9c13434cb55b1ce69.cfg | 2 +- .../.godot/editor/script_editor_cache.cfg | 6 +-- week4/updated_project/scenes/game.tscn | 41 ++++++++++--------- .../updated_project/scripts/gamecontroller.gd | 27 ++++++------ 14 files changed, 63 insertions(+), 53 deletions(-) create mode 100644 week4/updated_project/.godot/editor/gamecontroller.gd-folding-f1f331c27a8a747c68def87f3a691aa7.cfg diff --git a/week4/updated_project/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg b/week4/updated_project/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg index e74f388..1befa4d 100644 --- a/week4/updated_project/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg +++ b/week4/updated_project/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/TileMap")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/AreaTrigger")]) diff --git a/week4/updated_project/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg b/week4/updated_project/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg index 04e6768..102aa37 100644 --- a/week4/updated_project/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg +++ b/week4/updated_project/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/TileMap")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/AreaTrigger")]) diff --git a/week4/updated_project/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg b/week4/updated_project/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg index 0ef8215..42509f1 100644 --- a/week4/updated_project/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg +++ b/week4/updated_project/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/TileMap")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/AreaTrigger")]) diff --git a/week4/updated_project/.godot/editor/create_recent.Node b/week4/updated_project/.godot/editor/create_recent.Node index 0ea4127..8788c74 100644 --- a/week4/updated_project/.godot/editor/create_recent.Node +++ b/week4/updated_project/.godot/editor/create_recent.Node @@ -1,3 +1,4 @@ +Node2D Sprite2D ParallaxLayer ParallaxBackground @@ -9,6 +10,5 @@ Camera2D TileMap Node AnimatedSprite2D -Node2D Area2D RayCast2D diff --git a/week4/updated_project/.godot/editor/editor_layout.cfg b/week4/updated_project/.godot/editor/editor_layout.cfg index 47c1daf..2cf23ec 100644 --- a/week4/updated_project/.godot/editor/editor_layout.cfg +++ b/week4/updated_project/.godot/editor/editor_layout.cfg @@ -19,8 +19,8 @@ dock_filesystem_split=0 dock_filesystem_display_mode=0 dock_filesystem_file_sort=0 dock_filesystem_file_list_display_mode=1 -dock_filesystem_selected_paths=PackedStringArray("res://graphics/background/Additional Water.png") -dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scenes/", "res://graphics/", "res://graphics/background/") +dock_filesystem_selected_paths=PackedStringArray("res://scenes/crate.tscn") +dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scenes/", "res://graphics/") dock_3="Scene,Import" dock_4="FileSystem" dock_5="Inspector,Node,History" @@ -31,7 +31,7 @@ open_scenes=PackedStringArray("res://scenes/game.tscn", "res://scenes/character. current_scene="res://scenes/game.tscn" center_split_offset=-325 selected_default_debugger_tab_idx=0 -selected_main_editor_idx=0 +selected_main_editor_idx=2 selected_bottom_panel_item=0 [ScriptEditor] diff --git a/week4/updated_project/.godot/editor/filesystem_cache8 b/week4/updated_project/.godot/editor/filesystem_cache8 index 5b24989..de9b538 100644 --- a/week4/updated_project/.godot/editor/filesystem_cache8 +++ b/week4/updated_project/.godot/editor/filesystem_cache8 @@ -1,5 +1,5 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1722807659 +::res://::1722811362 icon.svg::CompressedTexture2D::9114977118871582245::1722277386::1722277386::1::::<><>:: ::res://graphics/::1722285155 Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1722277386::1722277386::1::::<><>:: @@ -17,12 +17,12 @@ player jump 48x48.png::CompressedTexture2D::1627608568707791839::1722277386::172 player land 48x48.png::CompressedTexture2D::3499637713582873633::1722277386::1722277386::1::::<><>:: ::res://graphics/Player Run/::1722277386 player run 48x48.png::CompressedTexture2D::1502492849971408816::1722277386::1722277386::1::::<><>:: -::res://scenes/::1722807322 -bullet.tscn::PackedScene::6880909734590904373::1722807322::0::1::::<><>::res://scripts/bullet.gd -character.tscn::PackedScene::451838158579532324::1722807322::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png -crate.tscn::PackedScene::41931541512830250::1722807322::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png -game.tscn::PackedScene::1738196330916037717::1722807322::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://dvd1p6xue0ub2::::res://scenes/platform.tscn -platform.tscn::PackedScene::8641027994130079701::1722807322::0::1::::<><>:: +::res://scenes/::1722811260 +bullet.tscn::PackedScene::6880909734590904373::1722808708::0::1::::<><>::res://scripts/bullet.gd +character.tscn::PackedScene::451838158579532324::1722808708::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png +crate.tscn::PackedScene::41931541512830250::1722808708::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png +game.tscn::PackedScene::1738196330916037717::1722811260::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://dvd1p6xue0ub2::::res://scenes/platform.tscn<>uid://dly4g7fvvtamm::::res://graphics/background/BG Image.png<>uid://cw50mfjp2np08::::res://graphics/background/Additional Sky.png<>uid://6olcj1w1svdg::::res://graphics/background/Additional Water.png +platform.tscn::PackedScene::8641027994130079701::1722808708::0::1::::<><>:: ::res://scripts/::1722287010 bullet.gd::GDScript::-1::1722277386::0::1::::<>Area2D<>:: CharacterBody2D.gd::GDScript::-1::1722287010::0::1::::<>CharacterBody2D<>:: diff --git a/week4/updated_project/.godot/editor/filesystem_update4 b/week4/updated_project/.godot/editor/filesystem_update4 index 901a6f7..a4028b1 100644 --- a/week4/updated_project/.godot/editor/filesystem_update4 +++ b/week4/updated_project/.godot/editor/filesystem_update4 @@ -1,4 +1,5 @@ res://scenes/game.tscn +res://scripts/gamecontroller.gd res://scenes/character.tscn res://scenes/bullet.tscn res://scenes/crate.tscn diff --git a/week4/updated_project/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg b/week4/updated_project/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg index b259480..70da873 100644 --- a/week4/updated_project/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/week4/updated_project/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-412, -162), +"ofs": Vector2(-412, -284.19), "primary_grid_step": Vector2i(8, 8), "show_edit_locks": true, "show_guides": true, @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/TileMap")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/AreaTrigger")]) diff --git a/week4/updated_project/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg b/week4/updated_project/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg index c616045..0ac2829 100644 --- a/week4/updated_project/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/week4/updated_project/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -1,5 +1,5 @@ [folding] -node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("layer__array", "tile_set"), NodePath("level"), PackedStringArray("Transform"), NodePath("AreaTrigger"), PackedStringArray("Transform"), NodePath("Platform"), PackedStringArray("Transform"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform", "texture")] +node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("layer__array", "tile_set"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform", "texture"), NodePath("level"), PackedStringArray("Transform"), NodePath("AreaTrigger"), PackedStringArray("Transform"), NodePath("Platform"), PackedStringArray("Transform")] resource_unfolds=["res://scenes/game.tscn::TileSet_47g5u", PackedStringArray("terrain_set_0/terrain__array", "physics_layer__array"), "res://scenes/game.tscn::WorldBoundaryShape2D_xkyim", PackedStringArray(), "res://scenes/game.tscn::CircleShape2D_x8qck", PackedStringArray("Resource")] -nodes_folded=[NodePath("level"), NodePath("CharacterBody2D"), NodePath("AreaTrigger")] +nodes_folded=[NodePath("ParallaxBackground/ParallaxLayer"), NodePath("level"), NodePath("CharacterBody2D"), NodePath("AreaTrigger")] diff --git a/week4/updated_project/.godot/editor/gamecontroller.gd-folding-f1f331c27a8a747c68def87f3a691aa7.cfg b/week4/updated_project/.godot/editor/gamecontroller.gd-folding-f1f331c27a8a747c68def87f3a691aa7.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/week4/updated_project/.godot/editor/gamecontroller.gd-folding-f1f331c27a8a747c68def87f3a691aa7.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/week4/updated_project/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg b/week4/updated_project/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg index ccfedda..2d5a861 100644 --- a/week4/updated_project/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg +++ b/week4/updated_project/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/TileMap")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/AreaTrigger")]) diff --git a/week4/updated_project/.godot/editor/script_editor_cache.cfg b/week4/updated_project/.godot/editor/script_editor_cache.cfg index 5d47be4..836995d 100644 --- a/week4/updated_project/.godot/editor/script_editor_cache.cfg +++ b/week4/updated_project/.godot/editor/script_editor_cache.cfg @@ -3,11 +3,11 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 34, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 0, -"scroll_position": 0.0, +"row": 13, +"scroll_position": 3.0, "selection": false, "syntax_highlighter": "GDScript" } diff --git a/week4/updated_project/scenes/game.tscn b/week4/updated_project/scenes/game.tscn index 586e693..85dc7ad 100644 --- a/week4/updated_project/scenes/game.tscn +++ b/week4/updated_project/scenes/game.tscn @@ -525,6 +525,25 @@ tile_set = SubResource("TileSet_47g5u") format = 2 layer_0/tile_data = PackedInt32Array(262141, 262144, 2, 262142, 65536, 4, 262143, 65536, 4, 196608, 65536, 4, 196609, 65536, 4, 196610, 131072, 4, 196613, 262144, 4, 196605, 262144, 1, 131069, 262144, 1, 65534, 65536, 4, 65535, 131072, 4, 4, 131072, 2, 3, 0, 2, -65533, 0, 0, -65532, 131072, 0, 262151, 262144, 2, 196615, 262144, 0, 262153, 262144, 4, 262156, 131072, 2, 196620, 131072, 0, 196619, 0, 0, 262155, 0, 2, 7, 0, 4, 8, 65536, 4, 9, 65536, 4, 10, 1048576, 4, -65526, 983040, 3, -65525, 65536, 4, -65524, 131072, 4, 65550, 0, 4, 65551, 851968, 3, 65552, 131072, 4, 131087, 262144, 2, 65533, 983040, 3, 196630, 0, 4, 196631, 65536, 4, 196632, 131072, 4, 65559, 262144, 4) +[node name="ParallaxBackground" type="ParallaxBackground" parent="."] + +[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] +motion_mirroring = Vector2(324, 0) + +[node name="Sprite2D" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] +position = Vector2(150, 50) +texture = ExtResource("7_gwkt6") + +[node name="Sprite2D2" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] +position = Vector2(150, -115.5) +scale = Vector2(12, 8.21875) +texture = ExtResource("8_pwboq") + +[node name="Sprite2D3" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] +position = Vector2(150.5, 175.5) +scale = Vector2(11.9687, 4.21875) +texture = ExtResource("9_pi0v8") + [node name="level" type="Node2D" parent="."] [node name="StaticBody2D" type="StaticBody2D" parent="level"] @@ -554,6 +573,9 @@ debug_color = Color(0.556863, 0.415686, 0.964706, 0.419608) [node name="crate1" parent="crates" instance=ExtResource("5_u8rgi")] position = Vector2(-22, -30) +[node name="boxtrap" type="Node2D" parent="crates"] +position = Vector2(131, -175) + [node name="Platform" parent="." instance=ExtResource("6_bcgm6")] position = Vector2(472, -21) @@ -563,24 +585,5 @@ libraries = { } autoplay = "move" -[node name="ParallaxBackground" type="ParallaxBackground" parent="."] - -[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] -motion_mirroring = Vector2(324, 0) - -[node name="Sprite2D" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] -position = Vector2(150, 50) -texture = ExtResource("7_gwkt6") - -[node name="Sprite2D2" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] -position = Vector2(150, -115.5) -scale = Vector2(12, 8.21875) -texture = ExtResource("8_pwboq") - -[node name="Sprite2D3" type="Sprite2D" parent="ParallaxBackground/ParallaxLayer"] -position = Vector2(150.5, 175.5) -scale = Vector2(11.9687, 4.21875) -texture = ExtResource("9_pi0v8") - [connection signal="areatrigger" from="AreaTrigger" to="." method="_on_area_2d_areatrigger"] [connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"] diff --git a/week4/updated_project/scripts/gamecontroller.gd b/week4/updated_project/scripts/gamecontroller.gd index 0ad265d..4df82c7 100644 --- a/week4/updated_project/scripts/gamecontroller.gd +++ b/week4/updated_project/scripts/gamecontroller.gd @@ -1,15 +1,18 @@ extends Node2D +var crate = preload("res://scenes/crate.tscn") +@onready var boxtrap = $crates/boxtrap -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass - - -func _on_area_2d_areatrigger(effect, Object): - print("Game Controller sees the trigger") +func _on_area_2d_areatrigger(effect, body): + print("Game Controller sees the trigger "+effect) + match effect: + "alert": + #do stuff + print("hi") + if body.is_in_group("player"): + for n in 3: + var box = crate.instantiate() + add_child(box) + box.position = boxtrap.position + "powerup": + print("you got power")