added a light texture

added lights and a background into the car scene
reorganized the car scene to make things more segmented
fixed game.gd trying to reference a node in a new place
master
Zac 4 years ago
parent 10240cc0b6
commit 4b659cb812

@ -1,40 +1,11 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=13 format=2]
[ext_resource path="res://scripts/game.gd" type="Script" id=1]
[ext_resource path="res://scripts/wiper.gd" type="Script" id=2]
[ext_resource path="res://scripts/rain_spawner.gd" type="Script" id=3]
[ext_resource path="res://textures/windshield.png" type="Texture" id=4]
[ext_resource path="res://textures/white_pixel.png" type="Texture" id=5]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0
extents = Vector2( 7.99985, 159.194 )
[sub_resource type="Shader" id=2]
code = "shader_type canvas_item;
uniform float blur : hint_range(0, 5);
uniform sampler2D windshield_texture : hint_albedo;
uniform vec4 blur_color : hint_color;
void fragment() {
if (texture(windshield_texture, UV) == blur_color) {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur);
} else {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0);
}
}"
[sub_resource type="ShaderMaterial" id=3]
render_priority = 0
shader = SubResource( 2 )
shader_param/blur = 1.0
shader_param/blur_color = Color( 1, 1, 1, 1 )
shader_param/windshield_texture = ExtResource( 4 )
_sections_unfolded = [ "shader_param" ]
[ext_resource path="res://scripts/rain_spawner.gd" type="Script" id=2]
[ext_resource path="res://textures/light.png" type="Texture" id=3]
[ext_resource path="res://scripts/wiper.gd" type="Script" id=4]
[ext_resource path="res://textures/windshield.png" type="Texture" id=5]
[ext_resource path="res://textures/white_pixel.png" type="Texture" id=6]
[sub_resource type="Curve" id=5]
@ -90,6 +61,36 @@ anim_offset_random = 0.0
anim_loop = false
_sections_unfolded = [ "Color", "Emission Shape" ]
[sub_resource type="RectangleShape2D" id=1]
custom_solver_bias = 0.0
extents = Vector2( 7.99985, 159.194 )
[sub_resource type="Shader" id=2]
code = "shader_type canvas_item;
uniform float blur : hint_range(0, 5);
uniform sampler2D windshield_texture : hint_albedo;
uniform vec4 blur_color : hint_color;
void fragment() {
if (texture(windshield_texture, UV) == blur_color) {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur);
} else {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0);
}
}"
[sub_resource type="ShaderMaterial" id=3]
render_priority = 0
shader = SubResource( 2 )
shader_param/blur = 1.0
shader_param/blur_color = Color( 1, 1, 1, 1 )
shader_param/windshield_texture = ExtResource( 5 )
_sections_unfolded = [ "shader_param" ]
[node name="car" type="Node2D" index="0"]
script = ExtResource( 1 )
@ -98,24 +99,141 @@ __meta__ = {
"_edit_vertical_guides_": [ ]
}
[node name="wipers" type="Node2D" parent="." index="0"]
[node name="outside" type="Node2D" parent="." index="0"]
scale = Vector2( 1, 1 )
[node name="outside" type="ColorRect" parent="outside" index="0"]
show_behind_parent = true
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1020.0
margin_bottom = 600.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 0, 0, 0, 0.547608 )
_sections_unfolded = [ "Visibility" ]
[node name="rain_spawner" type="Node2D" parent="outside" index="1"]
show_behind_parent = true
position = Vector2( 510, -60 )
scale = Vector2( 13.75, 1.40625 )
script = ExtResource( 2 )
[node name="rain_particles" type="Particles2D" parent="outside" index="2"]
show_behind_parent = true
position = Vector2( 333.076, -157.333 )
rotation = -0.523598
scale = Vector2( 2.60156, 2.20313 )
emitting = true
amount = 60
lifetime = 3.0
one_shot = false
preprocess = 10.78
speed_scale = 2.36
explosiveness = 0.0
randomness = 0.7
fixed_fps = 0
fract_delta = true
visibility_rect = Rect2( -100, -100, 200, 200 )
local_coords = true
draw_order = 0
process_material = SubResource( 4 )
texture = null
normal_map = null
h_frames = 1
v_frames = 1
[node name="lights" type="Node2D" parent="outside" index="3"]
editor/display_folded = true
position = Vector2( 520, 450 )
[node name="Light2D" type="Light2D" parent="outside/lights" index="0"]
position = Vector2( -260, 90 )
scale = Vector2( 0.685547, 0.685547 )
enabled = true
editor_only = false
texture = ExtResource( 3 )
offset = Vector2( 0, 0 )
texture_scale = 1.0
color = Color( 1, 1, 1, 1 )
energy = 1.0
mode = 0
range_height = 0.0
range_z_min = -1024
range_z_max = 1024
range_layer_min = 0
range_layer_max = 0
range_item_cull_mask = 1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 0 )
shadow_buffer_size = 2048
shadow_gradient_length = 0.0
shadow_filter = 0
shadow_filter_smooth = 0.0
shadow_item_cull_mask = 1
[node name="Light2D2" type="Light2D" parent="outside/lights" index="1"]
position = Vector2( 200, 90 )
scale = Vector2( 0.685547, 0.685547 )
enabled = true
editor_only = false
texture = ExtResource( 3 )
offset = Vector2( 0, 0 )
texture_scale = 1.0
color = Color( 1, 1, 1, 1 )
energy = 1.0
mode = 0
range_height = 0.0
range_z_min = -1024
range_z_max = 1024
range_layer_min = 0
range_layer_max = 0
range_item_cull_mask = 1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 0 )
shadow_buffer_size = 2048
shadow_gradient_length = 0.0
shadow_filter = 0
shadow_filter_smooth = 0.0
shadow_item_cull_mask = 1
[node name="inside" type="Node2D" parent="." index="1"]
editor/display_folded = true
scale = Vector2( 1, 1 )
[node name="wipers" type="Node2D" parent="inside" index="0"]
editor/display_folded = true
position = Vector2( -70, 0 )
scale = Vector2( 1, 1 )
[node name="wiper" type="Node2D" parent="wipers" index="0"]
[node name="wiper" type="Node2D" parent="inside/wipers" index="0"]
editor/display_folded = true
position = Vector2( 625.978, 431 )
rotation = 1.5708
script = ExtResource( 2 )
script = ExtResource( 4 )
_sections_unfolded = [ "Transform" ]
__meta__ = {
"_edit_group_": true
}
dead_zones = 200
[node name="StaticBody2D" type="StaticBody2D" parent="wipers/wiper" index="0"]
[node name="StaticBody2D" type="StaticBody2D" parent="inside/wipers/wiper" index="0"]
editor/display_folded = true
position = Vector2( 0, -134.828 )
@ -128,12 +246,12 @@ friction = 1.0
bounce = 0.0
_sections_unfolded = [ "Collision", "Transform" ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="wipers/wiper/StaticBody2D" index="0"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="inside/wipers/wiper/StaticBody2D" index="0"]
position = Vector2( -9.15527e-05, -23.881 )
shape = SubResource( 1 )
[node name="ColorRect" type="ColorRect" parent="wipers/wiper/StaticBody2D" index="1"]
[node name="ColorRect" type="ColorRect" parent="inside/wipers/wiper/StaticBody2D" index="1"]
anchor_left = 0.0
anchor_top = 0.0
@ -152,19 +270,19 @@ size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
_sections_unfolded = [ "Rect" ]
[node name="wiper2" type="Node2D" parent="wipers" index="1"]
[node name="wiper2" type="Node2D" parent="inside/wipers" index="1"]
editor/display_folded = true
position = Vector2( 286.773, 431 )
rotation = 1.5708
script = ExtResource( 2 )
script = ExtResource( 4 )
_sections_unfolded = [ "Transform" ]
__meta__ = {
"_edit_group_": true
}
dead_zones = 200
[node name="StaticBody2D" type="StaticBody2D" parent="wipers/wiper2" index="0"]
[node name="StaticBody2D" type="StaticBody2D" parent="inside/wipers/wiper2" index="0"]
editor/display_folded = true
position = Vector2( 0, -134.828 )
@ -177,12 +295,12 @@ friction = 1.0
bounce = 0.0
_sections_unfolded = [ "Collision", "Transform" ]
[node name="CollisionShape2D" type="CollisionShape2D" parent="wipers/wiper2/StaticBody2D" index="0"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="inside/wipers/wiper2/StaticBody2D" index="0"]
position = Vector2( -9.15527e-05, -23.881 )
shape = SubResource( 1 )
[node name="ColorRect" type="ColorRect" parent="wipers/wiper2/StaticBody2D" index="1"]
[node name="ColorRect" type="ColorRect" parent="inside/wipers/wiper2/StaticBody2D" index="1"]
anchor_left = 0.0
anchor_top = 0.0
@ -201,8 +319,9 @@ size_flags_vertical = 1
color = Color( 0, 0, 0, 1 )
_sections_unfolded = [ "Rect" ]
[node name="rain_area" type="Area2D" parent="." index="1"]
[node name="rain_area" type="Area2D" parent="inside" index="1"]
editor/display_folded = true
position = Vector2( 514, 264 )
scale = Vector2( 16.125, 5.8125 )
input_pickable = false
@ -217,18 +336,12 @@ collision_mask = 2
audio_bus_override = false
audio_bus_name = "Master"
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="rain_area" index="0"]
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="inside/rain_area" index="0"]
build_mode = 0
polygon = PoolVector2Array( -23.1938, 30.2796, -28.155, -31.6559, 26.4186, -31.6559, 22.6977, 30.2796 )
[node name="rain_spawner" type="Node2D" parent="." index="2"]
position = Vector2( 510, -60 )
scale = Vector2( 13.75, 1.40625 )
script = ExtResource( 3 )
[node name="windshield" type="TextureRect" parent="." index="3"]
[node name="windshield" type="TextureRect" parent="inside" index="2"]
material = SubResource( 3 )
anchor_left = 0.0
@ -244,38 +357,13 @@ mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
texture = ExtResource( 5 )
texture = ExtResource( 6 )
expand = true
stretch_mode = 0
_sections_unfolded = [ "Material" ]
[node name="Particles2D" type="Particles2D" parent="." index="4"]
show_behind_parent = true
position = Vector2( 333.076, -157.333 )
rotation = -0.523598
scale = Vector2( 2.60156, 2.20313 )
emitting = true
amount = 60
lifetime = 3.0
one_shot = false
preprocess = 10.78
speed_scale = 2.36
explosiveness = 0.0
randomness = 0.7
fixed_fps = 0
fract_delta = true
visibility_rect = Rect2( -100, -100, 200, 200 )
local_coords = true
draw_order = 0
process_material = SubResource( 4 )
texture = null
normal_map = null
h_frames = 1
v_frames = 1
[connection signal="body_entered" from="rain_area" to="." method="_on_rain_area_body_entered"]
[connection signal="body_entered" from="inside/rain_area" to="." method="_on_rain_area_body_entered"]
[connection signal="body_exited" from="rain_area" to="." method="_on_rain_area_body_exited"]
[connection signal="body_exited" from="inside/rain_area" to="." method="_on_rain_area_body_exited"]

@ -3,7 +3,7 @@ extends Node2D
#-------------------------------
# node refs
onready var _blur_shader = $windshield.material
onready var _blur_shader = $"inside/windshield".material
#-------------------------------
# constants

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

@ -0,0 +1,29 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/light.png-6eaf8f508bbd1adf2c3cf7dcbf008f14.stex"
[deps]
source_file="res://textures/light.png"
dest_files=[ "res://.import/light.png-6eaf8f508bbd1adf2c3cf7dcbf008f14.stex" ]
[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
Loading…
Cancel
Save