diff options
| author | Jan Tuomi <jantuomi@Jans-MacBook-Pro.local> | 2022-08-08 07:46:32 +0300 |
|---|---|---|
| committer | Jan Tuomi <jantuomi@Jans-MacBook-Pro.local> | 2022-08-08 07:46:32 +0300 |
| commit | ba41bbbb09e0d1057179a0f221b8d297d37ecb79 (patch) | |
| tree | 3e2fa115dfe2f2ca8d254744fae5646f6a346ce9 /Player.tscn | |
Initial commit
Diffstat (limited to 'Player.tscn')
| -rw-r--r-- | Player.tscn | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/Player.tscn b/Player.tscn new file mode 100644 index 0000000..ec8edf8 --- /dev/null +++ b/Player.tscn @@ -0,0 +1,156 @@ +[gd_scene load_steps=15 format=2] + +[ext_resource path="res://Assets/kenney_pixelplatformer/Tilemap/characters_packed.png" type="Texture" id=1] +[ext_resource path="res://Player.gd" type="Script" id=2] + +[sub_resource type="AnimationNodeAnimation" id=14] +animation = "Fall" + +[sub_resource type="AnimationNodeAnimation" id=12] +animation = "Idle" + +[sub_resource type="AnimationNodeTimeScale" id=20] + +[sub_resource type="AnimationNodeAnimation" id=16] +animation = "Walk" + +[sub_resource type="AnimationNodeTransition" id=13] +input_count = 2 +input_0/name = "In air" +input_0/auto_advance = false +input_1/name = "On ground" +input_1/auto_advance = false + +[sub_resource type="AnimationNodeTransition" id=15] +input_count = 2 +input_0/name = "No" +input_0/auto_advance = false +input_1/name = "Yes" +input_1/auto_advance = false + +[sub_resource type="AnimationNodeBlendTree" id=5] +graph_offset = Vector2( -183.884, 19.5496 ) +nodes/Fall/node = SubResource( 14 ) +nodes/Fall/position = Vector2( 150, 30 ) +nodes/Idle/node = SubResource( 12 ) +nodes/Idle/position = Vector2( -100, 60 ) +nodes/TimeScale/node = SubResource( 20 ) +nodes/TimeScale/position = Vector2( -40, 220 ) +nodes/Walk/node = SubResource( 16 ) +nodes/Walk/position = Vector2( -200, 230 ) +nodes/is_grounded/node = SubResource( 13 ) +nodes/is_grounded/position = Vector2( 400, 90 ) +nodes/is_moving/node = SubResource( 15 ) +nodes/is_moving/position = Vector2( 140, 190 ) +nodes/output/position = Vector2( 620, 100 ) +node_connections = [ "TimeScale", 0, "Walk", "is_grounded", 0, "Fall", "is_grounded", 1, "is_moving", "output", 0, "is_grounded", "is_moving", 0, "Idle", "is_moving", 1, "TimeScale" ] + +[sub_resource type="Animation" id=10] +resource_name = "Fall" +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 1 ] +} + +[sub_resource type="Animation" id=7] +resource_name = "Idle" +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ 0 ] +} + +[sub_resource type="Animation" id=8] +length = 0.001 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ 1 ] +} + +[sub_resource type="Animation" id=11] +resource_name = "Walk" +length = 2.0 +loop = true +step = 1.0 +tracks/0/type = "value" +tracks/0/path = NodePath("Sprite:frame") +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": 1, +"values": [ 0, 1 ] +} + +[sub_resource type="RectangleShape2D" id=18] +extents = Vector2( 8, 20 ) + +[node name="Player" type="KinematicBody2D"] +scale = Vector2( 4, 4 ) +script = ExtResource( 2 ) +WALK_ANIM_MULTIPLIER = 0.002 + +[node name="AnimationTree" type="AnimationTree" parent="."] +tree_root = SubResource( 5 ) +anim_player = NodePath("../AnimationPlayer") +active = true +parameters/TimeScale/scale = 12.0 +parameters/is_grounded/current = 1 +parameters/is_moving/current = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +anims/Fall = SubResource( 10 ) +anims/Idle = SubResource( 7 ) +anims/RESET = SubResource( 8 ) +anims/Walk = SubResource( 11 ) + +[node name="Sprite" type="Sprite" parent="."] +scale = Vector2( 2, 2 ) +texture = ExtResource( 1 ) +flip_h = true +hframes = 9 +vframes = 3 +frame = 1 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0, 4 ) +scale = Vector2( 1, 1 ) +shape = SubResource( 18 ) + +[node name="FloorRaycastL" type="RayCast2D" parent="."] +position = Vector2( -8, 0 ) +enabled = true +cast_to = Vector2( 0, 27 ) + +[node name="FloorRaycastR" type="RayCast2D" parent="."] +position = Vector2( 8, 0 ) +enabled = true +cast_to = Vector2( 0, 27 ) |
