Steps dans le son
This commit is contained in:
parent
14e14d5929
commit
c3a32c5176
BIN
Audio/step1.wav
Normal file
BIN
Audio/step1.wav
Normal file
Binary file not shown.
23
Audio/step1.wav.import
Normal file
23
Audio/step1.wav.import
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/step1.wav-a3ca26c195a2d552516a852342ec6d84.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Audio/step1.wav"
|
||||||
|
dest_files=[ "res://.import/step1.wav-a3ca26c195a2d552516a852342ec6d84.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=0
|
BIN
Audio/step2.wav
Normal file
BIN
Audio/step2.wav
Normal file
Binary file not shown.
23
Audio/step2.wav.import
Normal file
23
Audio/step2.wav.import
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/step2.wav-e176ee775e84a4b66608c0aea784cdeb.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Audio/step2.wav"
|
||||||
|
dest_files=[ "res://.import/step2.wav-e176ee775e84a4b66608c0aea784cdeb.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=0
|
BIN
Audio/step3.wav
Normal file
BIN
Audio/step3.wav
Normal file
Binary file not shown.
23
Audio/step3.wav.import
Normal file
23
Audio/step3.wav.import
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/step3.wav-1afbc8d210aab2d152de0a352b4cda99.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Audio/step3.wav"
|
||||||
|
dest_files=[ "res://.import/step3.wav-1afbc8d210aab2d152de0a352b4cda99.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=0
|
BIN
Audio/step4.wav
Normal file
BIN
Audio/step4.wav
Normal file
Binary file not shown.
23
Audio/step4.wav.import
Normal file
23
Audio/step4.wav.import
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamSample"
|
||||||
|
path="res://.import/step4.wav-defe51a16708ba89110de718eb9ed751.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Audio/step4.wav"
|
||||||
|
dest_files=[ "res://.import/step4.wav-defe51a16708ba89110de718eb9ed751.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=0
|
BIN
Audio/walk-home-steps-sound_99bpm_B_minor.wav.reapeaks
Normal file
BIN
Audio/walk-home-steps-sound_99bpm_B_minor.wav.reapeaks
Normal file
Binary file not shown.
26
AudioSteps.gd
Normal file
26
AudioSteps.gd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
extends AudioStreamPlayer3D
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
var array = [ 21019, 54299, 81449, 107722, 133996, 158518 ]
|
||||||
|
var currStep = 0
|
||||||
|
var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
rng.randomize()
|
||||||
|
|
||||||
|
|
||||||
|
func PlayStep():
|
||||||
|
#self.stop()
|
||||||
|
#currStep = rng.randi_range(0,4)
|
||||||
|
#self.seek(currStep)
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
#if (self.get_playback_position() >= currStep + 1):
|
||||||
|
# self.stop()
|
||||||
|
pass
|
21
Player.gd
21
Player.gd
@ -10,7 +10,9 @@ export var jump = 30
|
|||||||
export var slapkill = 0.8
|
export var slapkill = 0.8
|
||||||
var slap = 0.0
|
var slap = 0.0
|
||||||
var chargeSlap = false
|
var chargeSlap = false
|
||||||
var isSlap = false;
|
var isSlap = false
|
||||||
|
var isStep = false
|
||||||
|
var stepAcc = 0
|
||||||
|
|
||||||
export var mouse_sensitivity = 0.03
|
export var mouse_sensitivity = 0.03
|
||||||
|
|
||||||
@ -29,8 +31,11 @@ onready var slap_animator = $HandMovement
|
|||||||
onready var Menu = $HUD/Start
|
onready var Menu = $HUD/Start
|
||||||
onready var AudioSlap = $AudioSlap
|
onready var AudioSlap = $AudioSlap
|
||||||
onready var AudioMegaSlap = $AudioMegaSlap
|
onready var AudioMegaSlap = $AudioMegaSlap
|
||||||
|
onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ]
|
||||||
|
var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
rng.randomize()
|
||||||
slap_animator.current_animation = "basic_slap"
|
slap_animator.current_animation = "basic_slap"
|
||||||
|
|
||||||
|
|
||||||
@ -61,12 +66,15 @@ func _physics_process(delta):
|
|||||||
elif is_on_floor() and full_contact:
|
elif is_on_floor() and full_contact:
|
||||||
gravity_vec = -get_floor_normal() * gravity
|
gravity_vec = -get_floor_normal() * gravity
|
||||||
h_acceleration = normal_acceleration
|
h_acceleration = normal_acceleration
|
||||||
|
isStep = true
|
||||||
else:
|
else:
|
||||||
gravity_vec = -get_floor_normal()
|
gravity_vec = -get_floor_normal()
|
||||||
h_acceleration = normal_acceleration
|
h_acceleration = normal_acceleration
|
||||||
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("jump") and (is_on_floor() or ground_check.is_colliding()):
|
if Input.is_action_just_pressed("jump") and (is_on_floor() or ground_check.is_colliding()):
|
||||||
gravity_vec = Vector3.UP * jump
|
gravity_vec = Vector3.UP * jump
|
||||||
|
isStep = false
|
||||||
|
|
||||||
if Input.is_action_pressed("move_forward"):
|
if Input.is_action_pressed("move_forward"):
|
||||||
direction -= transform.basis.z
|
direction -= transform.basis.z
|
||||||
@ -77,6 +85,7 @@ func _physics_process(delta):
|
|||||||
elif Input.is_action_pressed("move_right"):
|
elif Input.is_action_pressed("move_right"):
|
||||||
direction += transform.basis.x
|
direction += transform.basis.x
|
||||||
|
|
||||||
|
|
||||||
# Slappening
|
# Slappening
|
||||||
if Input.is_action_pressed("slap"):
|
if Input.is_action_pressed("slap"):
|
||||||
if slap < 0.01:
|
if slap < 0.01:
|
||||||
@ -107,6 +116,16 @@ func _physics_process(delta):
|
|||||||
|
|
||||||
|
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
|
|
||||||
|
if isStep:
|
||||||
|
stepAcc += (abs(direction.x) + abs(direction.z)) * delta
|
||||||
|
else:
|
||||||
|
stepAcc = 0.0
|
||||||
|
|
||||||
|
if (stepAcc > 0.3):
|
||||||
|
stepAcc -= 0.45
|
||||||
|
Steps[rng.randi_range(0,3)].play();
|
||||||
|
|
||||||
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
|
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
|
||||||
movement.z = h_velocity.z + gravity_vec.z
|
movement.z = h_velocity.z + gravity_vec.z
|
||||||
movement.x = h_velocity.x + gravity_vec.x
|
movement.x = h_velocity.x + gravity_vec.x
|
||||||
|
20
Player.tscn
20
Player.tscn
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=12 format=2]
|
[gd_scene load_steps=16 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Player.gd" type="Script" id=1]
|
[ext_resource path="res://Player.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
|
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
|
||||||
@ -6,6 +6,10 @@
|
|||||||
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://HUD.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=5]
|
[ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=5]
|
||||||
[ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=6]
|
[ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=6]
|
||||||
|
[ext_resource path="res://Audio/step2.wav" type="AudioStream" id=8]
|
||||||
|
[ext_resource path="res://Audio/step3.wav" type="AudioStream" id=9]
|
||||||
|
[ext_resource path="res://Audio/step4.wav" type="AudioStream" id=10]
|
||||||
|
[ext_resource path="res://Audio/step1.wav" type="AudioStream" id=11]
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape" id=2]
|
[sub_resource type="CapsuleShape" id=2]
|
||||||
height = 3.0
|
height = 3.0
|
||||||
@ -13,7 +17,6 @@ height = 3.0
|
|||||||
[sub_resource type="CylinderShape" id=3]
|
[sub_resource type="CylinderShape" id=3]
|
||||||
|
|
||||||
[sub_resource type="SpatialMaterial" id=4]
|
[sub_resource type="SpatialMaterial" id=4]
|
||||||
flags_no_depth_test = true
|
|
||||||
albedo_texture = ExtResource( 3 )
|
albedo_texture = ExtResource( 3 )
|
||||||
uv1_triplanar = true
|
uv1_triplanar = true
|
||||||
|
|
||||||
@ -133,6 +136,17 @@ emission_angle_enabled = true
|
|||||||
doppler_tracking = 2
|
doppler_tracking = 2
|
||||||
|
|
||||||
[node name="Music" type="AudioStreamPlayer" parent="."]
|
[node name="Music" type="AudioStreamPlayer" parent="."]
|
||||||
volume_db = 13.983
|
|
||||||
autoplay = true
|
autoplay = true
|
||||||
bus = "Music"
|
bus = "Music"
|
||||||
|
|
||||||
|
[node name="Step2" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 8 )
|
||||||
|
|
||||||
|
[node name="Step3" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 9 )
|
||||||
|
|
||||||
|
[node name="Step1" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="Step4" type="AudioStreamPlayer3D" parent="."]
|
||||||
|
stream = ExtResource( 10 )
|
||||||
|
16
Steps.gd
Normal file
16
Steps.gd
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Declare member variables here. Examples:
|
||||||
|
# var a = 2
|
||||||
|
# var b = "text"
|
||||||
|
onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ]
|
||||||
|
var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
rng.randomize()
|
||||||
|
|
||||||
|
func playStep():
|
||||||
|
Steps[rng.randi_range(0,3)].play();
|
||||||
|
|
@ -1,6 +1,13 @@
|
|||||||
[gd_resource type="AudioBusLayout" format=2]
|
[gd_resource type="AudioBusLayout" load_steps=2 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="AudioEffectCompressor" id=1]
|
||||||
|
resource_name = "Compressor"
|
||||||
|
threshold = -10.6
|
||||||
|
gain = 4.4
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
bus/0/effect/0/effect = SubResource( 1 )
|
||||||
|
bus/0/effect/0/enabled = true
|
||||||
bus/1/name = "SFX"
|
bus/1/name = "SFX"
|
||||||
bus/1/solo = false
|
bus/1/solo = false
|
||||||
bus/1/mute = false
|
bus/1/mute = false
|
||||||
|
@ -18,6 +18,7 @@ config/icon="res://icon.png"
|
|||||||
|
|
||||||
window/size/width=1920
|
window/size/width=1920
|
||||||
window/size/height=1080
|
window/size/height=1080
|
||||||
|
window/size/fullscreen=true
|
||||||
window/size/test_width=1280
|
window/size/test_width=1280
|
||||||
window/size/test_height=720
|
window/size/test_height=720
|
||||||
window/stretch/mode="viewport"
|
window/stretch/mode="viewport"
|
||||||
|
Loading…
Reference in New Issue
Block a user