des bruits de pas
tralala
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://bleadp4yrdgj"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://bleadp4yrdgj"]
|
||||
|
||||
[ext_resource type="Script" path="res://caracters/human.gd" id="1_x3vfc"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://ddr1ltkievtku" path="res://animations/human/human_state_machine.tres" id="2_86nrf"]
|
||||
@@ -12,6 +12,7 @@
|
||||
[ext_resource type="Resource" uid="uid://vg4mssby1i6p" path="res://caracters/bob/bob.dialogue" id="9_d5408"]
|
||||
[ext_resource type="PackedScene" uid="uid://dn10ervwv15oo" path="res://UI/clues/bubble_clue.tscn" id="10_rm4iv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjm4k0fv7eger" path="res://caracters/human_pathfinder.tscn" id="11_ubech"]
|
||||
[ext_resource type="AudioStream" uid="uid://bwja5fpawbgjq" path="res://assest/fx/Running on Concrete with Tennis Shoes.ogg" id="13_7opcx"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_a4vmx"]
|
||||
radius = 5.0
|
||||
@@ -99,6 +100,11 @@ position = Vector2(44, -38)
|
||||
|
||||
[node name="pathFinder" parent="." instance=ExtResource("11_ubech")]
|
||||
|
||||
[node name="FeetSound" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("13_7opcx")
|
||||
autoplay = true
|
||||
stream_paused = true
|
||||
|
||||
[connection signal="start_intracting" from="." to="npcControler" method="_on_character_body_2d_start_intracting"]
|
||||
[connection signal="area_entered" from="detector" to="." method="_on_area_2d_area_entered"]
|
||||
[connection signal="body_entered" from="detector" to="." method="_on_area_2d_body_entered"]
|
||||
|
||||
@@ -12,6 +12,7 @@ var humanInteractionTarget: Human = null
|
||||
@onready var animation_player := $AnimationPlayer
|
||||
@onready var state_machine := animation_tree.get("parameters/HumanState/playback") as AnimationNodeStateMachinePlayback
|
||||
@onready var interactionZone : InteractionZone = $"interaction zone"
|
||||
@onready var feetSound = $FeetSound
|
||||
|
||||
var interactionClueFor : Human
|
||||
var interactionPaused= false
|
||||
@@ -64,6 +65,9 @@ func _physics_process(delta):
|
||||
# compute the direction the player wants to look at
|
||||
if velocity:
|
||||
last_facing_direction = velocity.normalized()
|
||||
feetSound.stream_paused = false
|
||||
else:
|
||||
feetSound.stream_paused = true
|
||||
|
||||
updateFacingDirectionInAnimationTree()
|
||||
|
||||
@@ -109,3 +113,5 @@ func disable_interaction_clue():
|
||||
|
||||
func _on_load_from_game_state() -> void:
|
||||
emit_signal("loadFromGameState")
|
||||
feetSound.play()
|
||||
feetSound.stream_paused = true
|
||||
|
||||
@@ -2,7 +2,22 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://0yybe0v6bkv1" path="res://assest/musicians/Subway_Busker_2_48x48.png" id="1_dq5dt"]
|
||||
[ext_resource type="Script" path="res://caracters/musicians/thomas.gd" id="1_it5tv"]
|
||||
[ext_resource type="AudioStream" uid="uid://bdj7nbrv8f53m" path="res://assest/music/balade du grand nord.ogg" id="2_6pcth"]
|
||||
[ext_resource type="AudioStream" uid="uid://bpm1d70babypo" path="res://assest/music/chartreuse blues.ogg" id="3_redb5"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2qywv"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_k8n4u"]
|
||||
resource_name = "play"
|
||||
@@ -21,21 +36,6 @@ tracks/0/keys = {
|
||||
"values": [0, 1, 2, 3, 4, 6, 7, 6, 7, 8, 9, 10, 11]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2qywv"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_v18ad"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_2qywv"),
|
||||
@@ -64,11 +64,11 @@ rotation = 1.5708
|
||||
shape = SubResource("CapsuleShape2D_0816g")
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("2_6pcth")
|
||||
stream = ExtResource("3_redb5")
|
||||
volume_db = 1.0
|
||||
autoplay = true
|
||||
max_distance = 1000.0
|
||||
attenuation = 2.0
|
||||
stream_paused = true
|
||||
playback_type = 1
|
||||
parameters/looping = false
|
||||
|
||||
[connection signal="finished" from="AudioStreamPlayer2D" to="." method="_on_audio_stream_player_2d_finished"]
|
||||
|
||||
@@ -6,7 +6,7 @@ var songs = [
|
||||
"res://assest/music/balade du grand nord.ogg",
|
||||
]
|
||||
|
||||
var current_song = -1
|
||||
var current_song = 0
|
||||
|
||||
func _ready() -> void:
|
||||
$AnimationPlayer.play("play")
|
||||
@@ -14,15 +14,19 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
if $AudioStreamPlayer2D.get_playback_position() != 0:
|
||||
GameState.float_thomas_music_position = $AudioStreamPlayer2D.get_playback_position()
|
||||
var stream : AudioStream = $AudioStreamPlayer2D.stream
|
||||
if stream:
|
||||
var l = stream.get_length()
|
||||
if is_zero_approx(l - GameState.float_thomas_music_position):
|
||||
play_next_song()
|
||||
|
||||
func _on_load_from_game_state() -> void:
|
||||
$AudioStreamPlayer2D.play(GameState.float_thomas_music_position)
|
||||
|
||||
func _on_audio_stream_player_2d_finished() -> void:
|
||||
play_next_song()
|
||||
if GameState.float_thomas_music_position > 1:
|
||||
$AudioStreamPlayer2D.seek(GameState.float_thomas_music_position)
|
||||
print("resume from pause ", songs[current_song], "at ", GameState.float_thomas_music_position)
|
||||
$AudioStreamPlayer2D.stream_paused = false
|
||||
|
||||
func play_next_song():
|
||||
$AudioStreamPlayer2D.stop()
|
||||
current_song += 1
|
||||
if current_song == songs.size():
|
||||
current_song = 0
|
||||
@@ -30,4 +34,7 @@ func play_next_song():
|
||||
$AudioStreamPlayer2D.stream= load(songs[current_song]);
|
||||
GameState.float_thomas_music_position = 0
|
||||
$AudioStreamPlayer2D.play(GameState.float_thomas_music_position)
|
||||
$AnimationPlayer.play("play")
|
||||
|
||||
|
||||
func _on_outside_unload_from_screen() -> void:
|
||||
$AudioStreamPlayer2D.stream_paused = true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://vclpg4e4ql54"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://vclpg4e4ql54"]
|
||||
|
||||
[ext_resource type="Script" path="res://caracters/human.gd" id="1_l1sti"]
|
||||
[ext_resource type="Script" path="res://caracters/player/player_controler.gd" id="1_oapm5"]
|
||||
@@ -7,6 +7,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cg4dhp7qe68pt" path="res://animations/human/human.tscn" id="4_rsj36"]
|
||||
[ext_resource type="PackedScene" uid="uid://brh7cqaxc13ie" path="res://zindex/ZIndexControler.tscn" id="5_pb07x"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjm4k0fv7eger" path="res://caracters/human_pathfinder.tscn" id="7_g6pgs"]
|
||||
[ext_resource type="AudioStream" uid="uid://bwja5fpawbgjq" path="res://assest/fx/Running on Concrete with Tennis Shoes.ogg" id="8_73an3"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_a4vmx"]
|
||||
radius = 5.0
|
||||
@@ -95,6 +96,12 @@ collide_with_bodies = false
|
||||
[node name="PathFinder" parent="." instance=ExtResource("7_g6pgs")]
|
||||
can_walk_on_roads = true
|
||||
|
||||
[node name="FeetSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("8_73an3")
|
||||
autoplay = true
|
||||
stream_paused = true
|
||||
playback_type = 1
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="controleur" method="_on_character_body_2d_load_from_game_state"]
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
|
||||
[connection signal="area_entered" from="Area2D" to="controleur" method="_on_declencheur"]
|
||||
|
||||
Reference in New Issue
Block a user