Ported truck town to Godot 3.0

This commit is contained in:
Bastiaan Olij
2018-01-28 20:03:11 +11:00
parent 0252492b78
commit d9a6635c11
37 changed files with 6256 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
*.gd eol=lf
*.tscn eol=lf
*.material eol=lf
*.cfg eol=lf
*.godot eol=lf
*.import eol=lf

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

View File

@@ -0,0 +1,33 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.stex"
path.etc2="res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.stex"
[deps]
source_file="res://Images/cement.png"
source_md5="eeac520b0926b5a69820dd5aa243dadc"
dest_files=[ "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.s3tc.stex", "res://.import/cement.png-702c83258feb3e054c70d5eef03c8880.etc2.stex" ]
dest_md5="fa2e8d9d96178308423d83b443dee9a2"
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,32 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/choose_tow.png-44e07473d53f066833ce9f8293b279c2.stex"
[deps]
source_file="res://Images/choose_tow.png"
source_md5="474fa78a657c8f395a1bf94dc4d532bb"
dest_files=[ "res://.import/choose_tow.png-44e07473d53f066833ce9f8293b279c2.stex" ]
dest_md5="b7a40b72ea2f6ab95a46e321a7de1430"
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,32 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/choose_trailer.png-655ee091ac0a8e8db872e684d92af7c9.stex"
[deps]
source_file="res://Images/choose_trailer.png"
source_md5="e0fce3a1711fd29ae0ca65cc68fe88ad"
dest_files=[ "res://.import/choose_trailer.png-655ee091ac0a8e8db872e684d92af7c9.stex" ]
dest_md5="1fdac0fd9d07f9fbd4457533ddeb20cc"
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@@ -0,0 +1,32 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/choose_van.png-7feae3acf1caead6dd28bf86a912e079.stex"
[deps]
source_file="res://Images/choose_van.png"
source_md5="66c134dd13fa4b6d9c0cb3fad8949436"
dest_files=[ "res://.import/choose_van.png-7feae3acf1caead6dd28bf86a912e079.stex" ]
dest_md5="c3516ba2528a80d067d3702798213ec7"
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 KiB

View File

@@ -0,0 +1,33 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.stex"
path.etc2="res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.stex"
[deps]
source_file="res://Images/grass.png"
source_md5="89609533074cf9f2a59597ce7da97244"
dest_files=[ "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.s3tc.stex", "res://.import/grass.png-6ab6f9e06dc0919bf6b674e512573aeb.etc2.stex" ]
dest_md5="cd60aecf8b29efadd62de28c7a861800"
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

357
3d/truck_town/car_base.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
extends Control
# Member variables
var town = null
func _back():
town.queue_free()
show()
func _load_scene(car):
var tt = load(car).instance()
tt.set_name("car")
town = load("res://town_scene.tscn").instance()
town.get_node("instance_pos").add_child(tt)
town.get_node("back").connect("pressed", self, "_back")
get_parent().add_child(town)
hide()
func _on_van_1_pressed():
_load_scene("res://car_base.tscn")
func _on_van_2_pressed():
_load_scene("res://trailer_truck.tscn")
func _on_van_3_pressed():
_load_scene("res://crane.tscn")

View File

