Compare commits

...

11 commits

24 changed files with 369 additions and 43 deletions

3
.gitattributes vendored
View file

@ -1,9 +1,8 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
# Track files for Git LFS
assets/**/*.wav filter=lfs diff=lfs merge=lfs -text
assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
assets/**/*.psd filter=lfs diff=lfs merge=lfs -text
assets/**/*.png filter=lfs diff=lfs merge=lfs -text
assets/**/*.otf filter=lfs diff=lfs merge=lfs -text
assets/**/*.ttf filter=lfs diff=lfs merge=lfs -text

BIN
assets/sounds/music/death_by_waveshaper.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dh5jxxwim7ra8"
path="res://.godot/imported/death_by_waveshaper.wav-567c957cfc006d82d2a62bba8a331108.sample"
[deps]
source_file="res://assets/sounds/music/death_by_waveshaper.wav"
dest_files=["res://.godot/imported/death_by_waveshaper.wav-567c957cfc006d82d2a62bba8a331108.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=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
assets/sounds/sfx/damage.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c7laud048l1is"
path="res://.godot/imported/damage.wav-8c4919c614aee00fc00121daa2bc247e.sample"
[deps]
source_file="res://assets/sounds/sfx/damage.wav"
dest_files=["res://.godot/imported/damage.wav-8c4919c614aee00fc00121daa2bc247e.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
assets/sounds/sfx/death_sound.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c6dy6nea6vaa4"
path="res://.godot/imported/death_sound.wav-74c3ac4e551e080446bef315f79faff8.sample"
[deps]
source_file="res://assets/sounds/sfx/death_sound.wav"
dest_files=["res://.godot/imported/death_sound.wav-74c3ac4e551e080446bef315f79faff8.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=1
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

BIN
assets/sounds/sfx/engine_loop.wav (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cc4ffx6b0xjvk"
path="res://.godot/imported/engine_loop.wav-259955cdefdf44f318b80661126b8c7f.sample"
[deps]
source_file="res://assets/sounds/sfx/engine_loop.wav"
dest_files=["res://.godot/imported/engine_loop.wav-259955cdefdf44f318b80661126b8c7f.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
assets/v_light.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

34
assets/v_light.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bva8vs42tx03s"
path="res://.godot/imported/v_light.png-7acf5f641671ba7235dbbd4787595e37.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/v_light.png"
dest_files=["res://.godot/imported/v_light.png-7acf5f641671ba7235dbbd4787595e37.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/v_light2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c2ldu662bhlhh"
path="res://.godot/imported/v_light2.png-ab361c7de69a8dec4185215e9529c3e8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/v_light2.png"
dest_files=["res://.godot/imported/v_light2.png-ab361c7de69a8dec4185215e9529c3e8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/vehicle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

34
assets/vehicle.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bnyyk81dhy3h2"
path="res://.godot/imported/vehicle.png-a41cb91fcab998de7698162333ee5bc9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vehicle.png"
dest_files=["res://.godot/imported/vehicle.png-a41cb91fcab998de7698162333ee5bc9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/vehicle2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bx4nammvn7hea"
path="res://.godot/imported/vehicle2.png-bb7df5e942f0854be95e87da75ff4526.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vehicle2.png"
dest_files=["res://.godot/imported/vehicle2.png-bb7df5e942f0854be95e87da75ff4526.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/vehicle3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5lucllx2m3il"
path="res://.godot/imported/vehicle3.png-78502c74c095c869a85b7e51e89120ab.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/vehicle3.png"
dest_files=["res://.godot/imported/vehicle3.png-78502c74c095c869a85b7e51e89120ab.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.cte
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

View file

@ -96,5 +96,10 @@ func get_total_distance():
return lap_distance + last_offset
func game_over():
running = false
player.dead = true
$player/death_sound.play()
print_debug("final score: ", get_total_distance())
await get_tree().create_timer(3).timeout
get_tree().reload_current_scene() #temp

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://c77xk0mywwt5f"]
[gd_scene load_steps=10 format=3 uid="uid://c77xk0mywwt5f"]
[ext_resource type="Script" path="res://src/game/level.gd" id="1_hv75i"]
[ext_resource type="PackedScene" uid="uid://ckau5s2tsb3oc" path="res://src/game/player.tscn" id="2_5nf51"]
@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://ds0un04pocx6i" path="res://assets/track90.png" id="3_jtw40"]
[ext_resource type="Texture2D" uid="uid://dmcrms0qu0mtt" path="res://assets/finish2.png" id="4_rxurh"]
[ext_resource type="Texture2D" uid="uid://bq151lkkfdlf4" path="res://assets/sign.png" id="7_g24mp"]
[ext_resource type="AudioStream" uid="uid://dh5jxxwim7ra8" path="res://assets/sounds/music/death_by_waveshaper.wav" id="8_ppkte"]
[sub_resource type="Curve2D" id="Curve2D_ll8bj"]
_data = {
@ -37,14 +38,13 @@ stretch_mode = 1
curve = SubResource("Curve2D_ll8bj")
[node name="TrackLine" type="Line2D" parent="."]
self_modulate = Color(0.827451, 0.521569, 0.313726, 1)
self_modulate = Color(0.164706, 0.658824, 0.858824, 1)
texture_repeat = 2
texture = ExtResource("3_jtw40")
texture_mode = 2
begin_cap_mode = 2
[node name="FinishLine" type="Line2D" parent="."]
self_modulate = Color(0.827451, 0.521569, 0.313726, 1)
texture_repeat = 2
width = 40.0
texture = ExtResource("4_rxurh")
@ -77,5 +77,10 @@ color = Color(1, 0.0627451, 0.694118, 1)
energy = 20.0
texture = ExtResource("7_g24mp")
[node name="level_music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("8_ppkte")
volume_db = -29.953
autoplay = true
[connection signal="distance_changed" from="." to="CanvasLayer/hud" method="_on_level_distance_changed"]
[connection signal="speed_changed" from="player" to="CanvasLayer/hud" method="_on_player_speed_changed"]

View file

@ -1,8 +1,16 @@
[gd_scene load_steps=5 format=3 uid="uid://ckau5s2tsb3oc"]
<<<<<<< HEAD
[gd_scene load_steps=6 format=3 uid="uid://ckau5s2tsb3oc"]
=======
[gd_scene load_steps=8 format=3 uid="uid://ckau5s2tsb3oc"]
>>>>>>> 687604fc054965ceb81bf5299befc599e0bb90ed
[ext_resource type="Script" path="res://src/game/player_controller.gd" id="1_g4ij8"]
[ext_resource type="Texture2D" uid="uid://d1t1g7hyil82v" path="res://assets/spracer.png" id="2_xal47"]
[ext_resource type="Texture2D" uid="uid://bx4nammvn7hea" path="res://assets/vehicle2.png" id="2_ifw0w"]
[ext_resource type="Texture2D" uid="uid://c2ldu662bhlhh" path="res://assets/v_light2.png" id="2_velje"]
[ext_resource type="Texture2D" uid="uid://ceqcsof04vhqs" path="res://assets/light.png" id="3_qosw5"]
[ext_resource type="AudioStream" uid="uid://cc4ffx6b0xjvk" path="res://assets/sounds/sfx/engine_loop.wav" id="4_4ajo8"]
[ext_resource type="AudioStream" uid="uid://c7laud048l1is" path="res://assets/sounds/sfx/damage.wav" id="5_rvolc"]
[ext_resource type="AudioStream" uid="uid://c6dy6nea6vaa4" path="res://assets/sounds/sfx/death_sound.wav" id="6_i0vg5"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w2nj7"]
size = Vector2(36, 20)
@ -15,14 +23,24 @@ drift_factor = 1.2
camera_offset = 200.0
camera = NodePath("Camera2D")
[node name="Sprite2D" type="Sprite2D" parent="."]
[node name="player_light" type="PointLight2D" parent="."]
position = Vector2(0, 3.09944e-05)
rotation = 1.5708
scale = Vector2(0.0489796, 0.0489796)
texture = ExtResource("2_xal47")
scale = Vector2(0.1, 0.1)
energy = 5.0
range_item_cull_mask = 3
texture = ExtResource("2_velje")
[node name="PointLight2D" type="PointLight2D" parent="."]
[node name="Playermodel" type="Sprite2D" parent="."]
light_mask = 4
position = Vector2(0, 3.09944e-05)
rotation = 1.5708
scale = Vector2(0.1, 0.1)
texture = ExtResource("2_ifw0w")
[node name="vignette_light" type="PointLight2D" parent="."]
rotation = 1.5708
range_item_cull_mask = 7
texture = ExtResource("3_qosw5")
texture_scale = 3.5
@ -38,3 +56,16 @@ rotation = 1.5708
ignore_rotation = false
rotation_smoothing_enabled = true
rotation_smoothing_speed = 10.0
[node name="engine_sounds" type="AudioStreamPlayer" parent="."]
stream = ExtResource("4_4ajo8")
volume_db = -40.467
autoplay = true
[node name="damage_sounds" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5_rvolc")
volume_db = -25.297
[node name="death_sound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6_i0vg5")
volume_db = -25.297

View file

@ -25,6 +25,7 @@ extends StaticBody2D
# variables
var momentum: Vector2
#var direction = 0 # 1 for forward, 0 for standing still, -1 for reverse
var dead = false
signal speed_changed(new_speed)
@ -35,45 +36,52 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var acc_d = acc * delta
var dec_d = dec * delta
var rev_d = rev * delta
var turn_d = turn_speed * delta
var brake_d = brake_strength * delta
var turn_factor = 1
if momentum.length() > dec_d:
momentum -= momentum.normalized()*dec_d
else:
momentum = Vector2(0,0)
if Input.is_action_pressed("accelerate"):
momentum += acc_d * Vector2(1,0).rotated(rotation)
# if Input.is_action_pressed("reverse"):
# print_debug("reverse vector: ", rev_d * Vector2(-1,0).rotated(rotation))
# momentum += rev_d * Vector2(-1,0).rotated(rotation)
# print_debug("momentum vector = ", momentum)
if Input.is_action_pressed("brake"):
turn_factor = drift_factor
if momentum.length() > brake_d:
momentum -= momentum.normalized() * brake_d
else:
momentum = Vector2(0,0)
if Input.is_action_pressed("left"):
rotate(turn_d*turn_factor*-1)
if Input.is_action_pressed("right"):
rotate(turn_d*turn_factor)
if !dead:
var acc_d = acc * delta
var rev_d = rev * delta
var turn_d = turn_speed * delta
var brake_d = brake_strength * delta
var turn_factor = 1
if !Input.is_action_pressed("brake"):
momentum = Vector2(1,0).rotated(rotation) * momentum.length()
camera.position = Vector2((momentum.length() / max_speed) * camera_offset, 0)
camera.rotation_degrees = momentum.angle() + 90
if Input.is_action_pressed("accelerate"):
momentum += acc_d * Vector2(1,0).rotated(rotation)
# if Input.is_action_pressed("reverse"):
# print_debug("reverse vector: ", rev_d * Vector2(-1,0).rotated(rotation))
# momentum += rev_d * Vector2(-1,0).rotated(rotation)
# print_debug("momentum vector = ", momentum)
if Input.is_action_pressed("brake"):
turn_factor = drift_factor
if momentum.length() > brake_d:
momentum -= momentum.normalized() * brake_d
else:
momentum = Vector2(0,0)
if Input.is_action_pressed("left"):
rotate(turn_d*turn_factor*-1)
if Input.is_action_pressed("right"):
rotate(turn_d*turn_factor)
if !Input.is_action_pressed("brake"):
momentum = Vector2(1,0).rotated(rotation) * momentum.length()
camera.position = Vector2(get_speed_proportion() * camera_offset, 0)
camera.rotation_degrees = momentum.angle() + 90
$engine_sounds.pitch_scale = get_speed_proportion() + .2
else:
rotate(PI*delta * get_speed_proportion())
if momentum.length() > max_speed:
momentum = momentum.normalized() * max_speed
speed_changed.emit(momentum.length())
move_and_collide(momentum * delta)
func get_speed_proportion():
return (momentum.length() / max_speed)