Added sound and animations
This commit is contained in:
parent
e4f0299c0f
commit
b5655b3c79
BIN
delete.wav
(Stored with Git LFS)
Normal file
BIN
delete.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
delete.wav.import
Normal file
24
delete.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://3rauc5r5b2ox"
|
||||
path="res://.godot/imported/delete.wav-e50e6d74de8e18946331c3a0bc61be5a.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://delete.wav"
|
||||
dest_files=["res://.godot/imported/delete.wav-e50e6d74de8e18946331c3a0bc61be5a.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
42
export_presets.cfg
Normal file
42
export_presets.cfg
Normal file
@ -0,0 +1,42 @@
|
||||
[preset.0]
|
||||
|
||||
name="Linux"
|
||||
platform="Linux"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="./AgatheOS.zip"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
shader_baker/enabled=false
|
||||
binary_format/architecture="x86_32"
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
14
main.gd
14
main.gd
@ -1,6 +1,7 @@
|
||||
extends Control
|
||||
|
||||
const SCREEN_HEIGHT: int = 768
|
||||
const SCREEN_HEIGHT: int = 600
|
||||
const SCREEN_WIDTH: int = 1024
|
||||
const LINE_HEIGHT: int = 150
|
||||
const LETTER_SPACING: int = 20
|
||||
|
||||
@ -11,8 +12,11 @@ var current_y: float = 0
|
||||
|
||||
@onready var labels_node: Control = $Labels
|
||||
|
||||
var is_ready: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
offset_line(1)
|
||||
is_ready = true
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey:
|
||||
@ -21,7 +25,6 @@ func _input(event: InputEvent) -> void:
|
||||
var letter: String = OS.get_keycode_string(event.keycode)
|
||||
if letter.length() == 1:
|
||||
spawn_text(OS.get_keycode_string(event.keycode))
|
||||
# label.text = label.text + OS.get_keycode_string(event.keycode)
|
||||
else:
|
||||
match key_event.keycode:
|
||||
Key.KEY_ENTER:
|
||||
@ -36,8 +39,11 @@ func offset_line(amount: int = 1) -> void:
|
||||
current_y = current_y + LINE_HEIGHT * amount
|
||||
var target_pos := Vector2(0, SCREEN_HEIGHT - (LINE_HEIGHT + current_y))
|
||||
var tween := get_tree().create_tween()
|
||||
var tweener := tween.tween_property(labels_node, "position", target_pos, 0.4)
|
||||
var tweener := tween.tween_property(labels_node, "position", target_pos, 0.3)
|
||||
tweener.from_current().set_trans(Tween.TRANS_CUBIC)
|
||||
if is_ready:
|
||||
$AudioStreamPlayer.stop()
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
func spawn_text(text: String) -> void:
|
||||
var instance : TypedLetter = label.instantiate()
|
||||
@ -46,6 +52,8 @@ func spawn_text(text: String) -> void:
|
||||
instance.position = Vector2(current_x, current_y)
|
||||
instance.add_label(text)
|
||||
current_x = current_x + instance.get_width() + LETTER_SPACING
|
||||
if current_x > SCREEN_WIDTH:
|
||||
offset_line()
|
||||
|
||||
func delete_last_text() -> void:
|
||||
if not labels.is_empty():
|
||||
|
||||
35
main.tscn
35
main.tscn
@ -1,11 +1,7 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dtgl0v3ev3l1o"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dtgl0v3ev3l1o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://drsg3aygmqy4e" path="res://main.gd" id="1_0xm2m"]
|
||||
[ext_resource type="FontFile" uid="uid://4xh07bbhtmaf" path="res://OpenSans-Bold.ttf" id="1_ig7tw"]
|
||||
|
||||
[sub_resource type="FontVariation" id="FontVariation_0xm2m"]
|
||||
base_font = ExtResource("1_ig7tw")
|
||||
spacing_glyph = 2
|
||||
[ext_resource type="AudioStream" uid="uid://dox2ltjurhp6q" path="res://new_line.wav" id="2_0xm2m"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
@ -16,30 +12,11 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_0xm2m")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 20
|
||||
theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 20
|
||||
theme_override_constants/margin_bottom = 0
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/normal_font = SubResource("FontVariation_0xm2m")
|
||||
theme_override_font_sizes/normal_font_size = 120
|
||||
theme_override_font_sizes/bold_font_size = 16
|
||||
theme_override_font_sizes/bold_italics_font_size = 16
|
||||
theme_override_font_sizes/italics_font_size = 16
|
||||
theme_override_font_sizes/mono_font_size = 16
|
||||
autowrap_mode = 1
|
||||
text_direction = 1
|
||||
|
||||
[node name="Labels" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_0xm2m")
|
||||
volume_db = -23.72
|
||||
|
||||
BIN
new_line.wav
(Stored with Git LFS)
Normal file
BIN
new_line.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
24
new_line.wav.import
Normal file
24
new_line.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dox2ltjurhp6q"
|
||||
path="res://.godot/imported/new_line.wav-dbe0aa9ef88d20f900089dd0f8df1eb9.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://new_line.wav"
|
||||
dest_files=["res://.godot/imported/new_line.wav-dbe0aa9ef88d20f900089dd0f8df1eb9.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
24
plop.wav.import
Normal file
24
plop.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://2odedxbolgoj"
|
||||
path="res://.godot/imported/plop.wav-2f0fd709d6f75c10aa7f3c6071ab150d.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://plop.wav"
|
||||
dest_files=["res://.godot/imported/plop.wav-2f0fd709d6f75c10aa7f3c6071ab150d.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
@ -18,9 +18,9 @@ config/icon="res://icon.svg"
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1024
|
||||
window/size/viewport_height=768
|
||||
window/size/viewport_height=600
|
||||
window/size/mode=4
|
||||
window/size/resizable=false
|
||||
window/size/borderless=true
|
||||
|
||||
[rendering]
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
class_name TypedLetter
|
||||
extends Control
|
||||
|
||||
# https://freesound.org/people/edschaefer/sounds/343097/
|
||||
|
||||
@onready var label: Label = $Label
|
||||
|
||||
var letter_size := Vector2.ZERO
|
||||
@ -18,8 +16,12 @@ func add_label(text: String) -> void:
|
||||
letter_size = label.get_theme_font("font").get_string_size(label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, label.get_theme_font_size("font_size"))
|
||||
label.pivot_offset = letter_size / 2
|
||||
$AnimationPlayer.play("spawn")
|
||||
$AudioStreamPlayer.pitch_scale = randf_range(0.7, 1.7)
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
func delete_label() -> void:
|
||||
$AudioStreamPlayer2.play()
|
||||
$AnimationPlayer.play("delete")
|
||||
|
||||
# todo => delete letter animation
|
||||
func on_delete() -> void:
|
||||
queue_free()
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://badfkx2cegbbh"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://badfkx2cegbbh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bk02reogr7lmi" path="res://typed_letter.gd" id="1_382cc"]
|
||||
[ext_resource type="FontFile" uid="uid://4xh07bbhtmaf" path="res://OpenSans-Bold.ttf" id="2_s3pwu"]
|
||||
[ext_resource type="AudioStream" uid="uid://2odedxbolgoj" path="res://plop.wav" id="3_hy1vi"]
|
||||
[ext_resource type="AudioStream" uid="uid://3rauc5r5b2ox" path="res://delete.wav" id="4_4wxnc"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_i3osk"]
|
||||
length = 0.001
|
||||
@ -29,10 +31,34 @@ tracks/1/keys = {
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Label:position")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Label:rotation")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_06tve"]
|
||||
resource_name = "spawn"
|
||||
length = 0.2
|
||||
length = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
@ -40,8 +66,8 @@ tracks/0/path = NodePath("Label:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.13333334, 0.2),
|
||||
"transitions": PackedFloat32Array(5.4641523, 0.28717464, 1),
|
||||
"times": PackedFloat32Array(0, 0.06666667, 0.1),
|
||||
"transitions": PackedFloat32Array(2.3784113, 0.28717464, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0.4, 0.4), Vector2(1.2, 1.2), Vector2(1, 1)]
|
||||
}
|
||||
@ -52,15 +78,82 @@ tracks/1/path = NodePath("Label:theme_override_colors/font_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.13333334),
|
||||
"transitions": PackedFloat32Array(5.4641523, 1),
|
||||
"times": PackedFloat32Array(0, 0.06666667),
|
||||
"transitions": PackedFloat32Array(2.3784113, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_4wxnc"]
|
||||
resource_name = "delete"
|
||||
length = 1.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Label:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Label:theme_override_colors/font_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.18, 1.1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Label:position")
|
||||
tracks/2/interp = 2
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.14, 0.6, 1.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(33, -19.999998), Vector2(89, 171), Vector2(132.99998, 648)]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Label:rotation")
|
||||
tracks/3/interp = 2
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.14, 0.6, 1.5),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, 0.21454777, 0.55489826, 0.69997525]
|
||||
}
|
||||
tracks/4/type = "method"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath(".")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(1.5),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"on_delete"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_02dvo"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_i3osk"),
|
||||
&"delete": SubResource("Animation_4wxnc"),
|
||||
&"spawn": SubResource("Animation_06tve")
|
||||
}
|
||||
|
||||
@ -73,8 +166,8 @@ script = ExtResource("1_382cc")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
offset_right = 58.00009
|
||||
offset_bottom = 137.00006
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_fonts/font = ExtResource("2_s3pwu")
|
||||
theme_override_font_sizes/font_size = 100
|
||||
@ -84,3 +177,9 @@ text = "T"
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_02dvo")
|
||||
}
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_hy1vi")
|
||||
|
||||
[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_4wxnc")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user