From 6e62c509300293f6411f888c5cb0356e5dfadbb2 Mon Sep 17 00:00:00 2001 From: Topvennie Date: Thu, 18 Apr 2024 15:53:19 +0200 Subject: [PATCH] docs: added comments --- .godot/editor/editor_layout.cfg | 12 +++--- .godot/editor/filesystem_cache8 | 26 +++++------ .godot/editor/filesystem_update4 | 4 +- .godot/editor/project_metadata.cfg | 7 +-- .godot/editor/script_editor_cache.cfg | 60 +++++++++++++++++++------- .godot/uid_cache.bin | Bin 124 -> 153 bytes Camera2D.gd => Main.gd | 17 ++++---- Main.tscn | 4 +- Player.gd | 10 +++-- Player.tscn | 58 +++++++++++++------------ Tower.gd | 2 +- 11 files changed, 119 insertions(+), 81 deletions(-) rename Camera2D.gd => Main.gd (78%) diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index dffe9f5..f165a97 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -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://") +dock_filesystem_selected_paths=PackedStringArray("res://Player.tscn") dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://") dock_3="Scene,Import" dock_4="FileSystem" @@ -27,17 +27,17 @@ dock_5="Inspector,Node,History" [EditorNode] -open_scenes=PackedStringArray("res://Main.tscn") -current_scene="res://Main.tscn" +open_scenes=PackedStringArray("res://Main.tscn", "res://Player.tscn") +current_scene="res://Player.tscn" center_split_offset=0 selected_default_debugger_tab_idx=0 selected_main_editor_idx=2 -selected_bottom_panel_item=1 +selected_bottom_panel_item=0 [ScriptEditor] -open_scripts=["res://Camera2D.gd", "res://Player.gd"] -selected_script="res://Camera2D.gd" +open_scripts=["res://Main.gd", "res://Player.gd", "res://Tower.gd", "res://UI.gd"] +selected_script="res://Player.gd" open_help=[] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/filesystem_cache8 b/.godot/editor/filesystem_cache8 index 9e03851..a5beb8a 100644 --- a/.godot/editor/filesystem_cache8 +++ b/.godot/editor/filesystem_cache8 @@ -1,14 +1,14 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1713198935 -Camera2D.gd::GDScript::-1::1713198916::0::1::::<>Node<>:: -default_env.tres::Environment::-1::1713198916::0::1::::<><>:: -icon.png::CompressedTexture2D::224231617940432086::1713198714::1713198936::1::::<><>:: -Main.tscn::PackedScene::-1::1713198916::0::1::::<><>::res://Camera2D.gd<>res://Player.tscn<>res://res/sprites.png<>res://UI.tscn -Player.gd::GDScript::-1::1713198916::0::1::::<>Area2D<>:: -Player.tscn::PackedScene::-1::1713198916::0::1::::<><>::res://Player.gd<>res://res/sprites.png -Tower.gd::GDScript::-1::1713198916::0::1::::<>Node2D<>:: -Tower.tscn::PackedScene::-1::1713198916::0::1::::<><>::res://Tower.gd<>res://res/sprites.png -UI.gd::GDScript::-1::1713198916::0::1::::<>CanvasLayer<>:: -UI.tscn::PackedScene::-1::1713198916::0::1::::<><>::res://UI.gd -::res://res/::1713198714 -sprites.png::CompressedTexture2D::1870513174833790166::1713198714::1713198936::1::::<><>:: +::res://::1713445642 +default_env.tres::Environment::2706437284641004306::1713444527::0::1::::<><>:: +icon.png::CompressedTexture2D::224231617940432086::1713444527::1713444527::1::::<><>:: +Main.gd::GDScript::-1::1713444527::0::1::::<>Node<>:: +Main.tscn::PackedScene::798496173305188108::1713445635::0::1::::<><>::res://Main.gd<>res://Player.tscn<>uid://1wdcw8ne7j5w::::res://res/sprites.png<>res://UI.tscn +Player.gd::GDScript::-1::1713444527::0::1::::<>Area2D<>:: +Player.tscn::PackedScene::-1::1713444527::0::1::::<><>::res://Player.gd<>res://res/sprites.png +Tower.gd::GDScript::-1::1713444527::0::1::::<>Node2D<>:: +Tower.tscn::PackedScene::-1::1713444527::0::1::::<><>::res://Tower.gd<>res://res/sprites.png +UI.gd::GDScript::-1::1713444527::0::1::::<>CanvasLayer<>:: +UI.tscn::PackedScene::-1::1713444527::0::1::::<><>::res://UI.gd +::res://res/::1713444527 +sprites.png::CompressedTexture2D::1870513174833790166::1713444527::1713444527::1::::<><>:: diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index f32698d..bd345ee 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -1,4 +1,6 @@ res://default_env.tres res://Main.tscn -res://Camera2D.gd +res://Player.tscn res://Player.gd +res://Tower.gd +res://Main.gd diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 2d06c85..46f9a34 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -1,6 +1,6 @@ [editor_metadata] -executable_path="C:/Users/Gebruiker/Desktop/Godot_v4.2.1-stable_win64.exe/Godot_v4.2.1-stable_win64.exe" +executable_path="/home/vincent/Documents/programming/godot/Godot_v4.2.1-stable_linux.x86_64" [debug_options] @@ -9,8 +9,8 @@ run_reload_scripts=true [recent_files] -scenes=["res://Main.tscn"] -scripts=["res://Player.gd", "res://Camera2D.gd"] +scenes=["res://Player.tscn", "res://Main.tscn"] +scripts=["res://UI.gd", "res://Main.gd", "res://Tower.gd", "res://Player.gd", "res://Camera2D.gd"] [linked_properties] @@ -18,3 +18,4 @@ Node2D:scale=true Sprite2D:scale=true ParallaxLayer:motion_scale=true ParallaxLayer:scale=true +Area2D:scale=true diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 0367be0..defda25 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -1,26 +1,54 @@ -[res://Camera2D.gd] - -state={ -"bookmarks": PackedInt32Array(), -"breakpoints": PackedInt32Array(), -"column": 12, -"folded_lines": Array[int]([]), -"h_scroll_position": 0, -"row": 41, -"scroll_position": 0.0, -"selection": false, -"syntax_highlighter": "GDScript" -} - [res://Player.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 46, +"column": 1, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 8, +"row": 68, +"scroll_position": 25.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://Tower.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 16, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://Main.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 25, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://UI.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 19, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index 7a0b4b42616f9e54e2ce1e5536398fbaae4bd649..e6f1a93fca1814ee0823ea992796574dcf03b02f 100644 GIT binary patch delta 71 zcmb=K$;iUWz`!t3&ROc3%7J&~3uT!3fc&D=Vk>?9%;fw$y@I^-iHXv(%rP$0^KE^# S1>v#*If<32MS3O0$$0?JtrX<| delta 40 ucmbQqSR=>6z`$@#<-oi0g)+>1Kz31Tv6a4lW^#U>UO`^^L>A|XiP8Y screen_size.y: emit_signal("hit") - print(position) playing = false func update_rotation(): rotation = atan(speed_y / speed) -func _on_Player_body_entered(body): +# Hit detection +func _on_Player_body_entered(_body): playing = false start_game() diff --git a/Player.tscn b/Player.tscn index a3746be..55ed7df 100644 --- a/Player.tscn +++ b/Player.tscn @@ -1,60 +1,64 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=3 uid="uid://bkppr8vsso41l"] -[ext_resource path="res://Player.gd" type="Script" id=1] -[ext_resource path="res://res/sprites.png" type="Texture2D" id=2] +[ext_resource type="Script" path="res://Player.gd" id="1"] +[ext_resource type="Texture2D" uid="uid://1wdcw8ne7j5w" path="res://res/sprites.png" id="2"] -[sub_resource type="AtlasTexture" id=1] -atlas = ExtResource( 2 ) -region = Rect2( -4, 488, 84, 16 ) +[sub_resource type="AtlasTexture" id="1"] +atlas = ExtResource("2") +region = Rect2(-4, 488, 84, 16) -[sub_resource type="Animation" id=2] +[sub_resource type="Animation" id="2"] length = 0.8 -loop = true +loop_mode = 1 step = 0.2 tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true tracks/0/path = NodePath("Node2D/Sprite2D:frame") tracks/0/interp = 1 tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true tracks/0/keys = { -"times": PackedFloat32Array( 0, 0.2, 0.4, 0.6 ), -"transitions": PackedFloat32Array( 1, 1, 1, 1 ), +"times": PackedFloat32Array(0, 0.2, 0.4, 0.6), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [ 0, 1, 2, 1 ] +"values": [0, 1, 2, 1] } -[sub_resource type="CapsuleShape2D" id=3] -radius = 12.8837 +[sub_resource type="AnimationLibrary" id="AnimationLibrary_s168r"] +_data = { +"fly": SubResource("2") +} + +[sub_resource type="CapsuleShape2D" id="3"] +radius = 2.03742 height = 4.07484 [node name="Area2D" type="Area2D"] -position = Vector2( 9.25964, 6.09653 ) -scale = Vector2( 1, 1.02134 ) -script = ExtResource( 1 ) -__meta__ = { -"_edit_group_": true -} +position = Vector2(9.25964, 6.09653) +scale = Vector2(1, 1.02134) +script = ExtResource("1") [node name="Node2D" type="Node2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="Node2D"] -position = Vector2( -3.46641, -2.14102 ) -scale = Vector2( 2.14565, 2.14019 ) -texture = SubResource( 1 ) +position = Vector2(-3.46641, -2.14102) +scale = Vector2(2.14565, 2.14019) +texture = SubResource("1") hframes = 3 [node name="AnimationPlayer" type="AnimationPlayer" parent="Node2D"] root_node = NodePath("../..") +libraries = { +"": SubResource("AnimationLibrary_s168r") +} autoplay = "fly" -anims/fly = SubResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] rotation = 1.5708 -shape = SubResource( 3 ) +shape = SubResource("3") [node name="Camera2D" type="Camera2D" parent="."] -current = true limit_top = 0 limit_bottom = 0 + [connection signal="body_entered" from="." to="." method="_on_Player_body_entered"] diff --git a/Tower.gd b/Tower.gd index cb49cc6..70f97fb 100644 --- a/Tower.gd +++ b/Tower.gd @@ -8,7 +8,7 @@ func _ready(): add_to_group("tower") pass # Replace with function body. -func _on_Tower_body_entered(body): +func _on_Tower_body_entered(_body): emit_signal("hit") func _on_Visibility_screen_exited():