diff --git a/Mr. Brick Adventures.sln.DotSettings.user b/Mr. Brick Adventures.sln.DotSettings.user index fcca6bf..e752dd6 100644 --- a/Mr. Brick Adventures.sln.DotSettings.user +++ b/Mr. Brick Adventures.sln.DotSettings.user @@ -1,6 +1,8 @@  ForceIncluded ForceIncluded + ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded diff --git a/objects/entities/child.tscn b/objects/entities/child.tscn index 10b5d2c..5e87e47 100644 --- a/objects/entities/child.tscn +++ b/objects/entities/child.tscn @@ -12,7 +12,7 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_dj5g5"] size = Vector2(10, 20) -[node name="Child" type="Area2D"] +[node name="Child" type="Area2D" groups=["Collectables"]] collision_layer = 0 collision_mask = 4 diff --git a/objects/entities/collapsing_block.tscn b/objects/entities/collapsing_block.tscn index 86b1ee5..fe7b665 100644 --- a/objects/entities/collapsing_block.tscn +++ b/objects/entities/collapsing_block.tscn @@ -37,7 +37,7 @@ script = ExtResource("2_jmsgb") ToCollapseTimer = NodePath("../ToCollapseTimer") ResetTimer = NodePath("../ResetTimer") Sprite2D = NodePath("../Sprite2D") -CollisionShape = NodePath("../Collapsable detector/AreaCollisionShape2D") +CollisionShape = NodePath("../StaticCollisionShape2D") ResetTime = 1.0 [connection signal="body_entered" from="Collapsable detector" to="CollapsableComponent" method="OnCollapsableDetectorBodyEntered"] diff --git a/objects/entities/collapsing_bridge.tscn b/objects/entities/collapsing_bridge.tscn index 5e80bdf..3f44887 100644 --- a/objects/entities/collapsing_bridge.tscn +++ b/objects/entities/collapsing_bridge.tscn @@ -39,7 +39,7 @@ script = ExtResource("2_w33sr") ToCollapseTimer = NodePath("../ToCollapseTimer") ResetTimer = NodePath("../ResetTimer") Sprite2D = NodePath("../Sprite2D") -CollisionShape = NodePath("../Collapsable detector/AreaCollisionShape2D") +CollisionShape = NodePath("../StaticCollisionShape2D") CollapseTime = 0.75 ResetTime = 3.0 diff --git a/objects/entities/exit_level.tscn b/objects/entities/exit_level.tscn index 45d3f3d..f0e8963 100644 --- a/objects/entities/exit_level.tscn +++ b/objects/entities/exit_level.tscn @@ -39,5 +39,5 @@ metadata/_custom_type_script = "uid://c8xhgkg8gcqu6" script = ExtResource("4_06sog") ExitArea = NodePath("..") DoorSprite = NodePath("../Sprite2D") -OpenedDoorFrame = 1 +OpenedDoorFrame = 88 metadata/_custom_type_script = "uid://bwamqffvpa452" diff --git a/project.godot b/project.godot index 7406381..58c0616 100644 --- a/project.godot +++ b/project.godot @@ -73,6 +73,7 @@ enabled=PackedStringArray("res://addons/console/plugin.cfg", "res://addons/phant coins="" levers="" player="" +Collectables="" [gui] diff --git a/scripts/components/ExitDoorComponent.cs b/scripts/components/ExitDoorComponent.cs index 9c70fa6..1a03fb9 100644 --- a/scripts/components/ExitDoorComponent.cs +++ b/scripts/components/ExitDoorComponent.cs @@ -35,7 +35,7 @@ public partial class ExitDoorComponent : Node, IUnlockable if (Locked) return; EmitSignalExitTriggered(); - _gameManager.UnlockLevel((int)_gameManager.PlayerState["CurrentLevel"] + 1); + _gameManager.UnlockLevel((int)_gameManager.PlayerState["current_level"] + 1); CallDeferred(nameof(GoToNextLevel)); } diff --git a/scripts/components/ScoreComponent.cs b/scripts/components/ScoreComponent.cs index f56ba49..9db2dcc 100644 --- a/scripts/components/ScoreComponent.cs +++ b/scripts/components/ScoreComponent.cs @@ -7,7 +7,7 @@ namespace Mr.BrickAdventures.scripts.components; public partial class ScoreComponent : Node { private GameManager _gameManager; - private const string CoinsGroupName = "Coins"; + private const string CoinsGroupName = "coins"; public override async void _Ready() { @@ -20,30 +20,17 @@ public partial class ScoreComponent : Node return; } - var coins = GetTree().GetNodesInGroup("coins"); - GD.Print($"Found {coins.Count} coins in the scene."); + var coins = GetTree().GetNodesInGroup(CoinsGroupName); foreach (var coin in coins) { var c = coin.GetNodeOrNull("CollectableComponent"); - GD.Print(c == null ? "CollectableComponent not found on coin." : "CollectableComponent found on coin."); if (c != null) { c.Collected += OnCollected; } } } - - public override void _Process(double delta) - { - GetCoinsInScene(); - } - - private void GetCoinsInScene() - { - var coins = GetTree().GetNodesInGroup("Coins"); - GD.Print($"Found {coins.Count} coins in the scene."); - } - + private void OnCollected(float amount, CollectableType type, Node2D body) { if (type != CollectableType.Coin) return;