@@ -0,0 +1,105 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://car_select.gd" type="Script" id=1]
[ext_resource path="res://Images/choose_van.png" type="Texture" id=2]
[ext_resource path="res://Images/choose_trailer.png" type="Texture" id=3]
[ext_resource path="res://Images/choose_tow.png" type="Texture" id=4]
[node name="base" type="Control" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource( 1 )
__meta__ = {
"__editor_plugin_screen__": "2D"
}
[node name="van 1" type="Button" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 4.0
margin_top = 160.0
margin_right = 340.0
margin_bottom = 400.0
rect_pivot_offset = Vector2( 0, 0 )
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
icon = ExtResource( 2 )
flat = false
align = 1
_sections_unfolded = [ "Anchor", "Margin" ]
[node name="van 2" type="Button" parent="." index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 344.0
margin_top = 160.0
margin_right = 680.0
margin_bottom = 401.0
rect_pivot_offset = Vector2( 0, 0 )
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
icon = ExtResource( 3 )
flat = false
align = 1
_sections_unfolded = [ "Margin" ]
[node name="van 3" type="Button" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 684.0
margin_top = 160.0
margin_right = 1020.0
margin_bottom = 400.0
rect_pivot_offset = Vector2( 0, 0 )
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 2
size_flags_vertical = 2
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
icon = ExtResource( 4 )
flat = false
align = 1
_sections_unfolded = [ "Margin" ]
[connection signal="pressed" from="van 1" to="." method="_on_van_1_pressed"]
[connection signal="pressed" from="van 2" to="." method="_on_van_2_pressed"]
[connection signal="pressed" from="van 3" to="." method="_on_van_3_pressed"]

1120
3d/truck_town/crane.tscn Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,103 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
radiance_size = 4
sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 )
sky_horizon_color = Color( 0.482353, 0.784314, 0.94902, 1 )
sky_curve = 0.25
sky_energy = 1.0
ground_bottom_color = Color( 0.193604, 0.40625, 0.33859, 1 )
ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 )
ground_curve = 0.01
ground_energy = 1.0
sun_color = Color( 1, 1, 1, 1 )
sun_latitude = 35.0
sun_longitude = 0.0
sun_angle_min = 1.0
sun_angle_max = 100.0
sun_curve = 0.05
sun_energy = 16.0
texture_size = 2
_sections_unfolded = [ "Ground", "Sky" ]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
background_sky_custom_fov = 0.0
background_color = Color( 0, 0, 0, 1 )
background_energy = 1.0
background_canvas_max_layer = 0
ambient_light_color = Color( 0.347656, 0.347656, 0.347656, 1 )
ambient_light_energy = 1.0
ambient_light_sky_contribution = 0.2
fog_enabled = false
fog_color = Color( 0.5, 0.6, 0.7, 1 )
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
fog_sun_amount = 0.0
fog_depth_enabled = true
fog_depth_begin = 10.0
fog_depth_curve = 1.0
fog_transmit_enabled = false
fog_transmit_curve = 1.0
fog_height_enabled = false
fog_height_min = 0.0
fog_height_max = 100.0
fog_height_curve = 1.0
tonemap_mode = 0
tonemap_exposure = 1.0
tonemap_white = 1.0
auto_exposure_enabled = false
auto_exposure_scale = 0.4
auto_exposure_min_luma = 0.05
auto_exposure_max_luma = 8.0
auto_exposure_speed = 0.5
ss_reflections_enabled = false
ss_reflections_max_steps = 64
ss_reflections_fade_in = 0.15
ss_reflections_fade_out = 2.0
ss_reflections_depth_tolerance = 0.2
ss_reflections_roughness = true
ssao_enabled = false
ssao_radius = 1.0
ssao_intensity = 1.0
ssao_radius2 = 0.0
ssao_intensity2 = 1.0
ssao_bias = 0.01
ssao_light_affect = 0.0
ssao_color = Color( 0, 0, 0, 1 )
ssao_quality = 0
ssao_blur = 3
ssao_edge_sharpness = 4.0
dof_blur_far_enabled = false
dof_blur_far_distance = 10.0
dof_blur_far_transition = 5.0
dof_blur_far_amount = 0.1
dof_blur_far_quality = 1
dof_blur_near_enabled = false
dof_blur_near_distance = 2.0
dof_blur_near_transition = 1.0
dof_blur_near_amount = 0.1
dof_blur_near_quality = 1
glow_enabled = false
glow_levels/1 = false
glow_levels/2 = false
glow_levels/3 = true
glow_levels/4 = false
glow_levels/5 = true
glow_levels/6 = false
glow_levels/7 = false
glow_intensity = 0.8
glow_strength = 1.0
glow_bloom = 0.0
glow_blend_mode = 2
glow_hdr_threshold = 1.0
glow_hdr_scale = 2.0
glow_bicubic_upscale = false
adjustment_enabled = false
adjustment_brightness = 1.0
adjustment_contrast = 1.0
adjustment_saturation = 1.0
_sections_unfolded = [ "Ambient Light", "Background" ]

View File

@@ -0,0 +1,57 @@
extends Camera
# Member variables
var collision_exception = []
export var min_distance = 0.5
export var max_distance = 4.0
export var angle_v_adjust = 0.0
export var autoturn_ray_aperture = 25
export var autoturn_speed = 50
var max_height = 2.0
var min_height = 0
func _physics_process(dt):
var target = get_parent().get_global_transform().origin
var pos = get_global_transform().origin
var up = Vector3(0, 1, 0)
var delta = pos - target
# Regular delta follow
# Check ranges
if (delta.length() < min_distance):
delta = delta.normalized()*min_distance
elif (delta.length() > max_distance):
delta = delta.normalized()*max_distance
# Check upper and lower height
if ( delta.y > max_height):
delta.y = max_height
if ( delta.y < min_height):
delta.y = min_height
pos = target + delta
look_at_from_position(pos, target, up)
# Turn a little up or down
var t = get_transform()
t.basis = Basis(t.basis[0], deg2rad(angle_v_adjust))*t.basis
set_transform(t)
func _ready():
# Find collision exceptions for ray
var node = self
while(node):
if (node is RigidBody):
collision_exception.append(node.get_rid())
break
else:
node = node.get_parent()
# This detaches the camera transform from the parent spatial node
set_as_toplevel(true)

BIN
3d/truck_town/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,32 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
[deps]
source_file="res://icon.png"
source_md5="695ebada54b308bf05ee2e31a023973f"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
dest_md5="c0676ee0f90e2983c3b4b06a2a22dd98"
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -0,0 +1,28 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=3
[application]
config/name="Truck Town"
run/main_scene="res://car_select.tscn"
config/icon="res://icon.png"
[display]
window/height=720
window/width=1280
[rasterizer]
shadow_filter=3
[rendering]
environment/default_environment="res://default_env.tres"

View File

@@ -0,0 +1,66 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://trucktown.tscn" type="PackedScene" id=1]
[node name="town_scene" type="Spatial" index="0"]
[node name="Truck_Town" parent="." index="0" instance=ExtResource( 1 )]
[node name="instance_pos" type="Position3D" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 13.2039, 6.67095, -37.6042 )
_sections_unfolded = [ "Transform" ]
[node name="back" type="Button" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 17.0
margin_top = 9.0
margin_right = 85.0
margin_bottom = 41.0
rect_pivot_offset = Vector2( 0, 0 )
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "<- Back!"
flat = false
align = 1
[node name="DirectionalLight" type="DirectionalLight" parent="." index="3"]
transform = Transform( 1, 0, 0, 0, -0.629475, 0.777021, 0, -0.777021, -0.629475, 0, 24.4076, 0 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 1.0
light_indirect_energy = 1.0
light_negative = false
light_specular = 0.5
light_bake_mode = 1
light_cull_mask = -1
shadow_enabled = true
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.1
shadow_contact = 0.0
shadow_reverse_cull_face = false
editor_only = false
directional_shadow_mode = 2
directional_shadow_split_1 = 0.1
directional_shadow_split_2 = 0.2
directional_shadow_split_3 = 0.5
directional_shadow_blend_splits = false
directional_shadow_normal_bias = 0.8
directional_shadow_bias_split_scale = 0.25
directional_shadow_depth_range = 0
directional_shadow_max_distance = 200.0
_sections_unfolded = [ "Shadow" ]

File diff suppressed because one or more lines are too long

3377
3d/truck_town/trucktown.tscn Normal file

File diff suppressed because one or more lines are too long

39
3d/truck_town/vehicle.gd Normal file
View File

@@ -0,0 +1,39 @@
extends VehicleBody
# Member variables
const STEER_SPEED = 1
const STEER_LIMIT = 0.4
var steer_angle = 0
var steer_target = 0
export var engine_force_value = 40
func _physics_process(delta):
if (Input.is_action_pressed("ui_left")):
steer_target = STEER_LIMIT
elif (Input.is_action_pressed("ui_right")):
steer_target = -STEER_LIMIT
else:
steer_target = 0
if (Input.is_action_pressed("ui_up")):
engine_force = engine_force_value
else:
engine_force = 0
if (Input.is_action_pressed("ui_down")):
brake = 1
else:
brake = 0.0
if (steer_target < steer_angle):
steer_angle -= STEER_SPEED*delta
if (steer_target > steer_angle):
steer_angle = steer_target
elif (steer_target > steer_angle):
steer_angle += STEER_SPEED*delta
if (steer_target < steer_angle):
steer_angle = steer_target
steering = steer_angle