make collectibles always use full hitbox
This commit is contained in:
parent
e4cc684603
commit
ca947c2f09
9 changed files with 26 additions and 17 deletions
|
@ -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)
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue