musics etc
This commit is contained in:
parent
2e310f4053
commit
bb6404e918
36 changed files with 652 additions and 130 deletions
|
@ -37,8 +37,15 @@ var air_time := 0.0
|
|||
|
||||
|
||||
func custom_gravity() -> Vector3:
|
||||
var attractor = road_path.to_global(road_path.curve.get_closest_point(road_path.to_local(position)))
|
||||
return (attractor - position).normalized()
|
||||
var closest_offset = road_path.curve.get_closest_offset(road_path.to_local(position))
|
||||
var closest_transform = road_path.curve.sample_baked_with_rotation(closest_offset, true, true)
|
||||
var closest_point = road_path.to_global(closest_transform.origin)
|
||||
#var project_plane = Plane(closest_transform.basis.y.normalized(), closest_point)
|
||||
#print(closest_point)
|
||||
#return -project_plane.project(position).normalized() * 0.1
|
||||
#var attractor = road_path.to_global(road_path.curve.get_closest_point(road_path.to_local(position)))
|
||||
|
||||
return -closest_transform.basis.y
|
||||
|
||||
func return_to_road():
|
||||
position = respawn_pos + 3*Vector3.UP
|
||||
|
@ -70,9 +77,6 @@ func _physics_process(delta: float) -> void:
|
|||
respawn_pos = position
|
||||
|
||||
if !is_on_floor:
|
||||
#$DriftParticles.emitting = false
|
||||
#$DriftParticles2.emitting = false
|
||||
#AudioServer.set_bus_volume_db(5, -80)
|
||||
air_time += delta
|
||||
if air_time > 1.5:
|
||||
return_to_road()
|
||||
|
@ -108,12 +112,6 @@ func _physics_process(delta: float) -> void:
|
|||
)
|
||||
drift_factor = clamp(drift_factor, 0, 1)
|
||||
|
||||
#$DriftParticles.emitting = drift_factor < 1 && is_on_floor
|
||||
#$DriftParticles2.emitting = drift_factor < 1 && is_on_floor
|
||||
#if drift_factor < 1 && is_on_floor:
|
||||
#AudioServer.set_bus_volume_db(5, lerp(-15, -30, drift_factor))
|
||||
#else:
|
||||
#AudioServer.set_bus_volume_db(5, -80)
|
||||
|
||||
steer_speed = lerp(steer_speed * 2.0, base_steer_speed, drift_factor)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
friction = 0.5
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_76tdi"]
|
||||
size = Vector3(1, 1, 2.2)
|
||||
size = Vector3(1, 0, 2.2)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_yotxw"]
|
||||
height = 1.1
|
||||
|
@ -32,6 +32,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.435121, 1)
|
|||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.1)
|
||||
shape = SubResource("BoxShape3D_76tdi")
|
||||
disabled = true
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-08, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -4.37114e-08, 1.91069e-15, 0, 0, 1)
|
||||
|
@ -62,4 +63,6 @@ transform = Transform3D(-0.35, 0, -3.0598e-08, 0, 0.35, 0, 3.0598e-08, 0, -0.35,
|
|||
[node name="CameraFollowPoint" type="Marker3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.31962, -2.93594)
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
extends Node
|
||||
|
||||
@export var nb_checkpoints := 5
|
||||
|
||||
const LEVELS = [preload("res://scenes/levels/level1.tscn")]
|
||||
|
||||
var current_level = 0
|
||||
|
||||
@export var nb_checkpoints := 3
|
||||
@export var max_lap := 3
|
||||
|
||||
var current_checkpoint := 0
|
||||
|
@ -8,16 +13,14 @@ var current_lap := 0
|
|||
|
||||
func checkPointEnter(check_point_id):
|
||||
if check_point_id != current_checkpoint:
|
||||
print("not good checkpoint")
|
||||
return
|
||||
|
||||
if check_point_id == 0:
|
||||
current_lap += 1
|
||||
current_checkpoint = 1
|
||||
print("new lap")
|
||||
else:
|
||||
current_checkpoint += 1
|
||||
print(current_checkpoint)
|
||||
else:
|
||||
current_checkpoint += 1
|
||||
current_checkpoint %= nb_checkpoints
|
||||
|
||||
if (current_lap == max_lap):
|
||||
endTrack()
|
||||
|
|
11
entities/mainMenu/main_menu.gd
Normal file
11
entities/mainMenu/main_menu.gd
Normal file
|
@ -0,0 +1,11 @@
|
|||
extends Control
|
||||
|
||||
|
||||
func _on_button_1_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(CheckPointManager.LEVELS[0])
|
||||
|
||||
func _on_button_2_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(CheckPointManager.LEVELS[0])
|
||||
|
||||
func _on_button_3_pressed() -> void:
|
||||
get_tree().change_scene_to_packed(CheckPointManager.LEVELS[0])
|
1
entities/mainMenu/main_menu.gd.uid
Normal file
1
entities/mainMenu/main_menu.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://cntibc2ih0im7
|
6
entities/mainMenu/moto_rotate.gd
Normal file
6
entities/mainMenu/moto_rotate.gd
Normal file
|
@ -0,0 +1,6 @@
|
|||
extends Node3D
|
||||
|
||||
@export var rotating_speed := 1.0
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
rotate(Vector3.UP, delta*rotating_speed)
|
1
entities/mainMenu/moto_rotate.gd.uid
Normal file
1
entities/mainMenu/moto_rotate.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://dlrn4dviqqsdl
|
|
@ -2,7 +2,7 @@
|
|||
extends Path3D
|
||||
class_name RoadPath
|
||||
@export_tool_button("update_control_points") var action = update_control_points
|
||||
var tilt_scale : float = 0.0005
|
||||
@export var tilt_scale : float = 0.0005
|
||||
|
||||
func modulo_get_point_position(i):
|
||||
return curve.get_point_position(posmod(i, curve.point_count))
|
||||
|
|
|
@ -37,8 +37,8 @@ func generate_mesh():
|
|||
var dist2 = float(i + 1) * segment_length
|
||||
|
||||
|
||||
var t1 := curve.sample_baked_with_rotation(dist1, true)
|
||||
var t2 := curve.sample_baked_with_rotation(dist2, true)
|
||||
var t1 := curve.sample_baked_with_rotation(dist1, true, true)
|
||||
var t2 := curve.sample_baked_with_rotation(dist2, true, true)
|
||||
|
||||
var fwd1 = t1.basis.z.normalized()
|
||||
var fwd2 = t2.basis.z.normalized()
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue