Add some sounds and animations
This commit is contained in:
parent
e1f915f52f
commit
42caa9e724
BIN
assets/sounds/base-slow-down.wav
Normal file
BIN
assets/sounds/base-slow-down.wav
Normal file
Binary file not shown.
24
assets/sounds/base-slow-down.wav.import
Normal file
24
assets/sounds/base-slow-down.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ctgnj1ppqutqb"
|
||||
path="res://.godot/imported/base-slow-down.wav-3a6ef1170d81f84cc5088f9f222fd549.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/base-slow-down.wav"
|
||||
dest_files=["res://.godot/imported/base-slow-down.wav-3a6ef1170d81f84cc5088f9f222fd549.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
|
||||
BIN
assets/sounds/base-slow-down.xrns
Normal file
BIN
assets/sounds/base-slow-down.xrns
Normal file
Binary file not shown.
BIN
assets/sounds/end-slow-down.ogg
Normal file
BIN
assets/sounds/end-slow-down.ogg
Normal file
Binary file not shown.
19
assets/sounds/end-slow-down.ogg.import
Normal file
19
assets/sounds/end-slow-down.ogg.import
Normal file
@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://34ymwv6kgxrr"
|
||||
path="res://.godot/imported/end-slow-down.ogg-f909228c04477182acb4402d07af9cae.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/end-slow-down.ogg"
|
||||
dest_files=["res://.godot/imported/end-slow-down.ogg-f909228c04477182acb4402d07af9cae.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
assets/sounds/loop-slow-down.ogg
Normal file
BIN
assets/sounds/loop-slow-down.ogg
Normal file
Binary file not shown.
19
assets/sounds/loop-slow-down.ogg.import
Normal file
19
assets/sounds/loop-slow-down.ogg.import
Normal file
@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://byo5ot6khpma1"
|
||||
path="res://.godot/imported/loop-slow-down.ogg-4c94de2fb5d31e370d68a5441b2d2708.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/loop-slow-down.ogg"
|
||||
dest_files=["res://.godot/imported/loop-slow-down.ogg-4c94de2fb5d31e370d68a5441b2d2708.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
assets/sounds/satisfying-pop.wav
Normal file
BIN
assets/sounds/satisfying-pop.wav
Normal file
Binary file not shown.
24
assets/sounds/satisfying-pop.wav.import
Normal file
24
assets/sounds/satisfying-pop.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dd8qenyeo60he"
|
||||
path="res://.godot/imported/satisfying-pop.wav-7cfbb3a826c46a04a9e2011e37046c81.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/satisfying-pop.wav"
|
||||
dest_files=["res://.godot/imported/satisfying-pop.wav-7cfbb3a826c46a04a9e2011e37046c81.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
|
||||
BIN
assets/sounds/satisfying-pop.xrns
Normal file
BIN
assets/sounds/satisfying-pop.xrns
Normal file
Binary file not shown.
BIN
assets/sounds/start-slow-down.ogg
Normal file
BIN
assets/sounds/start-slow-down.ogg
Normal file
Binary file not shown.
19
assets/sounds/start-slow-down.ogg.import
Normal file
19
assets/sounds/start-slow-down.ogg.import
Normal file
@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://bn0sh471n3imb"
|
||||
path="res://.godot/imported/start-slow-down.ogg-3246e67ff8f88aae0b9631b6e38b0984.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/start-slow-down.ogg"
|
||||
dest_files=["res://.godot/imported/start-slow-down.ogg-3246e67ff8f88aae0b9631b6e38b0984.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
assets/sounds/unsatisfying-oomf.wav
Normal file
BIN
assets/sounds/unsatisfying-oomf.wav
Normal file
Binary file not shown.
24
assets/sounds/unsatisfying-oomf.wav.import
Normal file
24
assets/sounds/unsatisfying-oomf.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://h1m0caxm0dkp"
|
||||
path="res://.godot/imported/unsatisfying-oomf.wav-883f7d7558ab5891c6461261eb6b23c2.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sounds/unsatisfying-oomf.wav"
|
||||
dest_files=["res://.godot/imported/unsatisfying-oomf.wav-883f7d7558ab5891c6461261eb6b23c2.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
|
||||
@ -29,6 +29,7 @@ window/stretch/mode="viewport"
|
||||
[global_group]
|
||||
|
||||
collectable=""
|
||||
audio=""
|
||||
|
||||
[rendering]
|
||||
|
||||
|
||||
@ -45,13 +45,30 @@ func create_loop_object(loop:Array):
|
||||
add_child(scene)
|
||||
await get_tree().create_timer(.2).timeout
|
||||
var contents = scene.get_contained_nodes()
|
||||
print(contents)
|
||||
process_collection(contents)
|
||||
|
||||
func process_collection(contents:Array) -> void:
|
||||
var collectables = get_tree().get_nodes_in_group("collectable")
|
||||
for i in contents:
|
||||
if not (i in collectables):
|
||||
var type : int = -1
|
||||
var count : int = 0
|
||||
var mistakes : int = 0
|
||||
|
||||
for i in range(len(contents)):
|
||||
var obj = contents[i]
|
||||
|
||||
if not (obj in collectables):
|
||||
continue
|
||||
# TODO: color matching logic
|
||||
i.remove()
|
||||
|
||||
if type == -1 or obj.type == type:
|
||||
type = obj.type
|
||||
count += 1
|
||||
else:
|
||||
obj.is_good = false
|
||||
mistakes += 1
|
||||
|
||||
obj.remove(i)
|
||||
|
||||
print("Good: " + str(count) + "; Bad: " + str(mistakes))
|
||||
|
||||
func _on_cursor_started_drawing(pos:Vector2) -> void:
|
||||
print("started drawing")
|
||||
@ -62,8 +79,11 @@ func _on_cursor_started_drawing(pos:Vector2) -> void:
|
||||
$StartMarker.visible = true
|
||||
$LineProgress.visible = true
|
||||
is_drawing = true
|
||||
$AudioSlowDownStart.play()
|
||||
await $AudioSlowDownStart.finished
|
||||
$AudioSlowDownLoop.play()
|
||||
|
||||
func _on_cursor_stopped_drawing() -> void:
|
||||
func _on_cursor_stopped_drawing(data:Array) -> void:
|
||||
print("stopped drawing")
|
||||
var cam = get_viewport().get_camera_2d()
|
||||
var t = get_tree().create_tween()
|
||||
@ -71,3 +91,11 @@ func _on_cursor_stopped_drawing() -> void:
|
||||
$StartMarker.visible = false
|
||||
$LineProgress.visible = false
|
||||
is_drawing = false
|
||||
if CURSOR.loop_stack.size() == 0:
|
||||
var err_loop = Globals.SCENE_LOOP.instantiate()
|
||||
err_loop.is_error = true
|
||||
err_loop.points = data
|
||||
add_child(err_loop)
|
||||
$AudioSlowDownStart.stop()
|
||||
$AudioSlowDownLoop.stop()
|
||||
$AudioSlowDownEnd.play()
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://d1bduqxqx10jb"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://d1bduqxqx10jb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1ddnopgn4scy" path="res://scenes/debug/MouseLoop.gd" id="1_x04i4"]
|
||||
[ext_resource type="PackedScene" uid="uid://byipv4uqxdtfk" path="res://scenes/objects/Cursor.tscn" id="3_aaj44"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7en2ehk2mvk0" path="res://assets/textures/lined-paper.png" id="3_u4ca0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnr505je252gd" path="res://scenes/objects/StartMarker.tscn" id="4_u4ca0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnkw8qq4rm0td" path="res://scenes/objects/InkWell.tscn" id="5_olkr6"]
|
||||
[ext_resource type="AudioStream" uid="uid://bn0sh471n3imb" path="res://assets/sounds/start-slow-down.ogg" id="6_32d1g"]
|
||||
[ext_resource type="AudioStream" uid="uid://34ymwv6kgxrr" path="res://assets/sounds/end-slow-down.ogg" id="7_udeto"]
|
||||
[ext_resource type="AudioStream" uid="uid://byo5ot6khpma1" path="res://assets/sounds/loop-slow-down.ogg" id="8_thiq5"]
|
||||
[ext_resource type="AudioStream" uid="uid://dd8qenyeo60he" path="res://assets/sounds/satisfying-pop.wav" id="9_udeto"]
|
||||
[ext_resource type="AudioStream" uid="uid://h1m0caxm0dkp" path="res://assets/sounds/unsatisfying-oomf.wav" id="10_thiq5"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_va2mg"]
|
||||
size = Vector2(100, 591)
|
||||
@ -67,5 +72,21 @@ z_index = -1
|
||||
|
||||
[node name="InkWell" parent="LineProgress" instance=ExtResource("5_olkr6")]
|
||||
|
||||
[node name="AudioSlowDownStart" type="AudioStreamPlayer" parent="." groups=["audio"]]
|
||||
stream = ExtResource("6_32d1g")
|
||||
|
||||
[node name="AudioSlowDownEnd" type="AudioStreamPlayer" parent="." groups=["audio"]]
|
||||
stream = ExtResource("7_udeto")
|
||||
|
||||
[node name="AudioSlowDownLoop" type="AudioStreamPlayer" parent="." groups=["audio"]]
|
||||
stream = ExtResource("8_thiq5")
|
||||
parameters/looping = true
|
||||
|
||||
[node name="PopSound" type="AudioStreamPlayer" parent="." groups=["audio"]]
|
||||
stream = ExtResource("9_udeto")
|
||||
|
||||
[node name="OomfSound" type="AudioStreamPlayer" parent="." groups=["audio"]]
|
||||
stream = ExtResource("10_thiq5")
|
||||
|
||||
[connection signal="started_drawing" from="Cursor" to="." method="_on_cursor_started_drawing"]
|
||||
[connection signal="stopped_drawing" from="Cursor" to="." method="_on_cursor_stopped_drawing"]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c0srxosarykx7"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://c0srxosarykx7"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bmke2komimx40" path="res://scenes/objects/collectable.gd" id="1_dtuyt"]
|
||||
[ext_resource type="Texture2D" uid="uid://54uy8wr13v7y" path="res://assets/sprites/monster-programmer.png" id="2_dtuyt"]
|
||||
@ -6,13 +6,123 @@
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_aaj44"]
|
||||
size = Vector2(48, 46)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dtuyt"]
|
||||
resource_name = "Walking"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.0872665, 0.0, 0.0872665, 0.0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ym61t"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1.25, 1.25)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2crgn"]
|
||||
resource_name = "BadGrab"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -0.174533, 0.174533, 0.0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.375),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1.25, 1.25)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_5hcc2"]
|
||||
resource_name = "GoodGrab"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:rotation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0.0, -6.28319]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D:scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1e-05, 1e-05)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_5hcc2"]
|
||||
_data = {
|
||||
&"BadGrab": SubResource("Animation_2crgn"),
|
||||
&"GoodGrab": SubResource("Animation_5hcc2"),
|
||||
&"RESET": SubResource("Animation_ym61t"),
|
||||
&"Walking": SubResource("Animation_dtuyt")
|
||||
}
|
||||
|
||||
[node name="Collectable" type="CharacterBody2D" groups=["collectable"]]
|
||||
z_index = -1
|
||||
script = ExtResource("1_dtuyt")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." groups=["collectable"]]
|
||||
position = Vector2(1, 0)
|
||||
shape = SubResource("RectangleShape2D_aaj44")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(1.25, 1.25)
|
||||
texture = ExtResource("2_dtuyt")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_5hcc2")
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
extends CharacterBody2D
|
||||
|
||||
@export_enum("color", "red", "blue", "green", "black") var type : int = 3
|
||||
var is_good : bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
velocity = Vector2.from_angle(randf() * PI * 2) * 25
|
||||
@ -17,5 +18,16 @@ func _process(delta: float) -> void:
|
||||
func vibrate() -> void:
|
||||
$Sprite2D.offset = Vector2((randf() - .5) * 2, (randf() - .5) * 2) * 1
|
||||
|
||||
func remove() -> void:
|
||||
func remove(delay:int) -> void:
|
||||
if is_good:
|
||||
$AnimationPlayer.play("GoodGrab")
|
||||
else:
|
||||
$AnimationPlayer.play("BadGrab")
|
||||
|
||||
await get_tree().create_timer(delay * 0.1).timeout
|
||||
|
||||
if is_good:
|
||||
get_parent().get_node("PopSound").play()
|
||||
else:
|
||||
get_parent().get_node("OomfSound").play()
|
||||
get_tree().queue_delete(self)
|
||||
|
||||
@ -40,10 +40,10 @@ func _input(event: InputEvent) -> void:
|
||||
else:
|
||||
if is_close_to_loop():
|
||||
create_valid_loop()
|
||||
init_history_stack()
|
||||
if is_drawing:
|
||||
emit_signal("stopped_drawing")
|
||||
emit_signal("stopped_drawing", positions_history)
|
||||
is_drawing = false
|
||||
init_history_stack()
|
||||
|
||||
func get_tail(max_length: int = 32) -> Array:
|
||||
var tail_length = min(positions_history.size(), max_length)
|
||||
@ -51,7 +51,7 @@ func get_tail(max_length: int = 32) -> Array:
|
||||
return output
|
||||
|
||||
func is_close_to_loop () -> bool:
|
||||
if positions_history.size() < 4:
|
||||
if positions_history.size() < 16:
|
||||
return false
|
||||
|
||||
var to = positions_history[positions_history.size() - 1]
|
||||
@ -71,6 +71,13 @@ func create_valid_loop() -> void:
|
||||
var smoothed_loop = positions_history
|
||||
var last = 0
|
||||
|
||||
# clean up a bit
|
||||
while (smoothed_loop.pop_back() as Vector2).distance_to(smoothed_loop[0]) < Globals.SNAP_DISTANCE / 2:
|
||||
smoothed_loop.pop_back()
|
||||
for i in range(1,8):
|
||||
if (smoothed_loop[1] as Vector2).distance_to(smoothed_loop[0]) < Globals.SNAP_DISTANCE / 2:
|
||||
smoothed_loop.pop_front()
|
||||
|
||||
# simplify
|
||||
for j in range(1):
|
||||
var new_loop = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user