Merge remote-tracking branch 'origin/dev-sounds' into devRefactor

This commit is contained in:
Streamfire
2020-04-19 11:42:54 +02:00
20 changed files with 222 additions and 22 deletions

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/menu_focus_change.ogg-b255a32b3968213712292d0ecbc5df1e.oggstr"
[deps]
source_file="res://Menus/Sounds/menu_focus_change.ogg"
dest_files=[ "res://.import/menu_focus_change.ogg-b255a32b3968213712292d0ecbc5df1e.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/menu_option_select.ogg-f8ab7921ff48f27e306fb00e7fdd9726.oggstr"
[deps]
source_file="res://Menus/Sounds/menu_option_select.ogg"
dest_files=[ "res://.import/menu_option_select.ogg-f8ab7921ff48f27e306fb00e7fdd9726.oggstr" ]
[params]
loop=false
loop_offset=0

View File

@@ -8,5 +8,6 @@ func _ready():
animation_player.play("__INIT__")
func _on_Startup_startup_finished():
new_game_button.ignore_once = true # Pauls russian solution for ignoring the first sound click in the titlescreen
new_game_button.grab_focus()
animation_player.play("show_buttons")

View File

@@ -160,20 +160,23 @@ anchor_left = -0.00168862
anchor_top = -0.003002
anchor_right = 0.998311
anchor_bottom = 0.996998
margin_left = 0.875977
margin_right = 0.875977
margin_left = 0.810538
margin_top = -0.18946
margin_right = -141.189
margin_bottom = -89.1895
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Startup" parent="." instance=ExtResource( 2 )]
scale = Vector2( 1.50376, 1.50079 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.623951
anchor_top = 0.056
anchor_right = 0.970827
anchor_bottom = 0.469669
anchor_left = 0.619068
anchor_top = 1.05219
anchor_right = 0.965944
anchor_bottom = 1.46586
margin_left = 1.52588e-05
__meta__ = {
"_edit_group_": true,
@@ -181,7 +184,7 @@ __meta__ = {
}
[node name="NewGameButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_right = 166.0
margin_right = 117.0
scene_to_load = "res://World.tscn"
[node name="Label" parent="VBoxContainer/NewGameButton" index="0"]
@@ -189,7 +192,7 @@ text = "New Game"
[node name="CreditsButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 24.0
margin_right = 166.0
margin_right = 117.0
margin_bottom = 44.0
scene_to_load = "res://Menus/Credits/Credits.tscn"
@@ -198,7 +201,7 @@ text = "Credits"
[node name="QuitButton" parent="VBoxContainer" instance=ExtResource( 1 )]
margin_top = 48.0
margin_right = 166.0
margin_right = 117.0
margin_bottom = 68.0
quit = true

View File

@@ -3,10 +3,27 @@ class_name TitleSceenButton
export(String, FILE, "*.tscn,*.scn") var scene_to_load = ""
export(bool) var quit = false
onready var sound_focus = $Sounds/FocusChange
onready var sound_select = $Sounds/OptionSelect
var ignore_once = false
func _pressed():
sound_select.play()
func _on_OptionSelect_finished():
if quit:
get_tree().quit()
return
get_tree().change_scene(scene_to_load)
func _on_TitleScreenButton_mouse_entered():
grab_focus()
func _on_TitleScreenButton_focus_entered():
if not ignore_once:
sound_focus.play()
ignore_once = false

View File

@@ -1,7 +1,9 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Fonts/Harmonic/Harmonic24.tres" type="DynamicFont" id=1]
[ext_resource path="res://Menus/TitleScreen/TitleScreenButton.gd" type="Script" id=2]
[ext_resource path="res://Menus/Sounds/menu_focus_change.ogg" type="AudioStream" id=3]
[ext_resource path="res://Menus/Sounds/menu_option_select.ogg" type="AudioStream" id=4]
[node name="TitleScreenButton" type="Button"]
margin_right = 110.0
@@ -19,3 +21,14 @@ __meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}
[node name="Sounds" type="Node" parent="."]
[node name="FocusChange" type="AudioStreamPlayer" parent="Sounds"]
stream = ExtResource( 3 )
[node name="OptionSelect" type="AudioStreamPlayer" parent="Sounds"]
stream = ExtResource( 4 )
[connection signal="focus_entered" from="." to="." method="_on_TitleScreenButton_focus_entered"]
[connection signal="mouse_entered" from="." to="." method="_on_TitleScreenButton_mouse_entered"]
[connection signal="finished" from="Sounds/OptionSelect" to="." method="_on_OptionSelect_finished"]

View File

@@ -5,17 +5,25 @@ This is an example player controller script created by Paul
"""
var velocity := Vector2.ZERO
var rollvector := Vector2.ZERO
# This is how you export variables with ranges to the editor window
export(bool) var debug := false
export(int, 0, 500) var ROLL_SPEED := 150
export(int, 0, 500) var FRICTION := 200 # Speed at which the player deaccelarates
export(int, 0, 500) var ACCELERATION := 450
# Reference for the current player
# Reference for the current player
onready var player_stats := $Stats
onready var debug_label := $DebugLabel
onready var animation_state := $AnimationStates
# Variables for sound selection
onready var walk_sounds = $Sounds/Walk
onready var walk_sound_timer = $Sounds/WalkSoundTimer
var _rng = RandomNumberGenerator.new()
var is_playing_sound = false
enum moveState{
MOVE,
ROLL,
@@ -82,6 +90,7 @@ func movement_move(delta):
animation_state.change_state("run")
velocity = velocity.move_toward(player_stats.speed * input_vector, ACCELERATION * delta)
_play_random_sound(walk_sounds)
if Input.is_action_just_pressed("roll"):
movementState = moveState.ROLL
elif Input.is_action_just_pressed("attack"):
@@ -129,3 +138,28 @@ func _on_Hitbox_area_entered(area):
currency += area.currency_value
player_stats.health = player_stats.health+area.health_value
player_stats.speed -= area.slowdown_value
func _walk_sound_finished():
is_playing_sound = false
func _walk_sound_wait_time():
var x = abs(velocity.length() / 100) - 1
return log(((x+1)/4)+2.5) / 3
# TODO: Rework anyone
func _play_random_sound(path = walk_sounds):
if walk_sound_timer.is_stopped() and not is_playing_sound:
var sound = path.get_children()[_rng.randi_range(0, path.get_child_count() - 1)]
sound.play()
is_playing_sound = true
walk_sound_timer.start(_walk_sound_wait_time())
print(_walk_sound_wait_time())
# Overrides ready method for this entire script, checks for the finished method of each possible sound
func _ready():
for child in walk_sounds.get_children():
child.connect("finished", self, "_walk_sound_finished")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=61 format=2]
[gd_scene load_steps=66 format=2]
[ext_resource path="res://Player/Player.gd" type="Script" id=1]
[ext_resource path="res://Player/Player.png" type="Texture" id=2]
@@ -6,11 +6,16 @@
[ext_resource path="res://Overlap/HurtHit_Box/Hitbox.tscn" type="PackedScene" id=4]
[ext_resource path="res://Overlap/Stats/Stats.tscn" type="PackedScene" id=5]
[ext_resource path="res://Fonts/Harmonic/Harmonic.ttf" type="DynamicFontData" id=6]
[ext_resource path="res://Player/States/Idle.gd" type="Script" id=7]
[ext_resource path="res://Player/States/Attack.gd" type="Script" id=8]
[ext_resource path="res://Player/States/Roll.gd" type="Script" id=9]
[ext_resource path="res://Player/States/Run.gd" type="Script" id=10]
[ext_resource path="res://Player/PlayerStateMachine.gd" type="Script" id=11]
[ext_resource path="res://Player/Sounds/hero_walk_3.ogg" type="AudioStream" id=7]
[ext_resource path="res://Player/Sounds/hero_walk_5.ogg" type="AudioStream" id=8]
[ext_resource path="res://Player/Sounds/hero_walk_4.ogg" type="AudioStream" id=9]
[ext_resource path="res://Player/Sounds/hero_walk_2.ogg" type="AudioStream" id=10]
[ext_resource path="res://Player/Sounds/hero_walk_1.ogg" type="AudioStream" id=11]
[ext_resource path="res://Player/States/Idle.gd" type="Script" id=12]
[ext_resource path="res://Player/States/Run.gd" type="Script" id=13]
[ext_resource path="res://Player/States/Attack.gd" type="Script" id=14]
[ext_resource path="res://Player/PlayerStateMachine.gd" type="Script" id=15]
[ext_resource path="res://Player/States/Roll.gd" type="Script" id=16]
[sub_resource type="CapsuleShape2D" id=1]
radius = 2.15976
@@ -715,20 +720,42 @@ __meta__ = {
max_health = 5
[node name="AnimationStates" type="Node" parent="."]
script = ExtResource( 11 )
script = ExtResource( 15 )
START_STATE = NodePath("Idle")
[node name="Run" type="Node" parent="AnimationStates"]
script = ExtResource( 10 )
script = ExtResource( 13 )
[node name="Idle" type="Node" parent="AnimationStates"]
script = ExtResource( 7 )
script = ExtResource( 12 )
[node name="Attack" type="Node" parent="AnimationStates"]
script = ExtResource( 8 )
script = ExtResource( 14 )
[node name="Roll" type="Node" parent="AnimationStates"]
script = ExtResource( 9 )
script = ExtResource( 16 )
[node name="Sounds" type="Node" parent="."]
[node name="Walk" type="Node" parent="Sounds"]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Sounds/Walk"]
stream = ExtResource( 11 )
[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="Sounds/Walk"]
stream = ExtResource( 10 )
[node name="AudioStreamPlayer3" type="AudioStreamPlayer" parent="Sounds/Walk"]
stream = ExtResource( 7 )
[node name="AudioStreamPlayer4" type="AudioStreamPlayer" parent="Sounds/Walk"]
stream = ExtResource( 9 )
[node name="AudioStreamPlayer5" type="AudioStreamPlayer" parent="Sounds/Walk"]
stream = ExtResource( 8 )
[node name="WalkSoundTimer" type="Timer" parent="Sounds"]
one_shot = true
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"]
[connection signal="area_exited" from="Hurtbox" to="." method="_on_Hurtbox_area_exited"]

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/hero_walk_1.ogg-189348d983150ee57f2f6f423ab41c11.oggstr"
[deps]
source_file="res://Player/Sounds/hero_walk_1.ogg"
dest_files=[ "res://.import/hero_walk_1.ogg-189348d983150ee57f2f6f423ab41c11.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/hero_walk_2.ogg-e1d0be2a03d2db5f284fb29ec53c5da6.oggstr"
[deps]
source_file="res://Player/Sounds/hero_walk_2.ogg"
dest_files=[ "res://.import/hero_walk_2.ogg-e1d0be2a03d2db5f284fb29ec53c5da6.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/hero_walk_3.ogg-814c846ca66fb1f14e78fa6b00b87e97.oggstr"
[deps]
source_file="res://Player/Sounds/hero_walk_3.ogg"
dest_files=[ "res://.import/hero_walk_3.ogg-814c846ca66fb1f14e78fa6b00b87e97.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/hero_walk_4.ogg-9e50819f5b58783431785fe51bc32400.oggstr"
[deps]
source_file="res://Player/Sounds/hero_walk_4.ogg"
dest_files=[ "res://.import/hero_walk_4.ogg-9e50819f5b58783431785fe51bc32400.oggstr" ]
[params]
loop=false
loop_offset=0

Binary file not shown.

View File

@@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/hero_walk_5.ogg-5ad7e7c78f2b3d0ff4c89ac846546604.oggstr"
[deps]
source_file="res://Player/Sounds/hero_walk_5.ogg"
dest_files=[ "res://.import/hero_walk_5.ogg-5ad7e7c78f2b3d0ff4c89ac846546604.oggstr" ]
[params]
loop=false
loop_offset=0