72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
|
[gd_scene load_steps=10 format=2]
|
||
|
|
||
|
[ext_resource path="res://assets/coin.png" type="Texture" id=1]
|
||
|
[ext_resource path="res://state_machine/StateMachine.gdns" type="Script" id=2]
|
||
|
[ext_resource path="res://collectables/coin/states/CoinNotCollected.gdns" type="Script" id=3]
|
||
|
[ext_resource path="res://collectables/coin/states/CoinCollected.gdns" type="Script" id=4]
|
||
|
|
||
|
[sub_resource type="CircleShape2D" id=1]
|
||
|
radius = 6.0
|
||
|
|
||
|
[sub_resource type="AtlasTexture" id=2]
|
||
|
atlas = ExtResource( 1 )
|
||
|
region = Rect2( 0, 0, 18, 18 )
|
||
|
|
||
|
[sub_resource type="AtlasTexture" id=3]
|
||
|
atlas = ExtResource( 1 )
|
||
|
region = Rect2( 18, 0, 18, 18 )
|
||
|
|
||
|
[sub_resource type="SpriteFrames" id=4]
|
||
|
animations = [ {
|
||
|
"frames": [ SubResource( 2 ), SubResource( 3 ) ],
|
||
|
"loop": true,
|
||
|
"name": "spin",
|
||
|
"speed": 5.0
|
||
|
} ]
|
||
|
|
||
|
[sub_resource type="Animation" id=5]
|
||
|
resource_name = "jump"
|
||
|
length = 0.4
|
||
|
tracks/0/type = "value"
|
||
|
tracks/0/path = NodePath("AnimatedSprite:position")
|
||
|
tracks/0/interp = 1
|
||
|
tracks/0/loop_wrap = true
|
||
|
tracks/0/imported = false
|
||
|
tracks/0/enabled = true
|
||
|
tracks/0/keys = {
|
||
|
"times": PoolRealArray( 0, 0.2, 0.4 ),
|
||
|
"transitions": PoolRealArray( 1, 1, 1 ),
|
||
|
"update": 0,
|
||
|
"values": [ Vector2( 0, 0 ), Vector2( 0, -20 ), Vector2( 0, 0 ) ]
|
||
|
}
|
||
|
|
||
|
[node name="Coin" type="Area2D"]
|
||
|
collision_layer = 4
|
||
|
|
||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||
|
position = Vector2( 9, 9 )
|
||
|
shape = SubResource( 1 )
|
||
|
|
||
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||
|
frames = SubResource( 4 )
|
||
|
animation = "spin"
|
||
|
frame = 1
|
||
|
playing = true
|
||
|
centered = false
|
||
|
|
||
|
[node name="StateMachine" type="Node" parent="."]
|
||
|
script = ExtResource( 2 )
|
||
|
default_state = "CoinNotCollected"
|
||
|
|
||
|
[node name="CoinNotCollected" type="Node" parent="StateMachine"]
|
||
|
script = ExtResource( 3 )
|
||
|
|
||
|
[node name="CoinCollected" type="Node" parent="StateMachine"]
|
||
|
script = ExtResource( 4 )
|
||
|
|
||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||
|
anims/jump = SubResource( 5 )
|
||
|
|
||
|
[connection signal="body_entered" from="." to="StateMachine/CoinNotCollected" method="_on_body_entered" flags=6]
|
||
|
[connection signal="animation_finished" from="AnimationPlayer" to="StateMachine/CoinCollected" method="_on_animation_finished" flags=6]
|