added box trap

This commit is contained in:
OddlyTimbot 2024-08-04 18:53:22 -04:00
parent e8da3ca6c6
commit 8617bafe71
14 changed files with 63 additions and 53 deletions

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])

View File

@ -1,3 +1,4 @@
Node2D
Sprite2D Sprite2D
ParallaxLayer ParallaxLayer
ParallaxBackground ParallaxBackground
@ -9,6 +10,5 @@ Camera2D
TileMap TileMap
Node Node
AnimatedSprite2D AnimatedSprite2D
Node2D
Area2D Area2D
RayCast2D RayCast2D

View File

@ -19,8 +19,8 @@ dock_filesystem_split=0
dock_filesystem_display_mode=0 dock_filesystem_display_mode=0
dock_filesystem_file_sort=0 dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1 dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://graphics/background/Additional Water.png") dock_filesystem_selected_paths=PackedStringArray("res://scenes/crate.tscn")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scenes/", "res://graphics/", "res://graphics/background/") dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scenes/", "res://graphics/")
dock_3="Scene,Import" dock_3="Scene,Import"
dock_4="FileSystem" dock_4="FileSystem"
dock_5="Inspector,Node,History" 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" current_scene="res://scenes/game.tscn"
center_split_offset=-325 center_split_offset=-325
selected_default_debugger_tab_idx=0 selected_default_debugger_tab_idx=0
selected_main_editor_idx=0 selected_main_editor_idx=2
selected_bottom_panel_item=0 selected_bottom_panel_item=0
[ScriptEditor] [ScriptEditor]

View File

@ -1,5 +1,5 @@
ea4bc82a6ad023ab7ee23ee620429895 ea4bc82a6ad023ab7ee23ee620429895
::res://::1722807659 ::res://::1722811362
icon.svg::CompressedTexture2D::9114977118871582245::1722277386::1722277386::1::::<><>:: icon.svg::CompressedTexture2D::9114977118871582245::1722277386::1722277386::1::::<><>::
::res://graphics/::1722285155 ::res://graphics/::1722285155
Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1722277386::1722277386::1::::<><>:: 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::::<><>:: player land 48x48.png::CompressedTexture2D::3499637713582873633::1722277386::1722277386::1::::<><>::
::res://graphics/Player Run/::1722277386 ::res://graphics/Player Run/::1722277386
player run 48x48.png::CompressedTexture2D::1502492849971408816::1722277386::1722277386::1::::<><>:: player run 48x48.png::CompressedTexture2D::1502492849971408816::1722277386::1722277386::1::::<><>::
::res://scenes/::1722807322 ::res://scenes/::1722811260
bullet.tscn::PackedScene::6880909734590904373::1722807322::0::1::::<><>::res://scripts/bullet.gd bullet.tscn::PackedScene::6880909734590904373::1722808708::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 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::1722807322::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png crate.tscn::PackedScene::41931541512830250::1722808708::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 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::1722807322::0::1::::<><>:: platform.tscn::PackedScene::8641027994130079701::1722808708::0::1::::<><>::
::res://scripts/::1722287010 ::res://scripts/::1722287010
bullet.gd::GDScript::-1::1722277386::0::1::::<>Area2D<>:: bullet.gd::GDScript::-1::1722277386::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1722287010::0::1::::<>CharacterBody2D<>:: CharacterBody2D.gd::GDScript::-1::1722287010::0::1::::<>CharacterBody2D<>::

View File

@ -1,4 +1,5 @@
res://scenes/game.tscn res://scenes/game.tscn
res://scripts/gamecontroller.gd
res://scenes/character.tscn res://scenes/character.tscn
res://scenes/bullet.tscn res://scenes/bullet.tscn
res://scenes/crate.tscn res://scenes/crate.tscn

View File

@ -8,7 +8,7 @@ Anim={
"grid_snap_active": false, "grid_snap_active": false,
"grid_step": Vector2(8, 8), "grid_step": Vector2(8, 8),
"grid_visibility": 1, "grid_visibility": 1,
"ofs": Vector2(-412, -162), "ofs": Vector2(-412, -284.19),
"primary_grid_step": Vector2i(8, 8), "primary_grid_step": Vector2i(8, 8),
"show_edit_locks": true, "show_edit_locks": true,
"show_guides": true, "show_guides": true,
@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])

View File

@ -1,5 +1,5 @@
[folding] [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")] 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")]

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])

View File

@ -3,11 +3,11 @@
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 0, "column": 34,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 0, "row": 13,
"scroll_position": 0.0, "scroll_position": 3.0,
"selection": false, "selection": false,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }

View File

@ -525,6 +525,25 @@ tile_set = SubResource("TileSet_47g5u")
format = 2 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) 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="level" type="Node2D" parent="."]
[node name="StaticBody2D" type="StaticBody2D" parent="level"] [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")] [node name="crate1" parent="crates" instance=ExtResource("5_u8rgi")]
position = Vector2(-22, -30) position = Vector2(-22, -30)
[node name="boxtrap" type="Node2D" parent="crates"]
position = Vector2(131, -175)
[node name="Platform" parent="." instance=ExtResource("6_bcgm6")] [node name="Platform" parent="." instance=ExtResource("6_bcgm6")]
position = Vector2(472, -21) position = Vector2(472, -21)
@ -563,24 +585,5 @@ libraries = {
} }
autoplay = "move" 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="areatrigger" from="AreaTrigger" to="." method="_on_area_2d_areatrigger"]
[connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"] [connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"]

View File

@ -1,15 +1,18 @@
extends Node2D 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 _on_area_2d_areatrigger(effect, body):
func _ready(): print("Game Controller sees the trigger "+effect)
pass # Replace with function body. match effect:
"alert":
#do stuff
# Called every frame. 'delta' is the elapsed time since the previous frame. print("hi")
func _process(delta): if body.is_in_group("player"):
pass for n in 3:
var box = crate.instantiate()
add_child(box)
func _on_area_2d_areatrigger(effect, Object): box.position = boxtrap.position
print("Game Controller sees the trigger") "powerup":
print("you got power")