Un peu de musique dans ce monde de brutes

This commit is contained in:
Thomas
2025-03-31 13:13:07 +02:00
parent a82237ff28
commit b091bb96db
46 changed files with 702 additions and 6 deletions

View File

@@ -23,9 +23,13 @@ func moveTo(position: Vector2) -> void:
func updateFacingDirectionInAnimationTree():
animation_tree.set("parameters/CarStates/driving/blend_position", last_facing_direction)
animation_tree.set("parameters/CarStates/idling/blend_position", last_facing_direction)
func _ready() -> void:
$AudioStreamPlayer2D.play()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
$AudioStreamPlayer2D.pitch_scale = current_speed / speed
$ZIndexControler/ShapeCast2D.enabled = !$CollisionHorizontal.disabled
var accelerationStep = (speed * delta / timeToChangeVelocity)

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=35 format=3 uid="uid://bt1p311rn1h6q"]
[gd_scene load_steps=36 format=3 uid="uid://bt1p311rn1h6q"]
[ext_resource type="Script" path="res://vehicules/car.gd" id="1_vkq5y"]
[ext_resource type="PackedScene" uid="uid://brh7cqaxc13ie" path="res://zindex/ZIndexControler.tscn" id="3_iaqxo"]
[ext_resource type="Texture2D" uid="uid://dq81e78eaild8" path="res://assest/vehicules/Car_classic_red_48x48.png" id="4_0kman"]
[ext_resource type="AudioStream" uid="uid://c774hcxk657n" path="res://assest/fx/engine-6000.ogg" id="4_o8ske"]
[sub_resource type="Animation" id="Animation_24r8n"]
length = 0.001
@@ -602,3 +603,11 @@ offset_bottom = -19.0
position = Vector2(1, -13)
shape = SubResource("RectangleShape2D_yiphh")
target_position = Vector2(1, -32)
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("4_o8ske")
volume_db = -20.8
autoplay = true
attenuation = 2.0
[connection signal="finished" from="AudioStreamPlayer2D" to="." method="_on_audio_stream_player_2d_finished"]