animation for taking pills

This commit is contained in:
SyntaX 2019-11-21 13:50:49 +01:00
parent fb5b6da3d3
commit a5f3e610a7
5 changed files with 47 additions and 52 deletions

View File

@ -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)

View File

@ -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"]

BIN
Models/pill/blue.material Normal file

Binary file not shown.

BIN
Models/pill/other.material Normal file

Binary file not shown.

View File

@ -63,7 +63,7 @@ _global_script_class_icons={
[application]
config/name="retrace"
run/main_scene="res://Level/World.tscn"
run/main_scene="res://Level/PathTestWorld.tscn"
config/icon="res://icon.png"
[autoload]