Add animations to Tim
This commit is contained in:
parent
86dec7501f
commit
2c7128aafd
|
@ -18,6 +18,7 @@ config/icon="res://icon.svg"
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
UserSettings="*res://settings/user_settings.gd"
|
UserSettings="*res://settings/user_settings.gd"
|
||||||
|
Signals="*res://scenes/signals.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,12 @@ extends Node2D
|
||||||
@export var tim_sprite : Sprite2D
|
@export var tim_sprite : Sprite2D
|
||||||
@export var transmitter_area: Area2D
|
@export var transmitter_area: Area2D
|
||||||
|
|
||||||
|
var default_texture: Texture2D = load("res://sprites/tim_side.png")
|
||||||
|
var ducking_texture: Texture2D = load("res://sprites/tim_ducking.svg")
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
Signals.hit_tim.connect(ouch)
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
@ -25,9 +28,16 @@ func _process(delta):
|
||||||
|
|
||||||
|
|
||||||
func _on_joke_button_button_pressed(joke):
|
func _on_joke_button_button_pressed(joke):
|
||||||
|
$AnimationPlayer.play("talking")
|
||||||
|
|
||||||
for body in transmitter_area.get_overlapping_bodies():
|
for body in transmitter_area.get_overlapping_bodies():
|
||||||
var person = body.find_parent("Person")
|
var person = body.find_parent("Person")
|
||||||
if not (person is AudienceMember):
|
if not (person is AudienceMember):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
person.on_joke(joke)
|
person.on_joke(joke)
|
||||||
|
|
||||||
|
func ouch():
|
||||||
|
$Sprite2D.texture = ducking_texture
|
||||||
|
await get_tree().create_timer(1).timeout
|
||||||
|
$Sprite2D.texture = default_texture
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
signal hit_tim
|
||||||
|
|
||||||
@export var bottle_speed: float = 120;
|
@export var bottle_speed: float = 120;
|
||||||
|
|
||||||
var tim_global_position: Vector2
|
var tim_global_position: Vector2
|
||||||
|
@ -29,4 +31,5 @@ func _on_growth_timer_timeout():
|
||||||
func remove_bottle():
|
func remove_bottle():
|
||||||
if is_hidding:
|
if is_hidding:
|
||||||
print("Ouch")
|
print("Ouch")
|
||||||
|
Signals.hit_tim.emit()
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
signal hit_tim
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://cicyfp5xjvvu4"]
|
[gd_scene load_steps=14 format=3 uid="uid://cicyfp5xjvvu4"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://bg85if5rrrdmm" path="res://sprites/room/buehne.svg" id="1_32lst"]
|
[ext_resource type="Texture2D" uid="uid://bg85if5rrrdmm" path="res://sprites/room/buehne.svg" id="1_32lst"]
|
||||||
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"]
|
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"]
|
||||||
[ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
|
[ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
|
||||||
[ext_resource type="Script" path="res://scenes/Boundary.gd" id="2_8p6ir"]
|
[ext_resource type="Script" path="res://scenes/Boundary.gd" id="2_8p6ir"]
|
||||||
[ext_resource type="PackedScene" uid="uid://r1i7ln2hpwq5" path="res://scenes/joke_button.tscn" id="3_0t41i"]
|
[ext_resource type="PackedScene" uid="uid://r1i7ln2hpwq5" path="res://scenes/joke_button.tscn" id="3_0t41i"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://b8tb4o75kjffn" path="res://sprites/tim_talk.svg" id="3_e1fvx"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://d2264dy2o4q6d" path="res://sprites/tim_side.svg" id="6_qpa7m"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jfw8v"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_jfw8v"]
|
||||||
radius = 23.0217
|
radius = 23.0217
|
||||||
|
@ -12,6 +14,59 @@ radius = 23.0217
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"]
|
||||||
size = Vector2(250, 10000)
|
size = Vector2(250, 10000)
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_kkrfv"]
|
||||||
|
resource_name = "talking"
|
||||||
|
length = 4.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:texture")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 3.95),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ExtResource("1_saxit"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("1_saxit"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("6_qpa7m"), ExtResource("3_e1fvx"), ExtResource("1_saxit")]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_n0bwh"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:texture")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ExtResource("3_e1fvx")]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_5tnw3"]
|
||||||
|
resource_name = "idle"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Sprite2D:texture")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 1,
|
||||||
|
"values": [ExtResource("6_qpa7m"), ExtResource("6_qpa7m")]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xvfym"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_n0bwh"),
|
||||||
|
"idle": SubResource("Animation_5tnw3"),
|
||||||
|
"talking": SubResource("Animation_kkrfv")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Stage" type="Node2D"]
|
[node name="Stage" type="Node2D"]
|
||||||
z_index = 100
|
z_index = 100
|
||||||
|
|
||||||
|
@ -39,10 +94,11 @@ shape = SubResource("CircleShape2D_jfw8v")
|
||||||
z_index = 110
|
z_index = 110
|
||||||
position = Vector2(-12, -142)
|
position = Vector2(-12, -142)
|
||||||
scale = Vector2(0.4, 0.4)
|
scale = Vector2(0.4, 0.4)
|
||||||
texture = ExtResource("1_saxit")
|
texture = ExtResource("3_e1fvx")
|
||||||
offset = Vector2(0, 50)
|
offset = Vector2(0, 50)
|
||||||
|
|
||||||
[node name="Joke Buttons" type="Node2D" parent="Tim"]
|
[node name="Joke Buttons" type="Node2D" parent="Tim"]
|
||||||
|
visible = false
|
||||||
z_index = 120
|
z_index = 120
|
||||||
position = Vector2(0, -25)
|
position = Vector2(0, -25)
|
||||||
|
|
||||||
|
@ -64,6 +120,11 @@ action = "joke_button_3"
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/Joke Transmitter/Area2D"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/Joke Transmitter/Area2D"]
|
||||||
shape = SubResource("RectangleShape2D_wmfel")
|
shape = SubResource("RectangleShape2D_wmfel")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="Tim"]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_xvfym")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Boundary" type="Node2D" parent="."]
|
[node name="Boundary" type="Node2D" parent="."]
|
||||||
script = ExtResource("2_8p6ir")
|
script = ExtResource("2_8p6ir")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue