1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-25 17:44:22 +00:00

modified loop animation on pickup

This commit is contained in:
Maxim Lobovsky 2020-10-04 21:32:18 +02:00
parent 008a31a3b2
commit ff85418c53
2 changed files with 40 additions and 3 deletions

View file

@ -14,4 +14,10 @@ func _ready():
func _on_Loop_body_entered(body): func _on_Loop_body_entered(body):
emit_signal("picked_up") emit_signal("picked_up")
$AnimationPlayer.play("pop fade out")
func _on_AnimationPlayer_animation_finished(anim_name):
queue_free() queue_free()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://Sprites/lööp.png" type="Texture" id=1] [ext_resource path="res://Sprites/lööp.png" type="Texture" id=1]
[ext_resource path="res://Objects/ScrollingObjects/Loop.gd" type="Script" id=2] [ext_resource path="res://Objects/ScrollingObjects/Loop.gd" type="Script" id=2]
@ -6,8 +6,35 @@
[ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=4] [ext_resource path="res://Objects/ScrollingObjects/Utilities/WrapParent.tscn" type="PackedScene" id=4]
[sub_resource type="CapsuleShape2D" id=1] [sub_resource type="CapsuleShape2D" id=1]
radius = 5.52907 radius = 12.413
height = 4.30358 height = 3.55013
[sub_resource type="Animation" id=2]
resource_name = "pop fade out"
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ), Vector2( 2, 2 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Sprite:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[node name="Loop" type="Area2D"] [node name="Loop" type="Area2D"]
collision_layer = 32 collision_layer = 32
@ -24,4 +51,8 @@ shape = SubResource( 1 )
[node name="WrapParent" parent="." instance=ExtResource( 4 )] [node name="WrapParent" parent="." instance=ExtResource( 4 )]
position = Vector2( 8.5, 0 ) position = Vector2( 8.5, 0 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
"anims/pop fade out" = SubResource( 2 )
[connection signal="body_entered" from="." to="." method="_on_Loop_body_entered"] [connection signal="body_entered" from="." to="." method="_on_Loop_body_entered"]
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]