added vehicle trail, tweaked vehicle texture, tweaked lights

This commit is contained in:
Metzkermeister 2023-10-02 15:55:53 +02:00
parent 17085c5148
commit 3265148f69
10 changed files with 149 additions and 8 deletions

BIN
assets/trail (2).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://f1rqgalvu8yn"
path="res://.godot/imported/trail (2).png-3f21e6aaecc3504acd29ca863f8284cc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/trail (2).png"
dest_files=["res://.godot/imported/trail (2).png-3f21e6aaecc3504acd29ca863f8284cc.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/trail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

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

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bhaguwi3jy6mp"
path="res://.godot/imported/trail.png-64e5a06be69644d3134ab74f3d4baced.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/trail.png"
dest_files=["res://.godot/imported/trail.png-64e5a06be69644d3134ab74f3d4baced.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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://c77xk0mywwt5f"] [gd_scene load_steps=11 format=3 uid="uid://c77xk0mywwt5f"]
[ext_resource type="Script" path="res://src/game/level.gd" id="1_hv75i"] [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"] [ext_resource type="PackedScene" uid="uid://ckau5s2tsb3oc" path="res://src/game/player.tscn" id="2_5nf51"]
@ -8,6 +8,7 @@
[ext_resource type="Texture2D" uid="uid://dmcrms0qu0mtt" path="res://assets/finish2.png" id="4_rxurh"] [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="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"] [ext_resource type="AudioStream" uid="uid://dh5jxxwim7ra8" path="res://assets/sounds/music/death_by_waveshaper.wav" id="8_ppkte"]
[ext_resource type="Texture2D" uid="uid://f1rqgalvu8yn" path="res://assets/trail (2).png" id="9_g4oyh"]
[sub_resource type="Curve2D" id="Curve2D_ll8bj"] [sub_resource type="Curve2D" id="Curve2D_ll8bj"]
_data = { _data = {
@ -79,8 +80,15 @@ texture = ExtResource("7_g24mp")
[node name="level_music" type="AudioStreamPlayer" parent="."] [node name="level_music" type="AudioStreamPlayer" parent="."]
stream = ExtResource("8_ppkte") stream = ExtResource("8_ppkte")
volume_db = -29.953 volume_db = -10.0
autoplay = true autoplay = true
[node name="EditorLight" type="PointLight2D" parent="."]
position = Vector2(29.9961, 54.4995)
scale = Vector2(7.6892, 4.79473)
editor_only = true
texture = ExtResource("9_g4oyh")
texture_scale = 50.0
[connection signal="distance_changed" from="." to="CanvasLayer/hud" method="_on_level_distance_changed"] [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"] [connection signal="speed_changed" from="player" to="CanvasLayer/hud" method="_on_player_speed_changed"]

View file

@ -1,12 +1,13 @@
[gd_scene load_steps=8 format=3 uid="uid://ckau5s2tsb3oc"] [gd_scene load_steps=10 format=3 uid="uid://ckau5s2tsb3oc"]
[ext_resource type="Script" path="res://src/game/player_controller.gd" id="1_g4ij8"] [ext_resource type="Script" path="res://src/game/player_controller.gd" id="1_g4ij8"]
[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://c2ldu662bhlhh" path="res://assets/v_light2.png" id="2_velje"]
[ext_resource type="Texture2D" uid="uid://bnyyk81dhy3h2" path="res://assets/vehicle.png" id="3_4a53i"]
[ext_resource type="Texture2D" uid="uid://ceqcsof04vhqs" path="res://assets/light.png" id="3_qosw5"] [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://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://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"] [ext_resource type="AudioStream" uid="uid://c6dy6nea6vaa4" path="res://assets/sounds/sfx/death_sound.wav" id="6_i0vg5"]
[ext_resource type="PackedScene" uid="uid://c15m0i1a07em4" path="res://src/game/trail_2d.tscn" id="8_shyhm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w2nj7"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_w2nj7"]
size = Vector2(36, 20) size = Vector2(36, 20)
@ -19,23 +20,30 @@ drift_factor = 1.2
camera_offset = 200.0 camera_offset = 200.0
camera = NodePath("Camera2D") camera = NodePath("Camera2D")
[node name="player_light" type="PointLight2D" parent="."] [node name="player_bottom_light" type="PointLight2D" parent="."]
position = Vector2(0, 3.09944e-05) position = Vector2(0, 3.09944e-05)
rotation = 1.5708 rotation = 1.5708
scale = Vector2(0.1, 0.1) scale = Vector2(0.1, 0.1)
energy = 5.0 energy = 3.0
range_item_cull_mask = 3 range_item_cull_mask = 3
texture = ExtResource("2_velje") texture = ExtResource("2_velje")
[node name="Playermodel" type="Sprite2D" parent="."] [node name="Playermodel" type="Sprite2D" parent="."]
light_mask = 4 light_mask = 8
position = Vector2(0, 3.09944e-05) position = Vector2(0, 3.09944e-05)
rotation = 1.5708 rotation = 1.5708
scale = Vector2(0.1, 0.1) scale = Vector2(0.1, 0.1)
texture = ExtResource("2_ifw0w") texture = ExtResource("3_4a53i")
[node name="player_light" type="PointLight2D" parent="."]
rotation = -3.14159
range_item_cull_mask = 8
texture = ExtResource("3_qosw5")
texture_scale = 3.5
[node name="vignette_light" type="PointLight2D" parent="."] [node name="vignette_light" type="PointLight2D" parent="."]
rotation = 1.5708 rotation = 1.5708
energy = 2.0
range_item_cull_mask = 7 range_item_cull_mask = 7
texture = ExtResource("3_qosw5") texture = ExtResource("3_qosw5")
texture_scale = 3.5 texture_scale = 3.5
@ -65,3 +73,7 @@ volume_db = -25.297
[node name="death_sound" type="AudioStreamPlayer" parent="."] [node name="death_sound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("6_i0vg5") stream = ExtResource("6_i0vg5")
volume_db = -25.297 volume_db = -25.297
[node name="Trail2D" parent="." instance=ExtResource("8_shyhm")]
light_mask = 7
MAX_LENGTH = 40

View file

@ -36,6 +36,7 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
#print_debug("playerpos",position)
var dec_d = dec * delta var dec_d = dec * delta
if momentum.length() > dec_d: if momentum.length() > dec_d:
momentum -= momentum.normalized()*dec_d momentum -= momentum.normalized()*dec_d

24
src/game/trail_2d.gd Normal file
View file

@ -0,0 +1,24 @@
extends Line2D
class_name Trails
var queue : Array
@export var MAX_LENGTH : int
func _process(_delta):
var pos = _get_position() - Vector2(20, 0).rotated(get_parent().rotation)
#print_debug("trailpos",pos)
queue.push_front(pos)
if queue.size() > MAX_LENGTH:
queue.pop_back()
clear_points()
for point in queue:
add_point(point)
func _get_position():
return get_parent().position

28
src/game/trail_2d.tscn Normal file
View file

@ -0,0 +1,28 @@
[gd_scene load_steps=6 format=3 uid="uid://c15m0i1a07em4"]
[ext_resource type="Texture2D" uid="uid://f1rqgalvu8yn" path="res://assets/trail (2).png" id="1_kjbpn"]
[ext_resource type="Script" path="res://src/game/trail_2d.gd" id="1_l0x56"]
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_gposr"]
blend_mode = 1
[sub_resource type="Curve" id="Curve_smeq3"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0.5), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_swnlq"]
offsets = PackedFloat32Array(0.334694, 1)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[node name="Trail2D" type="Line2D"]
top_level = true
material = SubResource("CanvasItemMaterial_gposr")
width_curve = SubResource("Curve_smeq3")
gradient = SubResource("Gradient_swnlq")
texture = ExtResource("1_kjbpn")
texture_mode = 1
joint_mode = 1
begin_cap_mode = 2
antialiased = true
script = ExtResource("1_l0x56")
MAX_LENGTH = 20