diff --git a/README.md b/README.md index 8fee551..7a95983 100644 --- a/README.md +++ b/README.md @@ -164,3 +164,31 @@ Set your user name: Set your email: `git config --global user.email "mona@lisa.com"` + +## Working from a branch + +It is a good idea to create a branch each time you are working on a major milestone. For the sake of the course, you should create a branch for each week. + +`git checkout -b week2` + +As always, you will add and commit your changes into the branch. + +`git add .` +`git commit -m "some message"` + +And if you wish, you can push the new branch to the remote repository just like you did with the main branch. + +`git push origin week2` + +Now you can work away without fear of messing up your project. Because if you need to, you can always revert back to the main branch, undoing all your changes. + + +`git checkout -b main` + +From the main branch, you can merge your updates from the week2 branch by simply using: + +`git merge week2` + +And after that, you are free to push the updates up to your repo. + +`git push origin main` diff --git a/week2/codeprimer.md b/week2/codeprimer.md index 5797b19..a6c3bd0 100644 --- a/week2/codeprimer.md +++ b/week2/codeprimer.md @@ -105,7 +105,7 @@ A very typical example is a variable that should be assigned during the “ready The “onready” decorator takes care of this by making sure the variable is assigned during the ready state. -@onready var animated_sprite = $AnimatedSprite2D +`@onready var animated_sprite = $AnimatedSprite2D` Note that the $ in front of the value assigned is a shortcut designation for the current scope. It is called an operator, and is used to retrieve children of the parent node. diff --git a/week2/updated_files/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg b/week2/updated_files/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg index 9b6c34e..ac475b5 100644 --- a/week2/updated_files/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg +++ b/week2/updated_files/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-53.4626, -32.546), +"ofs": Vector2(-145.758, -32.546), "primary_grid_step": Vector2i(8, 8), "show_group_gizmos": true, "show_guides": true, @@ -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")]) +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")]) diff --git a/week2/updated_files/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg b/week2/updated_files/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg index 9c53f0f..9e2a893 100644 --- a/week2/updated_files/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg +++ b/week2/updated_files/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg @@ -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")]) +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")]) diff --git a/week2/updated_files/.godot/editor/editor_layout.cfg b/week2/updated_files/.godot/editor/editor_layout.cfg index dcd2182..a52cf41 100644 --- a/week2/updated_files/.godot/editor/editor_layout.cfg +++ b/week2/updated_files/.godot/editor/editor_layout.cfg @@ -40,8 +40,8 @@ selected_bottom_panel_item=0 [ScriptEditor] -open_scripts=["res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] -selected_script="res://scripts/gamecontroller.gd" +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_help=[] script_split_offset=70 list_split_offset=0 diff --git a/week2/updated_files/.godot/editor/filesystem_cache8 b/week2/updated_files/.godot/editor/filesystem_cache8 index 5e52383..58db59a 100644 --- a/week2/updated_files/.godot/editor/filesystem_cache8 +++ b/week2/updated_files/.godot/editor/filesystem_cache8 @@ -1,11 +1,11 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1725900023 +::res://::1725904718 icon.svg::CompressedTexture2D::9114977118871582245::1718541837::1718541843::1::::<><>:: ::res://assets/::1718552371 -::res://scenes/::1724629924 -bullet.tscn::PackedScene::6880909734590904373::1724629924::0::1::::<><>::res://scripts/bullet.gd -character.tscn::PackedScene::451838158579532324::1724629924::0::1::::<><>::res://scripts/CharacterBody2D.gd -game.tscn::PackedScene::1738196330916037717::1724629924::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>res://scripts/Trigger.gd +::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 bullet.gd::GDScript::-1::1722021779::0::1::::<>Area2D<>:: CharacterBody2D.gd::GDScript::-1::1721179661::0::1::::<>CharacterBody2D<>:: diff --git a/week2/updated_files/.godot/editor/filesystem_update4 b/week2/updated_files/.godot/editor/filesystem_update4 index 7972f7c..f123e9a 100644 --- a/week2/updated_files/.godot/editor/filesystem_update4 +++ b/week2/updated_files/.godot/editor/filesystem_update4 @@ -1,3 +1,4 @@ res://scenes/game.tscn +res://scripts/CharacterBody2D.gd res://scenes/character.tscn res://scenes/bullet.tscn diff --git a/week2/updated_files/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg b/week2/updated_files/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg index c69d6f4..fc6bae6 100644 --- a/week2/updated_files/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/week2/updated_files/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -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")]) +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")]) diff --git a/week2/updated_files/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg b/week2/updated_files/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg index 9356504..781c64d 100644 --- a/week2/updated_files/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/week2/updated_files/.godot/editor/game.tscn-folding-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -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=[] +nodes_folded=[NodePath("RigidBody2D"), NodePath("groundblock"), NodePath("groundblock2"), NodePath("level"), NodePath("Area2D")] diff --git a/week2/updated_files/.godot/editor/project_metadata.cfg b/week2/updated_files/.godot/editor/project_metadata.cfg index 02b8b9f..9b24e37 100644 --- a/week2/updated_files/.godot/editor/project_metadata.cfg +++ b/week2/updated_files/.godot/editor/project_metadata.cfg @@ -12,7 +12,7 @@ run_debug_collisions=true [recent_files] scenes=["res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/game.tscn"] -scripts=["res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] +scripts=["res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] [linked_properties] diff --git a/week2/updated_files/.godot/editor/script_editor_cache.cfg b/week2/updated_files/.godot/editor/script_editor_cache.cfg index 08fd8f3..3794381 100644 --- a/week2/updated_files/.godot/editor/script_editor_cache.cfg +++ b/week2/updated_files/.godot/editor/script_editor_cache.cfg @@ -3,10 +3,10 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 45, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 0, +"row": 13, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" @@ -17,12 +17,16 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 52, +"column": 12, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 47, -"scroll_position": 30.0, -"selection": false, +"row": 33, +"scroll_position": 22.0, +"selection": true, +"selection_from_column": 2, +"selection_from_line": 33, +"selection_to_column": 12, +"selection_to_line": 33, "syntax_highlighter": "GDScript" } @@ -39,3 +43,17 @@ state={ "selection": false, "syntax_highlighter": "GDScript" } + +[res://scripts/Trigger.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 0, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 0, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} diff --git a/week2/updated_files/scripts/CharacterBody2D.gd b/week2/updated_files/scripts/CharacterBody2D.gd index 4ea0614..cdbae93 100644 --- a/week2/updated_files/scripts/CharacterBody2D.gd +++ b/week2/updated_files/scripts/CharacterBody2D.gd @@ -31,7 +31,6 @@ func _physics_process(delta): velocity.y = JUMP_VELOCITY # Hand force push (melee attack) if Input.is_action_just_pressed("push") && pushRightEnabled && faceLeft == false: - print("I should force push") pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE * 10) pushRightEnabled = false if Input.is_action_just_pressed("push") && pushLeftEnabled: diff --git a/week4/updated_project/.godot/editor/filesystem_cache8 b/week4/updated_project/.godot/editor/filesystem_cache8 index 4a9d765..cf99634 100644 --- a/week4/updated_project/.godot/editor/filesystem_cache8 +++ b/week4/updated_project/.godot/editor/filesystem_cache8 @@ -1,5 +1,5 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1724630360 +::res://::1725904667 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/::1724626017 -bullet.tscn::PackedScene::6880909734590904373::1724626017::0::1::::<><>::res://scripts/bullet.gd -character.tscn::PackedScene::451838158579532324::1724626017::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::1724626017::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png -game.tscn::PackedScene::1738196330916037717::1724626017::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::1724626017::0::1::::<><>:: +::res://scenes/::1724634527 +bullet.tscn::PackedScene::6880909734590904373::1724634489::0::1::::<><>::res://scripts/bullet.gd +character.tscn::PackedScene::451838158579532324::1724634489::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::1724634489::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png +game.tscn::PackedScene::1738196330916037717::1724634527::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::1724634489::0::1::::<><>:: ::res://scripts/::1722811640 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 deleted file mode 100644 index 901a6f7..0000000 --- a/week4/updated_project/.godot/editor/filesystem_update4 +++ /dev/null @@ -1,5 +0,0 @@ -res://scenes/game.tscn -res://scenes/character.tscn -res://scenes/bullet.tscn -res://scenes/crate.tscn -res://scenes/platform.tscn