@@ -0,0 +1,34 @@ | |||
[remap] | |||
importer="texture" | |||
type="StreamTexture" | |||
path="res://.import/road.png-ba2e03c5623fd0c007ce17d39a38addd.stex" | |||
metadata={ | |||
"vram_texture": false | |||
} | |||
[deps] | |||
source_file="res://Assets/Graphics/road.png" | |||
dest_files=[ "res://.import/road.png-ba2e03c5623fd0c007ce17d39a38addd.stex" ] | |||
[params] | |||
compress/mode=0 | |||
compress/lossy_quality=0.7 | |||
compress/hdr_mode=0 | |||
compress/bptc_ldr=0 | |||
compress/normal_map=0 | |||
flags/repeat=1 | |||
flags/filter=false | |||
flags/mipmaps=false | |||
flags/anisotropic=false | |||
flags/srgb=2 | |||
process/fix_alpha_border=true | |||
process/premult_alpha=false | |||
process/HDR_as_SRGB=false | |||
process/invert_color=false | |||
stream=false | |||
size_limit=0 | |||
detect_3d=false | |||
svg/scale=1.0 |
@@ -27,7 +27,7 @@ var acceleration = Vector2.ZERO | |||
var steering_angle = 0.0 | |||
var engine_power = 0.0 | |||
var breaking_power = 0.0 | |||
var reverse = true | |||
var reverse = false | |||
onready var camera = $Camera2D | |||
@@ -176,7 +176,7 @@ func _generate_traction() -> float: | |||
if speed >= traction_fast_speed: | |||
traction = traction_fast | |||
elif speed >= traction_slow_speed: | |||
var d = speed / (traction_fast_speed - traction_slow_speed) | |||
var d = (speed - traction_slow_speed) / (traction_fast_speed - traction_slow_speed) | |||
traction = traction_slow + ((traction_fast - traction_slow) * d) | |||
return traction | |||
@@ -188,9 +188,9 @@ func _calculate_heading(delta : float) -> void: | |||
var heading = (fore_wheel - rear_wheel).normalized() | |||
var traction = _generate_traction() | |||
var d = heading.dot(velocity.normalized()) | |||
if d > 0: | |||
if d > 0 and not (reverse or breaking_power > 0): | |||
velocity = velocity.linear_interpolate(heading * velocity.length(), traction) | |||
if d < 0: | |||
if d < 0 and (reverse or breaking_power > 0): | |||
velocity = velocity.linear_interpolate(-heading * velocity.length(), traction) | |||
#velocity = heading * velocity.length() | |||
rotation = (heading.angle() + deg2rad(90)) |
@@ -0,0 +1,36 @@ | |||
extends Node | |||
signal message(msg) | |||
signal value_passed(name, v) | |||
const EMIT_RATE = 0.1 | |||
var _timer_message : float = 0.0 | |||
var _timer_pass_val : float = 0.0 | |||
var _msg_buffer = [] | |||
var _pass_val_buffer = [] | |||
func _msgformat(msg : String, args : Array) -> String: | |||
for i in range(0, args.size()): | |||
msg = msg.format(args[i], "$" + String(i)) | |||
return msg | |||
func message(msg : String, args : Array = []) -> void: | |||
if _timer_message <= 0.0: | |||
emit_signal("message", _msgformat(msg, args)) | |||
_timer_message = EMIT_RATE | |||
else: | |||
_msg_buffer.append(_msgformat(msg, args)) | |||
func pass_value(name : String, val) -> void: | |||
emit_signal("value_passed", name, val) | |||
func _process(delta : float) -> void: | |||
if _timer_message > 0.0: | |||
_timer_message = max(0.0, _timer_message - delta) | |||
if _timer_message == 0.0 and _msg_buffer.size() > 0: | |||
emit_signal("message", _msg_buffer) | |||
_msg_buffer = [] | |||
@@ -0,0 +1,24 @@ | |||
[gd_scene format=2] | |||
[node name="Console" type="CanvasLayer"] | |||
[node name="ScreenSplit" type="VBoxContainer" parent="."] | |||
anchor_right = 1.0 | |||
anchor_bottom = 1.0 | |||
__meta__ = { | |||
"_edit_use_anchors_": false | |||
} | |||
[node name="Messages" type="ScrollContainer" parent="ScreenSplit"] | |||
margin_right = 1920.0 | |||
margin_bottom = 538.0 | |||
size_flags_vertical = 3 | |||
[node name="Label" type="Label" parent="ScreenSplit/Messages"] | |||
margin_bottom = 14.0 | |||
[node name="Control" type="Control" parent="ScreenSplit"] | |||
margin_top = 542.0 | |||
margin_right = 1920.0 | |||
margin_bottom = 1080.0 | |||
size_flags_vertical = 3 |
@@ -30,6 +30,10 @@ config/name="Vehicle" | |||
run/main_scene="res://World.tscn" | |||
config/icon="res://icon.png" | |||
[autoload] | |||
ConsoleCTRL="*res://Scripts/Autoloads/consolectrl.gd" | |||
[display] | |||
window/size/width=1920 |