updated scene manager for week 2

This commit is contained in:
OddlyTimbot 2024-09-09 16:36:12 -04:00
parent 0eb54aac54
commit cbd41bb063
15 changed files with 50 additions and 48 deletions

View File

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

View File

@ -175,4 +175,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/level")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/SceneManager")])

View File

@ -8,7 +8,7 @@ Anim={
"grid_snap_active": false,
"grid_step": Vector2(8, 8),
"grid_visibility": 1,
"ofs": Vector2(-105.112, -79.4505),
"ofs": Vector2(-452.67, -210.078),
"primary_grid_step": Vector2i(8, 8),
"show_group_gizmos": true,
"show_guides": true,
@ -34,7 +34,7 @@ Anim={
"snap_rotation_step": 0.261799,
"snap_scale": false,
"snap_scale_step": 0.1,
"zoom": 4.23785
"zoom": 0.707107
}
3D={
"fov": 70.01,
@ -175,4 +175,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/level")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/SceneManager")])

View File

@ -1,3 +1,4 @@
Node
Node2D
CollisionShape2D
Area2D

View File

@ -19,7 +19,7 @@ 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://scenes/bullet.tscn")
dock_filesystem_selected_paths=PackedStringArray("res://scripts/SceneManager.gd")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scenes/")
dock_bottom=[]
dock_closed=[]
@ -40,8 +40,8 @@ selected_bottom_panel_item=0
[ScriptEditor]
open_scripts=["res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd", "res://scripts/Trigger.gd"]
selected_script="res://scripts/Trigger.gd"
open_scripts=["res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/SceneManager.gd", "res://scripts/Trigger.gd"]
selected_script="res://scripts/SceneManager.gd"
open_help=[]
script_split_offset=70
list_split_offset=0

View File

@ -2,12 +2,12 @@ ea4bc82a6ad023ab7ee23ee620429895
::res://::1725904718
icon.svg::CompressedTexture2D::9114977118871582245::1718541837::1718541843::1::::<><>::
::res://assets/::1718552371
::res://scenes/::1725900535
bullet.tscn::PackedScene::6880909734590904373::1725900535::0::1::::<><>::res://scripts/bullet.gd
character.tscn::PackedScene::451838158579532324::1725900535::0::1::::<><>::res://scripts/CharacterBody2D.gd
game.tscn::PackedScene::1738196330916037717::1725900535::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>res://scripts/Trigger.gd
::res://scripts/::1722021779
::res://scenes/::1725906775
bullet.tscn::PackedScene::6880909734590904373::1725906775::0::1::::<><>::res://scripts/bullet.gd
character.tscn::PackedScene::451838158579532324::1725906775::0::1::::<><>::res://scripts/CharacterBody2D.gd
game.tscn::PackedScene::1738196330916037717::1725913478::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>res://scripts/Trigger.gd
::res://scripts/::1725906775
bullet.gd::GDScript::-1::1722021779::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1721179661::0::1::::<>CharacterBody2D<>::
CharacterBody2D.gd::GDScript::-1::1725906775::0::1::::<>CharacterBody2D<>::
gamecontroller.gd::GDScript::-1::1718560874::0::1::::<>Node2D<>::
Trigger.gd::GDScript::-1::1718561036::0::1::::<>Area2D<>::

View File

@ -2,3 +2,4 @@ res://scenes/game.tscn
res://scripts/CharacterBody2D.gd
res://scenes/character.tscn
res://scenes/bullet.tscn
res://scripts/SceneManager.gd

View File

@ -175,4 +175,4 @@ Anim={
"zfar": 4000.01,
"znear": 0.05
}
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/level")])
selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@16886/@Panel@13/@VBoxContainer@14/DockHSplitLeftL/DockHSplitLeftR/DockHSplitMain/@VBoxContainer@25/DockVSplitCenter/@VSplitContainer@52/@VBoxContainer@53/@PanelContainer@98/MainScreen/@CanvasItemEditor@9272/@VSplitContainer@9094/@HSplitContainer@9096/@HSplitContainer@9098/@Control@9099/@SubViewportContainer@9100/@SubViewport@9101/Game/SceneManager")])

