Fixed debugger errors in many files and optimized some scenes/code
This commit is contained in:
@@ -3,8 +3,8 @@ extends Area2D
|
||||
signal coin_grabbed
|
||||
|
||||
|
||||
func _on_Node2D_body_entered(body: Node) -> void:
|
||||
if body.get_name() == 'Player':
|
||||
emit_signal("coin_grabbed")
|
||||
print("coin!")
|
||||
queue_free()
|
||||
func _on_coin_body_entered(body: Node) -> void:
|
||||
if body.is_in_group('player'):
|
||||
emit_signal('coin_grabbed')
|
||||
call_deferred('queue_free')
|
||||
return
|
||||
|
@@ -6,7 +6,7 @@
|
||||
[sub_resource type="CircleShape2D" id=1]
|
||||
radius = 6.38067
|
||||
|
||||
[node name="coin" type="Area2D"]
|
||||
[node name="Coin" type="Area2D"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
@@ -16,4 +16,4 @@ texture = ExtResource( 2 )
|
||||
[node name="coin" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Node2D_body_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_coin_body_entered"]
|
||||
|
@@ -1,24 +1,11 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a: int = 2
|
||||
# var b: String = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta: float) -> void:
|
||||
# pass
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name: String) -> void:
|
||||
func _on_AnimationPlayer_animation_finished(_anim_name: String) -> void:
|
||||
$GemSprite.visible = false
|
||||
return
|
||||
|
||||
|
||||
func _on_AnimationPlayer_animation_started(anim_name: String) -> void:
|
||||
func _on_AnimationPlayer_animation_started(_anim_name: String) -> void:
|
||||
$GemSprite.visible = true
|
||||
return
|
||||
|
Reference in New Issue
Block a user