From a5f3e610a7e1bb558d5885e160abc29839f8fa61 Mon Sep 17 00:00:00 2001 From: SyntaX Date: Thu, 21 Nov 2019 13:50:49 +0100 Subject: [PATCH] animation for taking pills --- Characters/Player/PillTaker.gd | 5 +- Characters/Player/Player.tscn | 92 ++++++++++++++++----------------- Models/pill/blue.material | Bin 0 -> 1554 bytes Models/pill/other.material | Bin 0 -> 1580 bytes project.godot | 2 +- 5 files changed, 47 insertions(+), 52 deletions(-) create mode 100644 Models/pill/blue.material create mode 100644 Models/pill/other.material diff --git a/Characters/Player/PillTaker.gd b/Characters/Player/PillTaker.gd index e33efe9..63ef50a 100644 --- a/Characters/Player/PillTaker.gd +++ b/Characters/Player/PillTaker.gd @@ -10,11 +10,8 @@ func _process(delta): Pills.take_pill() Logger.info("Player took a pill; new level: %s" % [Pills.get_round_level()]) _animation.play("PillTaking") - - #_animation.playback_speed = _vel.length() / MOVE_SPEED - #Logger.warn("speed: " + String(_animation.playback_speed)) func _ready(): - _animation = get_parent().get_node("AnimationPlayer") as AnimationPlayer + _animation = get_parent().get_node("PillAnimationPlayer") as AnimationPlayer assert(null != _animation) \ No newline at end of file diff --git a/Characters/Player/Player.tscn b/Characters/Player/Player.tscn index 760dba1..9d44e89 100644 --- a/Characters/Player/Player.tscn +++ b/Characters/Player/Player.tscn @@ -23,7 +23,40 @@ shader_param/masked_view = SubResource( 1 ) [sub_resource type="CylinderShape" id=4] -[sub_resource type="Animation" id=5] +[sub_resource type="Animation" id=6] +length = 0.8 +loop = true +tracks/0/type = "value" +tracks/0/path = NodePath("Body/PillCameras:translation") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.2, 0.4, 0.6 ), +"transitions": PoolRealArray( 1, 1, 1, 1 ), +"update": 0, +"values": [ Vector3( 0, 1.8, 0 ), Vector3( -0.1, 1.9, 0 ), Vector3( 0, 1.8, 0 ), Vector3( 0.1, 1.9, 0 ) ] +} +tracks/1/type = "method" +tracks/1/path = NodePath("Footsteps") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0.3, 0.7 ), +"transitions": PoolRealArray( 1, 1 ), +"values": [ { +"args": [ ], +"method": "play_footstep" +}, { +"args": [ ], +"method": "play_footstep" +} ] +} + +[sub_resource type="Animation" id=9] resource_name = "PillTaking" tracks/0/type = "value" tracks/0/path = NodePath("PillTaker/Pill:visible") @@ -59,40 +92,7 @@ tracks/2/keys = { "times": PoolRealArray( 0, 1 ), "transitions": PoolRealArray( 1, 1 ), "update": 0, -"values": [ Vector3( 0, 0, -1 ), Vector3( 0, 1, 0 ) ] -} - -[sub_resource type="Animation" id=6] -length = 0.8 -loop = true -tracks/0/type = "value" -tracks/0/path = NodePath("Body/PillCameras:translation") -tracks/0/interp = 2 -tracks/0/loop_wrap = true -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/keys = { -"times": PoolRealArray( 0, 0.2, 0.4, 0.6 ), -"transitions": PoolRealArray( 1, 1, 1, 1 ), -"update": 0, -"values": [ Vector3( 0, 1.8, 0 ), Vector3( -0.1, 1.9, 0 ), Vector3( 0, 1.8, 0 ), Vector3( 0.1, 1.9, 0 ) ] -} -tracks/1/type = "method" -tracks/1/path = NodePath("Footsteps") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/keys = { -"times": PoolRealArray( 0.3, 0.7 ), -"transitions": PoolRealArray( 1, 1 ), -"values": [ { -"args": [ ], -"method": "play_footstep" -}, { -"args": [ ], -"method": "play_footstep" -} ] +"values": [ Vector3( 0, 0, -1 ), Vector3( 0, 0.7, 0 ) ] } [sub_resource type="AudioStreamRandomPitch" id=7] @@ -104,12 +104,12 @@ random_pitch = 1.3 [node name="Player" type="KinematicBody" groups=[ "Player", ]] -collision_layer = 7 -collision_mask = 7 +collision_layer = 5 +collision_mask = 5 script = ExtResource( 1 ) body_nodepath = NodePath("Body") lookingAt_nodepath = NodePath("Body/PillCameras/LookingAt") -animation_nodepath = NodePath("AnimationPlayer") +animation_nodepath = NodePath("WalkAnimationPlayer") ui_interact_nodepath = NodePath("HUD/PressInteract") camera_nodepath = NodePath("Body/PillCameras") @@ -130,26 +130,20 @@ current = true [node name="TrueView" type="Viewport" parent="Body/PillCameras"] size = Vector2( 1024, 600 ) render_target_update_mode = 3 -shadow_atlas_size = 4 [node name="TrueCamera" type="Camera" parent="Body/PillCameras/TrueView"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.45058e-009, 1.8, 0 ) cull_mask = 2 current = true -fov = 80.0 -far = 2000.0 [node name="MaskedView" type="Viewport" parent="Body/PillCameras"] size = Vector2( 1024, 600 ) render_target_update_mode = 3 -shadow_atlas_size = 4 [node name="MaskedCamera" type="Camera" parent="Body/PillCameras/MaskedView"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.45058e-009, 1.8, 0 ) cull_mask = 1 current = true -fov = 80.0 -far = 2000.0 [node name="ScreenTexture" type="ColorRect" parent="Body/PillCameras"] material = SubResource( 3 ) @@ -167,11 +161,14 @@ remote_path = NodePath("../MaskedView/MaskedCamera") transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 ) shape = SubResource( 4 ) -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +[node name="WalkAnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "Walk" -anims/PillTaking = SubResource( 5 ) anims/Walk = SubResource( 6 ) +[node name="PillAnimationPlayer" type="AnimationPlayer" parent="."] +playback_speed = 2.0 +anims/PillTaking = SubResource( 9 ) + [node name="Footsteps" type="Spatial" parent="."] script = ExtResource( 4 ) @@ -184,10 +181,11 @@ pitch_scale = 1.5 [node name="HUD" parent="." instance=ExtResource( 6 )] [node name="PillTaker" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 ) script = ExtResource( 7 ) [node name="Pill" type="Spatial" parent="PillTaker"] -transform = Transform( 1, 0, 0, 0, -4.37114e-008, -1, 0, 1, -4.37114e-008, 0, 1, 0 ) +transform = Transform( 1, 0, 0, 0, -4.37114e-008, -1, 0, 1, -4.37114e-008, 0, 0.7, 0 ) visible = false [node name="MeshInstance" type="MeshInstance" parent="PillTaker/Pill"] diff --git a/Models/pill/blue.material b/Models/pill/blue.material new file mode 100644 index 0000000000000000000000000000000000000000..e866e0ccc9a19f5b8371d37399db5c0c4088746d GIT binary patch literal 1554 zcmbtV$&TAF3{^K2-S>S#zo0>LY!5y3JeQdd5NL~zh02mZ$&*Y^{lWfIN!d}h-fBQl z_((lb+;V<#{zJ{*4c@QulKnBSiwN0*JA;hGJ0t)1edFV=c@d^CQj6M!7M#vOrxrb` zhxA>RIPQ)`TtEOV+aIVV%^Dz}N(hLk&Y?`JK}n_6X3Ykx;jR zm?JY84d9Y`$2ZKcZi5S?jG6o#aY?K(L%1cT+kjHih0=zu1L zWMfvao8C;QL}fS zkBV{`lyh?NF{s-fyhm56ox-^4JuD zUdm;J9YLFqoi`k4>neo|h4J#soLcclq|kKD3%ycRLcXZy6rPS~5=lpN*7jFc~U;qFB literal 0 HcmV?d00001 diff --git a/Models/pill/other.material b/Models/pill/other.material new file mode 100644 index 0000000000000000000000000000000000000000..eae6ebf335fd79bba573056ace09a35b6b9ae3ae GIT binary patch literal 1580 zcmbtVxsnqx5EXZE-!}yC0l3%@3LFq`vikw5_Nd3BLL*JJG;1#r->?BGd=bAvLc$-= ztr^P~8B?W_`*rK7)t8Tsk3OmKyTJQ7Ub5feb=*O+;0_@n@y^Kqeee1B6JCTd^i-jC zp#rB<(6K^~>ei;tLyOr9LT`|CM>dd6r|KG8d0ZylL5%7iOSOY})QP~y4%j@Y+Xd}? zY`~yVj|y~xlyIq?oj1w)xq47EK4^noYIMSw)Wd@J5p@@=PdeH!xIwiDi5cS|se(09k#=$d*3`Z2&sEw^_In@S( z`M`+B4y)b)4GPJ|s9-m}8BmGJh_bC4z{hKFh`AwH?6ElOQ7^1XP0sYlvXhI|jn=tY z02*(VsO@P!BX(SE;85LI>*o{}>gig};c;C9Y-(c+q;9fu%wCRQuCR4F6GvTLWt$cg zIA^Qu?Ml$AAm#cfD3?J#Cl~L6x@y3Cbh+9o^z+8!SnWlUI?4pkm|zbr3=(~8`588N zjb7@aD3HX1Y+Gc>W#tg43XlqVpHc8OhD4z|E%0@LLlLEuhpetHl)jJsjLWl@ z_$MAI#abFIckiy3av5PwP^Dex4F}q~LLoz;KY2T*R=g1@)OEy^=Zc8yJ{51a5a~7Q za*PM6gDt9qZK{Jkstsg=N@h++VQE_)T)O5tG&-#0W!%gOJWqkF$c=S{;aKrFN&I6N z#;