View File

@ -2,4 +2,4 @@
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("RigidBody2D"), PackedStringArray("Transform"), NodePath("RigidBody2D/CollisionShape2D"), PackedStringArray("Transform"), NodePath("groundblock"), PackedStringArray("Transform"), NodePath("groundblock/CollisionShape2D"), PackedStringArray("Transform"), NodePath("groundblock2"), PackedStringArray("Transform"), NodePath("groundblock2/CollisionShape2D"), PackedStringArray("Transform"), NodePath("level/groundblock2"), PackedStringArray("Transform"), NodePath("level/groundblock2/CollisionShape2D"), PackedStringArray("Transform"), NodePath("level/groundblock3"), PackedStringArray("Transform"), NodePath("level/groundblock3/CollisionShape2D"), PackedStringArray("Transform"), NodePath("level/StaticBody2D"), PackedStringArray("Transform"), NodePath("CharacterBody2D"), PackedStringArray("Transform"), NodePath("Area2D"), PackedStringArray("Transform")]
resource_unfolds=["res://scenes/game.tscn::RectangleShape2D_4vo4d", PackedStringArray("Resource"), "res://scenes/game.tscn::RectangleShape2D_cq7kj", PackedStringArray("Resource"), "res://scenes/game.tscn::WorldBoundaryShape2D_3u4a8", PackedStringArray("Resource"), "res://scenes/game.tscn::CircleShape2D_x8qck", PackedStringArray("Resource")]
nodes_folded=[NodePath("RigidBody2D"), NodePath("groundblock"), NodePath("groundblock2"), NodePath("level"), NodePath("Area2D")]
nodes_folded=[NodePath("RigidBody2D"), NodePath("groundblock"), NodePath("groundblock2"), NodePath("level")]

View File

@ -11,7 +11,7 @@ run_debug_collisions=true
[recent_files]
scenes=["res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/game.tscn"]
scenes=["res://scenes/game.tscn", "res://scenes/bullet.tscn", "res://scenes/character.tscn"]
scripts=["res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"]
[linked_properties]

View File

@ -1,32 +1,14 @@
[res://scripts/gamecontroller.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 45,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 13,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/CharacterBody2D.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 12,
"column": 38,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 33,
"scroll_position": 22.0,
"selection": true,
"selection_from_column": 2,
"selection_from_line": 33,
"selection_to_column": 12,
"selection_to_line": 33,
"row": 44,
"scroll_position": 31.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -57,3 +39,17 @@ state={
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/SceneManager.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 22,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 13,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=8 format=3 uid="uid://y083suj12rld"]
[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_77wyw"]
[ext_resource type="Script" path="res://scripts/SceneManager.gd" id="1_77wyw"]
[ext_resource type="PackedScene" uid="uid://go4yc8hfo1gq" path="res://scenes/character.tscn" id="2_64ccm"]
[ext_resource type="Script" path="res://scripts/Trigger.gd" id="2_nfj1w"]
@ -16,6 +16,9 @@ size = Vector2(91, 20)
radius = 60.2993
[node name="Game" type="Node2D"]
[node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("1_77wyw")
[node name="RigidBody2D" type="RigidBody2D" parent="." groups=["boxes"]]

View File

@ -41,11 +41,8 @@ func _physics_process(delta):
#make a bullet
var myBullet = bullet.instantiate()
#set bullet speed?
#put the bullet at the Marker
owner.add_child(myBullet)
myBullet.transform = marker_right.global_transform
pass
%SceneManager.manageBullet(myBullet)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")

View File

@ -1,6 +1,6 @@
extends Node2D
extends Node
var bulletsFiredTotal := 0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
@ -10,6 +10,7 @@ func _ready():
func _process(delta):
pass
func _on_area_2d_areatrigger(effect, Object):
print("Game Controller sees the trigger")
func manageBullet(bullet):
bulletsFiredTotal +=1
owner.add_child(bullet)
print("Total bullets fired "+str(bulletsFiredTotal))