diff --git a/objects/collectibles/arrow.gd b/objects/collectibles/arrow.gd index 9cd0b02..b89a206 100644 --- a/objects/collectibles/arrow.gd +++ b/objects/collectibles/arrow.gd @@ -2,9 +2,10 @@ extends Node2D export var value = 1 -func _on_Area2D_area_entered(area): + +func _on_Area2D_body_entered(body: Node) -> void: #Collect - if area.is_in_group("player_hitbox"): + if body.is_in_group("player"): Game.arrows += value Game.score += 25 Audio.play_sound(Audio.a_arrow,Audio.ac_collectible) diff --git a/objects/collectibles/arrow.tscn b/objects/collectibles/arrow.tscn index 8c3c348..d34f054 100644 --- a/objects/collectibles/arrow.tscn +++ b/objects/collectibles/arrow.tscn @@ -23,9 +23,11 @@ texture = ExtResource( 3 ) [node name="Area2D" type="Area2D" parent="."] visible = false +collision_layer = 0 +collision_mask = 128 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( 4, 4 ) shape = SubResource( 6 ) -[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"] +[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] diff --git a/objects/collectibles/key.gd b/objects/collectibles/key.gd index f33eaca..08fccfb 100644 --- a/objects/collectibles/key.gd +++ b/objects/collectibles/key.gd @@ -6,9 +6,10 @@ func _ready(): #Sync all coinframes $AnimatedSprite.play() -func _on_Area2D_area_entered(area): + +func _on_Area2D_body_entered(body: Node) -> void: #Collect - if area.is_in_group("player_hitbox"): + if body.is_in_group("player"): Game.keys += value Game.score += 5 Audio.play_sound(Audio.a_gold,Audio.ac_collectible) diff --git a/objects/collectibles/key.tscn b/objects/collectibles/key.tscn index e5faa31..85b75cc 100644 --- a/objects/collectibles/key.tscn +++ b/objects/collectibles/key.tscn @@ -70,15 +70,16 @@ material = SubResource( 7 ) position = Vector2( 0, -1 ) frames = SubResource( 5 ) animation = "key" -frame = 4 -playing = true centered = false [node name="Area2D" type="Area2D" parent="."] visible = false +collision_layer = 0 +collision_mask = 128 +monitorable = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( 4, 4 ) shape = SubResource( 6 ) -[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"] +[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] diff --git a/objects/collectibles/shard.gd b/objects/collectibles/shard.gd index 617fa09..5572e9a 100644 --- a/objects/collectibles/shard.gd +++ b/objects/collectibles/shard.gd @@ -6,9 +6,9 @@ export var number = 0 #Used for saving which specific shards collected func _ready(): $AnimationPlayer.play("glow") -func _on_Area2D_area_entered(area): +func _on_Area2D_body_entered(body): #Collect - if area.is_in_group("player_hitbox"): + if body.is_in_group("player_hitbox"): Audio.play_shard_sound() Game.score += 500 Game.shards += value diff --git a/objects/collectibles/shard.tscn b/objects/collectibles/shard.tscn index da31263..1644dcf 100644 --- a/objects/collectibles/shard.tscn +++ b/objects/collectibles/shard.tscn @@ -39,6 +39,8 @@ position = Vector2( 5, 3 ) texture = ExtResource( 2 ) [node name="Area2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 128 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] position = Vector2( 4.5, 2.5 ) @@ -47,4 +49,4 @@ shape = SubResource( 6 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/glow = SubResource( 8 ) -[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"] +[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] diff --git a/objects/collectibles/star.gd b/objects/collectibles/star.gd index 8744898..c276a85 100644 --- a/objects/collectibles/star.gd +++ b/objects/collectibles/star.gd @@ -26,9 +26,9 @@ func _set_color(value): if is_inside_tree(): sprite.material.set_shader_param("palette", COLORS[color]) -func _on_Area2D_area_entered(area): +func _on_Area2D_body_entered(body): #Collect - if area.is_in_group("player_hitbox"): + if body.is_in_group("player_hitbox"): Audio.play_sound(Audio.a_star,Audio.ac_collectible) Game.score += 100 Game.stars[color] = true diff --git a/objects/collectibles/star.tscn b/objects/collectibles/star.tscn index d7bbba7..b252050 100644 --- a/objects/collectibles/star.tscn +++ b/objects/collectibles/star.tscn @@ -54,15 +54,17 @@ script = ExtResource( 3 ) material = SubResource( 10 ) position = Vector2( -1, -3 ) frames = SubResource( 8 ) -frame = 2 +frame = 3 playing = true centered = false [node name="Area2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 128 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] visible = false position = Vector2( 4, 4 ) shape = SubResource( 9 ) -[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"] +[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] diff --git a/objects/player/player_scholar.tscn b/objects/player/player_scholar.tscn index f1d0996..64740b0 100644 --- a/objects/player/player_scholar.tscn +++ b/objects/player/player_scholar.tscn @@ -758,7 +758,7 @@ tracks/3/keys = { [sub_resource type="StyleBoxEmpty" id=4] [node name="Player" type="KinematicBody2D" groups=["player"]] -collision_layer = 0 +collision_layer = 128 collision_mask = 7 moving_platform_apply_velocity_on_leave = 1 script = ExtResource( 1 ) @@ -1168,8 +1168,8 @@ script = ExtResource( 8 ) [connection signal="state_physics_processing" from="StateChart/Root/Movement/Grounded/Pushing" to="." method="_process_pushing"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne" to="." method="_on_Airborne_state_entered"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne" to="." method="_process_gravity"] -[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"] [connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_horizontal_movement"] +[connection signal="state_physics_processing" from="StateChart/Root/Movement/Airborne/Jump" to="." method="_process_jump"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_entered"] [connection signal="state_exited" from="StateChart/Root/Movement/Airborne/Jump/NormalJump" to="." method="_on_NormalJump_state_exited"] [connection signal="state_entered" from="StateChart/Root/Movement/Airborne/Jump/LadderJump" to="." method="_on_LadderJump_state_entered"]