Reworked red enemy projectile

- added blast effect for laser hit
- reworked laser shader and shape
- reworked charging effect
- changed effect for death
- added disappear effect for parts
This commit is contained in:
QbieShay
2020-12-30 19:50:46 +01:00
committed by Aaron Franke
parent 8d68f04cb0
commit a90fd6ad79
71 changed files with 7181 additions and 26458 deletions

View File

@@ -2,12 +2,12 @@
importer="scene"
type="PackedScene"
path="res://.import/BlastMesh.glb-5fcdd65502c34cf655a578cb2d09942a.scn"
path="res://.import/BlastMesh.glb-b73267f06de3a944c01538e9fdef2594.scn"
[deps]
source_file="res://player/bullet/effect/BlastMesh.glb"
dest_files=[ "res://.import/BlastMesh.glb-5fcdd65502c34cf655a578cb2d09942a.scn" ]
source_file="res://effects_shared/BlastMesh.glb"
dest_files=[ "res://.import/BlastMesh.glb-b73267f06de3a944c01538e9fdef2594.scn" ]
[params]
@@ -21,7 +21,7 @@ materials/storage=0
materials/keep_on_reimport=true
meshes/compress=true
meshes/ensure_tangents=true
meshes/storage=2
meshes/storage=1
meshes/light_baking=0
meshes/lightmap_texel_size=0.1
skins/use_named_skins=true

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

@@ -2,7 +2,7 @@
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/BlastTexture.png-0a9e85f97e23d333722e374be792b3e3.s3tc.stex"
path.s3tc="res://.import/BlastTexture.png-2eec07ef5808b6947cba3638160e2180.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
@@ -10,8 +10,8 @@ metadata={
[deps]
source_file="res://player/bullet/effect/BlastTexture.png"
dest_files=[ "res://.import/BlastTexture.png-0a9e85f97e23d333722e374be792b3e3.s3tc.stex" ]
source_file="res://effects_shared/BlastTexture.png"
dest_files=[ "res://.import/BlastTexture.png-2eec07ef5808b6947cba3638160e2180.s3tc.stex" ]
[params]

Binary file not shown.

Binary file not shown.

View File

@@ -2,12 +2,12 @@
importer="scene"
type="PackedScene"
path="res://.import/BillboardPlane.glb-d89e51bcce54f5c0c5aac52df6278d12.scn"
path="res://.import/BarrelSmoke.glb-8e2d69c4951af8065240d2d52c721128.scn"
[deps]
source_file="res://player/bullet/effect/BillboardPlane.glb"
dest_files=[ "res://.import/BillboardPlane.glb-d89e51bcce54f5c0c5aac52df6278d12.scn" ]
source_file="res://enemies/red_robot/laser/BarrelSmoke.glb"
dest_files=[ "res://.import/BarrelSmoke.glb-8e2d69c4951af8065240d2d52c721128.scn" ]
[params]

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/BarrelSmokeTexture.png-87dcba987386b52e839103c6b4897cbe.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/BarrelSmokeTexture.png"
dest_files=[ "res://.import/BarrelSmokeTexture.png-87dcba987386b52e839103c6b4897cbe.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -0,0 +1,69 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform int particles_anim_h_frames;
uniform int particles_anim_v_frames;
uniform bool particles_anim_loop;
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
varying float lifetime_ratio;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
mat4 mat_world = mat4(normalize(CAMERA_MATRIX[0])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[1])*length(WORLD_MATRIX[0]),normalize(CAMERA_MATRIX[2])*length(WORLD_MATRIX[2]),WORLD_MATRIX[3]);
mat_world = mat_world * mat4( vec4(cos(INSTANCE_CUSTOM.x),-sin(INSTANCE_CUSTOM.x), 0.0, 0.0), vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0),vec4(0.0, 0.0, 1.0, 0.0),vec4(0.0, 0.0, 0.0, 1.0));
MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat_world;
float h_frames = float(particles_anim_h_frames);
float v_frames = float(particles_anim_v_frames);
float particle_total_frames = float(particles_anim_h_frames * particles_anim_v_frames);
float particle_frame = floor(INSTANCE_CUSTOM.z * float(particle_total_frames));
if (!particles_anim_loop) {
particle_frame = clamp(particle_frame, 0.0, particle_total_frames - 1.0);
} else {
particle_frame = mod(particle_frame, particle_total_frames);
} UV /= vec2(h_frames, v_frames);
UV += vec2(mod(particle_frame, h_frames) / h_frames, floor(particle_frame / h_frames) / v_frames);
lifetime_ratio = INSTANCE_CUSTOM.y;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * COLOR.rgb;//texture(color_over_life, vec2(lifetime_ratio)).rgb;
EMISSION = ALBEDO * 3.0 * (1.0 - lifetime_ratio * 1.2);
ALPHA = smoothstep(0.0,0.4,albedo_tex.r - lifetime_ratio * 0.7);
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
}
"
[resource]
shader = SubResource( 1 )
shader_param/albedo = Color( 0.996078, 0.996078, 0.996078, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 1.0
shader_param/point_size = 1.0
shader_param/particles_anim_h_frames = 2
shader_param/particles_anim_v_frames = 2
shader_param/particles_anim_loop = true
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )

View File

@@ -0,0 +1,5 @@
[gd_resource type="Gradient" format=2]
[resource]
offsets = PoolRealArray( 0, 0.450402, 0.713137, 1 )
colors = PoolColorArray( 1, 0.675781, 0.675781, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0 )

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/FireTrailParticle.png-9d75aaf5504d9ac6785cbc71186e8075.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/FireTrailParticle.png"
dest_files=[ "res://.import/FireTrailParticle.png-9d75aaf5504d9ac6785cbc71186e8075.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

View File

@@ -0,0 +1,13 @@
[gd_resource type="NoiseTexture" load_steps=2 format=2]
[sub_resource type="OpenSimplexNoise" id=1]
octaves = 6
period = 11.8
persistence = 0.52
lacunarity = 1.88
[resource]
width = 64
height = 64
seamless = true
noise = SubResource( 1 )

View File

@@ -0,0 +1,15 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://enemies/red_robot/laser/LaserBodyNoise.tres" type="Texture" id=1]
[ext_resource path="res://enemies/red_robot/laser/LaserShader.shader" type="Shader" id=2]
[resource]
shader = ExtResource( 2 )
shader_param/uv_scale = Vector2( 15, 0.5 )
shader_param/offset_uv_x = 0.0
shader_param/cutoff_value = 1.0
shader_param/traversal_scale = 0.0
shader_param/energy = 1.0
shader_param/clip = 8.305
shader_param/color1 = Color( 1, 0, 0, 1 )
shader_param/laser_body_noise = ExtResource( 1 )

View File

@@ -0,0 +1,42 @@
shader_type spatial;
render_mode cull_disabled;
uniform sampler2D laser_body_noise;
uniform vec2 uv_scale = vec2(5.0, 1.0);
uniform float offset_uv_x = 0.0;
uniform float cutoff_value : hint_range(0.0, 1.0) = 0.6;
uniform float traversal_scale = 1.0;
uniform float energy = 1.0;
uniform float clip = 4.0;
uniform vec4 color1 : hint_color = vec4(0.0, 0.0, 1.0, 1.0);
// Z coordinate of the vertex, in local space.
varying float z_local_coordinates;
void vertex(){
// Because of how the UVs are laid out, the UVs at the right-most place
// are at the end of the beam. We use that to decide wether or not to
// apply the clip distance to the laser.
float should_displace_vertex = step(0.9, UV.x);
// Here we mix between the vertex original position and the clip position
// because we use step, only the ring of vertices at the end will have a
// coefficient of 1.
float original_z = VERTEX.z;
VERTEX.z = mix(VERTEX.z, -clip, should_displace_vertex);
UV.x *= VERTEX.z / original_z;
z_local_coordinates = VERTEX.z;
VERTEX.xy *= traversal_scale;
}
void fragment() {
vec2 transformed_uv = UV * uv_scale;
transformed_uv.x += offset_uv_x;
float noise_val = texture(laser_body_noise, transformed_uv).r; //noise textures are grayscale
ALBEDO = color1.rgb;
if (noise_val < cutoff_value) {
discard;
}
EMISSION = color1.rgb * energy;
}

View File

@@ -0,0 +1,32 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, cull_disabled;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0, 1);
uniform float point_size : hint_range(0, 128);
uniform vec4 emission : hint_color;
uniform float emission_energy;
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
void vertex() {
UV = UV * uv1_scale.xy + uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
EMISSION = ALBEDO.rgb * emission_energy;
ALPHA = albedo.a * albedo_tex.a;
}

View File

@@ -0,0 +1,15 @@
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx, cull_disabled;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float emission_energy;
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
EMISSION = (ALBEDO.rgb)*emission_energy;
// ALPHA = albedo.a * albedo_tex.a;
}

View File

@@ -0,0 +1,8 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/EmissionEmbers.shader" type="Shader" id=1]
[resource]
shader = ExtResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/emission_energy = 3.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/LightRays.png-6ea2289055a4cb601788902fdea82c53.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/impact_effect/LightRays.png"
dest_files=[ "res://.import/LightRays.png-6ea2289055a4cb601788902fdea82c53.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
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
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
[gd_resource type="ArrayMesh" format=2]
[resource]
resource_name = "Plane"
surfaces/0 = {
"aabb": AABB( -0.2, 0, -5, 0.4, 1e-05, 5.00001 ),
"array_data": PoolByteArray( 204, 204, 76, 190, 0, 0, 0, 0, 0, 0, 0, 128, 0, 127, 0, 0, 126, 0, 0, 127, 0, 0, 0, 60, 204, 204, 76, 62, 0, 0, 0, 0, 0, 0, 0, 128, 0, 127, 0, 0, 127, 0, 0, 127, 0, 60, 0, 60, 204, 204, 76, 190, 0, 0, 0, 0, 0, 0, 160, 192, 0, 127, 0, 0, 127, 0, 0, 127, 0, 0, 0, 0, 204, 204, 76, 62, 0, 0, 0, 0, 0, 0, 160, 192, 0, 127, 0, 0, 126, 0, 0, 127, 0, 60, 0, 0 ),
"array_index_data": PoolByteArray( 0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0 ),
"blend_shape_data": [ ],
"format": 97559,
"index_count": 6,
"primitive": 4,
"skeleton_aabb": [ ],
"vertex_count": 4
}

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/Smoke.png-44072f959b45a04332b23b00fed4058c.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/impact_effect/Smoke.png"
dest_files=[ "res://.import/Smoke.png-44072f959b45a04332b23b00fed4058c.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/SmokePuff.png-af2021767790862f90e883c3b7e55925.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/impact_effect/SmokePuff.png"
dest_files=[ "res://.import/SmokePuff.png-af2021767790862f90e883c3b7e55925.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/SmokePuffNormals.png-d34e047e12167b552294acf39f1df449.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/laser/impact_effect/SmokePuffNormals.png"
dest_files=[ "res://.import/SmokePuffNormals.png-d34e047e12167b552294acf39f1df449.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=1
flags/repeat=true
flags/filter=true
flags/mipmaps=true
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

View File

@@ -0,0 +1,12 @@
extends Spatial
onready var light_rays = $LightRays
onready var camera = get_tree().get_root().get_camera()
func _ready():
yield($AnimationPlayer, "animation_finished")
queue_free()
func _process(_delta):
light_rays.look_at(camera.global_transform.origin, Vector3.UP)

View File

@@ -0,0 +1,251 @@
[gd_scene load_steps=26 format=2]
[ext_resource path="res://effects_shared/BlastMesh.mesh" type="ArrayMesh" id=1]
[ext_resource path="res://effects_shared/BlastTexture.png" type="Texture" id=2]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/Plane.tres" type="ArrayMesh" id=3]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/LightRays.png" type="Texture" id=4]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/blast.gd" type="Script" id=5]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/EmissionAlbedoParticle.shader" type="Shader" id=6]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/EmissionEmbers.tres" type="Material" id=8]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/SmokePuffNormals.png" type="Texture" id=10]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/SmokePuff.png" type="Texture" id=11]
[sub_resource type="Animation" id=1]
resource_name = "blast"
tracks/0/type = "value"
tracks/0/path = NodePath("Blast:emitting")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0.2, 0.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("LightRays:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ true, false ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("BlastCenter:emitting")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.3 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("ExplosionEmbers:emitting")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0.2, 0.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
tracks/4/type = "value"
tracks/4/path = NodePath("SmokeParticle:emitting")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0.3, 0.6 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ true, false ]
}
[sub_resource type="SpatialMaterial" id=2]
flags_transparent = true
flags_unshaded = true
vertex_color_use_as_albedo = true
params_billboard_mode = 3
params_billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
albedo_texture = ExtResource( 2 )
[sub_resource type="Curve" id=3]
max_value = 5.0
_data = [ Vector2( 0, 1.2 ), 0.0, 0.0, 0, 0, Vector2( 1, 5 ), 7.54685, 0.0, 0, 0 ]
[sub_resource type="Gradient" id=4]
colors = PoolColorArray( 1, 1, 1, 1, 1, 0, 0, 1 )
[sub_resource type="ShaderMaterial" id=5]
shader = ExtResource( 6 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 1.0
shader_param/point_size = 1.0
shader_param/emission = Color( 1, 1, 1, 1 )
shader_param/emission_energy = 4.0
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/texture_albedo = ExtResource( 4 )
[sub_resource type="Curve" id=6]
bake_resolution = 16
_data = [ Vector2( 0, 0.536364 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="SpatialMaterial" id=7]
albedo_color = Color( 1, 0.211765, 0, 1 )
emission_enabled = true
emission = Color( 0.988235, 0, 0, 1 )
emission_energy = 5.0
emission_operator = 0
emission_on_uv2 = false
rim_enabled = true
rim = 1.0
rim_tint = 0.74
[sub_resource type="SphereMesh" id=8]
[sub_resource type="Curve" id=9]
_data = [ Vector2( 0, 0 ), 0.0, 2.4, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="SphereMesh" id=10]
radius = 0.01
height = 0.1
[sub_resource type="Curve" id=11]
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 0.810606, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Gradient" id=12]
offsets = PoolRealArray( 0, 0.313673, 1 )
colors = PoolColorArray( 1, 1, 1, 1, 1, 0.09009, 0.09009, 1, 0.144531, 0.137756, 0.140773, 1 )
[sub_resource type="SpatialMaterial" id=13]
flags_transparent = true
vertex_color_use_as_albedo = true
params_billboard_mode = 3
params_billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
albedo_texture = ExtResource( 11 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 10 )
[sub_resource type="QuadMesh" id=14]
size = Vector2( 2, 2 )
[sub_resource type="Curve" id=15]
_data = [ Vector2( 0, 0 ), 0.0, 3.25161, 0, 0, Vector2( 1, 1 ), 0.0363636, 0.0363636, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Gradient" id=16]
offsets = PoolRealArray( 0, 0.19571, 0.576407, 1 )
colors = PoolColorArray( 1, 0, 0, 0, 1, 0, 0, 1, 0.09375, 0.09375, 0.09375, 1, 0.105469, 0.105469, 0.105469, 0 )
[node name="Blast" type="Spatial"]
script = ExtResource( 5 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "blast"
anims/blast = SubResource( 1 )
[node name="Blast" type="CPUParticles" parent="."]
material_override = SubResource( 2 )
emitting = false
amount = 1
lifetime = 0.3
one_shot = true
mesh = ExtResource( 1 )
gravity = Vector3( 0, 0, 0 )
scale_amount_curve = SubResource( 3 )
color_ramp = SubResource( 4 )
[node name="LightRays" type="CPUParticles" parent="."]
material_override = SubResource( 5 )
emitting = false
amount = 40
lifetime = 0.2
one_shot = true
explosiveness = 0.9
mesh = ExtResource( 3 )
flag_align_y = true
direction = Vector3( 1, 1, 0 )
spread = 180.0
gravity = Vector3( 0, 0, 0 )
initial_velocity = 0.01
angle = 455.8
angle_random = 0.93
scale_amount = 0.02
scale_amount_random = 0.41
scale_amount_curve = SubResource( 6 )
color = Color( 1, 0.00784314, 0.00784314, 1 )
hue_variation = 0.03
hue_variation_random = 0.78
[node name="BlastCenter" type="CPUParticles" parent="."]
material_override = SubResource( 7 )
emitting = false
amount = 1
lifetime = 0.2
one_shot = true
mesh = SubResource( 8 )
gravity = Vector3( 0, 0, 0 )
scale_amount = 0.5
scale_amount_curve = SubResource( 9 )
[node name="ExplosionEmbers" type="CPUParticles" parent="."]
material_override = ExtResource( 8 )
emitting = false
amount = 50
one_shot = true
explosiveness = 0.9
mesh = SubResource( 10 )
flag_align_y = true
direction = Vector3( 0, 1, 0 )
spread = 90.0
gravity = Vector3( 0, -2, 0 )
initial_velocity = 7.0
damping = 1.0
scale_amount_curve = SubResource( 11 )
color_ramp = SubResource( 12 )
[node name="SmokeParticle" type="CPUParticles" parent="."]
material_override = SubResource( 13 )
emitting = false
amount = 20
one_shot = true
explosiveness = 0.92
mesh = SubResource( 14 )
emission_shape = 1
emission_sphere_radius = 1.0
direction = Vector3( 0, 1, 0 )
spread = 90.0
gravity = Vector3( 0, 2, 0 )
initial_velocity = 1.0
initial_velocity_random = 1.0
linear_accel = -0.3
damping = 0.98
angle = 458.9
angle_random = 0.94
scale_amount = 3.0
scale_amount_random = 1.0
scale_amount_curve = SubResource( 15 )
color_ramp = SubResource( 16 )

Binary file not shown.

View File

@@ -0,0 +1,136 @@
[gd_resource type="SpatialMaterial" load_steps=7 format=2]
[ext_resource path="res://enemies/red_robot/textures/red_robot_emission.png" type="Texture" id=1]
[ext_resource path="res://enemies/red_robot/textures/red_robot_normal.png" type="Texture" id=2]
[ext_resource path="res://enemies/red_robot/textures/red_robot_orm.png" type="Texture" id=3]
[ext_resource path="res://enemies/red_robot/textures/red_robot_albedo.png" type="Texture" id=4]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode cull_disabled;
uniform float grow_factor = 0.05;
uniform vec4 electricity_color:hint_color = vec4(0.0,1.0,1.0,1.0);
uniform float emission_energy = 1.0;
uniform float speed_scale = 0.2;
uniform float emission_cutout = 0.0;
varying vec3 vertex_local_coords;
varying vec3 vert_random;
// CODE FROM Nikita Miropolskiy
// https://www.shadertoy.com/view/XsX3zB
vec3 random3(vec3 c) {
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
vec3 r;
r.z = fract(512.0*j);
j *= .125;
r.x = fract(512.0*j);
j *= .125;
r.y = fract(512.0*j);
return r-0.5;
}
/* skew constants for 3d simplex functions */
const float F3 = 0.3333333;
const float G3 = 0.1666667;
/* 3d simplex noise */
float simplex3d(vec3 p) {
/* 1. find current tetrahedron T and it's four vertices */
/* s, s+i1, s+i2, s+1.0 - absolute skewed (integer) coordinates of T vertices */
/* x, x1, x2, x3 - unskewed coordinates of p relative to each of T vertices*/
/* calculate s and x */
vec3 s = floor(p + dot(p, vec3(F3)));
vec3 x = p - s + dot(s, vec3(G3));
/* calculate i1 and i2 */
vec3 e = step(vec3(0.0), x - x.yzx);
vec3 i1 = e*(1.0 - e.zxy);
vec3 i2 = 1.0 - e.zxy*(1.0 - e);
/* x1, x2, x3 */
vec3 x1 = x - i1 + G3;
vec3 x2 = x - i2 + 2.0*G3;
vec3 x3 = x - 1.0 + 3.0*G3;
/* 2. find four surflets and store them in d */
vec4 w, d;
/* calculate surflet weights */
w.x = dot(x, x);
w.y = dot(x1, x1);
w.z = dot(x2, x2);
w.w = dot(x3, x3);
/* w fades from 0.6 at the center of the surflet to 0.0 at the margin */
w = max(0.6 - w, 0.0);
/* calculate surflet components */
d.x = dot(random3(s), x);
d.y = dot(random3(s + i1), x1);
d.z = dot(random3(s + i2), x2);
d.w = dot(random3(s + 1.0), x3);
/* multiply d by w^4 */
w *= w;
w *= w;
d *= w;
/* 3. return the sum of the four surflets */
return dot(d, vec4(52.0));
}
// END OF CODE FROM Nikita Miropolskiy
void vertex(){
VERTEX += NORMAL * grow_factor;
vertex_local_coords = VERTEX;
vert_random = random3(VERTEX);
}
void fragment(){
float noise1 = simplex3d(vertex_local_coords + vec3(0.0,TIME * speed_scale,0.0) + vert_random);
float noise2 = simplex3d(vertex_local_coords * 0.6 + vec3(0.0,-TIME * speed_scale,0.0));
// we take the intersection of the 2 noises by multiplying them
// and max it between 0.0 and 0.001 using smoothstep
ALPHA = 1.0 - smoothstep(0.002, 0.005 + emission_cutout, abs(noise1*noise2));
ALPHA *= noise2 + emission_cutout;
ALPHA = max(0.0, ALPHA) ;
ALBEDO = electricity_color.rgb;
EMISSION = ALBEDO * (emission_energy + emission_cutout * emission_energy) ;
// ALPHA = noise2 * noise1;
}"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/grow_factor = 0.01
shader_param/electricity_color = Color( 0, 1, 1, 1 )
shader_param/emission_energy = 1.0
shader_param/speed_scale = 0.3
shader_param/emission_cutout = 0.0
[resource]
resource_name = "EvilRobo"
next_pass = SubResource( 2 )
albedo_texture = ExtResource( 4 )
metallic = 0.5
metallic_texture = ExtResource( 3 )
metallic_texture_channel = 2
roughness_texture = ExtResource( 3 )
roughness_texture_channel = 1
emission_enabled = true
emission = Color( 0, 0, 0, 1 )
emission_energy = 4.0
emission_operator = 0
emission_on_uv2 = false
emission_texture = ExtResource( 1 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 2 )
ao_enabled = true
ao_light_affect = 0.0
ao_texture = ExtResource( 3 )
ao_on_uv2 = false
ao_texture_channel = 0

View File

@@ -0,0 +1,42 @@
extends RigidBody
var puff_effect = preload("res://enemies/red_robot/parts/part_disappear_effect/part_disappear.tscn")
export(float) var lifetime = 3.0
export(float) var lifetime_random = 3.0
export(float) var disappearing_time = 0.5
var _lifetime
var _disappearing_counter = 0.0
var _is_disappearing = false
var _mat
onready var _mesh = $Model.get_child(0)
func _ready():
_mat = _mesh.mesh.surface_get_material(0).duplicate()
_mesh.mesh.surface_set_material(0, _mat)
_mat.next_pass = _mat.next_pass.duplicate()
randomize()
_lifetime = lifetime + lifetime_random * randf()
func start_disappear_countdown():
yield(get_tree().create_timer(_lifetime), "timeout")
_is_disappearing = true
func _process(delta):
if not _is_disappearing:
return
var curve_val = pow(_disappearing_counter / disappearing_time, 2.0)
_mat.next_pass.set_shader_param("emission_cutout", curve_val)
_disappearing_counter += delta
if _disappearing_counter >= disappearing_time - 0.2:
var puff = puff_effect.instance()
get_parent().add_child(puff)
puff.global_transform.origin = global_transform.origin
_is_disappearing = false
yield(get_tree().create_timer(0.2), "timeout")
queue_free()

View File

@@ -0,0 +1,9 @@
extends CPUParticles
func _ready():
$MiniBlasts.emitting = true
yield(get_tree().create_timer(0.2), "timeout")
emitting = true
yield(get_tree().create_timer(lifetime * 2.0), "timeout")
queue_free()

View File

@@ -0,0 +1,75 @@
[gd_scene load_steps=11 format=2]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/SmokePuff.png" type="Texture" id=1]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/SmokePuffNormals.png" type="Texture" id=2]
[ext_resource path="res://enemies/red_robot/parts/part_disappear_effect/part_disappear.gd" type="Script" id=3]
[sub_resource type="SpatialMaterial" id=1]
flags_transparent = true
vertex_color_use_as_albedo = true
params_billboard_mode = 3
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
albedo_texture = ExtResource( 1 )
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 2 )
[sub_resource type="QuadMesh" id=2]
size = Vector2( 2, 2 )
[sub_resource type="Curve" id=3]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.384416, 1 ), 0.0777782, 0.0, 0, 0 ]
[sub_resource type="Gradient" id=4]
offsets = PoolRealArray( 0, 0.138122, 0.60221, 0.90884 )
colors = PoolColorArray( 0, 1, 1, 0, 0, 1, 1, 1, 0.164062, 0.154449, 0.154449, 1, 0.211765, 0.211765, 0.211765, 0 )
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0, 0, 0, 1 )
emission_enabled = true
emission = Color( 0, 1, 1, 1 )
emission_energy = 3.0
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="SphereMesh" id=6]
radius = 0.2
height = 0.4
[sub_resource type="Curve" id=7]
_data = [ Vector2( 0, 0 ), 0.0, 0.37234, 0, 0, Vector2( 0.462338, 0.981818 ), 5.18966, -5.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[node name="PartDisappearPuff" type="CPUParticles"]
material_override = SubResource( 1 )
emitting = false
lifetime = 1.5
one_shot = true
explosiveness = 0.76
lifetime_randomness = 0.54
draw_order = 2
mesh = SubResource( 2 )
emission_shape = 1
emission_sphere_radius = 0.3
direction = Vector3( 0, 1, 0 )
gravity = Vector3( 0, 2, 0 )
angle = 661.8
angle_random = 1.0
scale_amount = 1.2
scale_amount_random = 1.0
scale_amount_curve = SubResource( 3 )
color_ramp = SubResource( 4 )
script = ExtResource( 3 )
[node name="MiniBlasts" type="CPUParticles" parent="."]
material_override = SubResource( 5 )
emitting = false
amount = 16
lifetime = 0.3
one_shot = true
mesh = SubResource( 6 )
emission_shape = 1
emission_sphere_radius = 0.5
gravity = Vector3( 0, 0, 0 )
scale_amount_curve = SubResource( 7 )

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
[remap]
importer="wavefront_obj"
type="Mesh"
path="res://.import/part_head.obj-7a8f612f76d91bb53e5cdc56fcf4ec21.mesh"
[deps]
files=[ "res://.import/part_head.obj-7a8f612f76d91bb53e5cdc56fcf4ec21.mesh" ]
source_file="res://enemies/red_robot/parts/part_head.obj"
dest_files=[ "res://.import/part_head.obj-7a8f612f76d91bb53e5cdc56fcf4ec21.mesh", "res://.import/part_head.obj-7a8f612f76d91bb53e5cdc56fcf4ec21.mesh" ]
[params]
generate_tangents=true
scale_mesh=Vector3( 1, 1, 1 )
offset_mesh=Vector3( 0, 0, 0 )
optimize_mesh=true

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
[remap]
importer="wavefront_obj"
type="Mesh"
path="res://.import/part_shield.obj-07d793efa6fca4b858eb8d474676f56b.mesh"
[deps]
files=[ "res://.import/part_shield.obj-07d793efa6fca4b858eb8d474676f56b.mesh" ]
source_file="res://enemies/red_robot/parts/part_shield.obj"
dest_files=[ "res://.import/part_shield.obj-07d793efa6fca4b858eb8d474676f56b.mesh", "res://.import/part_shield.obj-07d793efa6fca4b858eb8d474676f56b.mesh" ]
[params]
generate_tangents=true
scale_mesh=Vector3( 1, 1, 1 )
offset_mesh=Vector3( 0, 0, 0 )
optimize_mesh=true

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
[remap]
importer="wavefront_obj"
type="Mesh"
path="res://.import/ray.obj-5128ee1dbe69c47b0f2bbd81cf95917e.mesh"
[deps]
files=[ "res://.import/ray.obj-5128ee1dbe69c47b0f2bbd81cf95917e.mesh" ]
source_file="res://enemies/red_robot/parts/ray.obj"
dest_files=[ "res://.import/ray.obj-5128ee1dbe69c47b0f2bbd81cf95917e.mesh", "res://.import/ray.obj-5128ee1dbe69c47b0f2bbd81cf95917e.mesh" ]
[params]
generate_tangents=true
scale_mesh=Vector3( 1, 1, 1 )
offset_mesh=Vector3( 0, 0, 0 )
optimize_mesh=false

View File

@@ -1,5 +1,5 @@
shader_type spatial;
render_mode unshaded,cull_disabled;
render_mode unshaded, cull_disabled;
uniform sampler2D ray_texture : hint_albedo;
uniform sampler2D smoke_texture : hint_albedo;
@@ -13,9 +13,9 @@ varying float dist;
void vertex() {
float deform_amount = 0.01 * deform;
vec2 offset = vec2(sin(VERTEX.z*1.4321),sin(VERTEX.z*2.12351));
VERTEX.xy+=deform_amount * offset;
VERTEX.xy*=1.0+deform;
vec2 offset = vec2(sin(VERTEX.z * 1.4321), sin(VERTEX.z * 2.12351));
VERTEX.xy += deform_amount * offset;
VERTEX.xy *= 1.0 + deform;
dist = abs(VERTEX.z);
}

View File

@@ -0,0 +1,9 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://enemies/red_robot/parts/sparks_effect/SparkTexture.png" type="Texture" id=1]
[ext_resource path="res://enemies/red_robot/parts/sparks_effect/SparkShader.shader" type="Shader" id=2]
[resource]
shader = ExtResource( 2 )
shader_param/emission_factor = 3.0
shader_param/alpha_texture = ExtResource( 1 )

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,22 @@
shader_type spatial;
uniform sampler2D alpha_texture;
uniform float emission_factor = 3.0;
varying float lifetime_percent;
varying float id;
void vertex() {
id = float(INSTANCE_ID);
lifetime_percent = INSTANCE_CUSTOM.y;
}
void fragment() {
float alpha_from_texture = texture(alpha_texture, UV).r;
float alpha_travel_factor = (UV.y + lifetime_percent + id) * 3.14;
ALPHA = sin(alpha_travel_factor * 3.0) * sign(sin(alpha_travel_factor * 0.1)) * COLOR.a * alpha_from_texture;
ALPHA = sin(alpha_travel_factor * 3.0) * sign(sin(alpha_travel_factor * 0.1)) * COLOR.a * alpha_from_texture;
ALPHA = max(ALPHA, 0.0);
ALBEDO = COLOR.rgb;
EMISSION = ALBEDO * emission_factor;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/SparkTexture.png-415eb9635d794f1148d998613e1e2ac9.s3tc.stex"
metadata={
"imported_formats": [ "s3tc" ],
"vram_texture": true
}
[deps]
source_file="res://enemies/red_robot/parts/sparks_effect/SparkTexture.png"
dest_files=[ "res://.import/SparkTexture.png-415eb9635d794f1148d998613e1e2ac9.s3tc.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
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

View File

@@ -27,27 +27,33 @@ var player = null
var velocity = Vector3()
var orientation = Transform()
var blast_scene = preload("res://enemies/red_robot/laser/impact_effect/impact_effect.tscn")
onready var animation_tree = $AnimationTree
onready var shoot_animation = $ShootAnimation
onready var model = $RedRobotModel
onready var ray_from = model.get_node(@"Armature/Skeleton/RayFrom")
onready var ray_mesh = ray_from.get_node(@"RayMesh")
onready var explosion_particles = ray_from.get_node(@"ExplosionParticles")
onready var laser_raycast = ray_from.get_node(@"RayCast")
onready var collision_shape = $CollisionShape
onready var explosion_sound = $SoundEffects/Explosion
onready var hit_sound = $SoundEffects/Hit
onready var death = $Death
onready var shield1 = death.get_node(@"PartShield1")
onready var shield2 = death.get_node(@"PartShield2")
onready var shield3 = death.get_node(@"PartShield3")
onready var death_shield1 = death.get_node(@"PartShield1")
onready var death_shield2 = death.get_node(@"PartShield2")
onready var death_head = death.get_node(@"PartHead")
onready var death_detach_spark1 = death.get_node(@"DetachSpark1")
onready var death_detach_spark2 = death.get_node(@"DetachSpark2")
onready var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") * ProjectSettings.get_setting("physics/3d/default_gravity_vector")
func _ready():
orientation = global_transform
orientation.origin = Vector3()
$AnimationTree.active = true
func resume_approach():
@@ -66,28 +72,34 @@ func hit():
dead = true
var base_xf = global_transform.basis
animation_tree.active = false
#$Death/Explosion.play("kaboom")
model.visible = false
death.visible = true
$CollisionShape.disabled = true
death.get_node(@"Particles").emitting = true
collision_shape.disabled = true
shield1.get_node(@"Col1").disabled = false
shield1.get_node(@"Col2").disabled = false
shield1.mode = RigidBody.MODE_RIGID
shield2.get_node(@"Col1").disabled = false
shield2.get_node(@"Col2").disabled = false
shield2.mode = RigidBody.MODE_RIGID
shield3.get_node(@"Col1").disabled = false
shield3.get_node(@"Col2").disabled = false
shield3.mode = RigidBody.MODE_RIGID
death_shield1.get_node(@"Col1").disabled = false
death_shield1.get_node(@"Col2").disabled = false
death_shield1.mode = RigidBody.MODE_RIGID
death_shield2.get_node(@"Col1").disabled = false
death_shield2.get_node(@"Col2").disabled = false
death_shield2.mode = RigidBody.MODE_RIGID
death_head.get_node(@"Col1").disabled = false
death_head.get_node(@"Col2").disabled = false
death_head.mode = RigidBody.MODE_RIGID
death_detach_spark1.emitting = true
death_detach_spark2.emitting = true
death_shield1.linear_velocity = 3 * (Vector3.UP - base_xf.x).normalized()
death_shield2.linear_velocity = 3 * (Vector3.UP + base_xf.x).normalized()
death_head.linear_velocity = 3 * (Vector3.UP).normalized()
death_shield1.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
death_shield2.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
death_head.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
death_shield1.start_disappear_countdown()
death_shield2.start_disappear_countdown()
death_head.start_disappear_countdown()
shield2.linear_velocity = 3 * (Vector3.UP + base_xf.x).normalized()
shield3.linear_velocity = 3 * (Vector3.UP).normalized()
shield1.linear_velocity = 3 * (Vector3.UP - base_xf.x).normalized()
shield2.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
shield1.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
shield3.angular_velocity = (Vector3(randf(), randf(), randf()).normalized() * 2 - Vector3.ONE) * 10
explosion_sound.play()
@@ -103,9 +115,19 @@ func shoot():
if col.collider == player:
pass # Kill.
# Clip ray in shader.
ray_mesh.get_surface_material(0).set_shader_param("clip", max_dist)
# Position explosion.
explosion_particles.transform.origin.z = -max_dist
_clip_ray(max_dist)
# Position laser ember particles
var mesh_offset = ray_mesh.translation.z
var laser_ember = $RedRobotModel/Armature/Skeleton/RayFrom/LaserEmber
laser_ember.translation = Vector3(0.0, 0.0, -max_dist / 2.0 - mesh_offset)
laser_ember.emission_box_extents.z = (max_dist - abs(mesh_offset)) / 2.0
if not col.empty():
var blast = blast_scene.instance()
get_tree().get_root().add_child(blast)
blast.global_transform.origin = col.position
if col.collider == player:
yield(get_tree().create_timer(0.1), "timeout")
player.add_camera_shake_trauma(13)
func _physics_process(delta):
@@ -154,6 +176,10 @@ func _physics_process(delta):
shoot_countdown = SHOOT_WAIT
elif state == State.AIM or state == State.SHOOTING:
var max_dist = 1000
if laser_raycast.is_colliding():
max_dist = (ray_from.global_transform.origin - laser_raycast.get_collision_point()).length()
_clip_ray(max_dist)
if aim_preparing < AIM_PREPARE_TIME:
aim_preparing += delta
if aim_preparing > AIM_PREPARE_TIME:
@@ -168,6 +194,7 @@ func _physics_process(delta):
if not col.empty() and col.collider == player:
state = State.SHOOTING
shoot_animation.play("shoot")
shoot_countdown = SHOOT_WAIT
else:
resume_approach()
@@ -205,10 +232,14 @@ func shoot_check():
test_shoot = true
func _clip_ray(length):
var mesh_offset = ray_mesh.translation.z
ray_mesh.get_surface_material(0).set_shader_param("clip", length + mesh_offset)
func _on_area_body_entered(body):
if body is preload("res://player/player.gd"):
player = body
shoot_countdown = SHOOT_WAIT
func _on_area_body_exited(body):

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@ var hit = false
onready var animation_player = $AnimationPlayer
onready var collision_shape = $CollisionShape
func _process(delta):
func _physics_process(delta):
if hit:
return
time_alive -= delta

View File

@@ -1,11 +1,10 @@
[gd_scene load_steps=62 format=2]
[gd_scene load_steps=63 format=2]
[ext_resource path="res://player/bullet/bullet.gd" type="Script" id=1]
[ext_resource path="res://player/bullet/effect/BlastMesh.tres" type="ArrayMesh" id=2]
[ext_resource path="res://effects_shared/BlastMesh.mesh" type="ArrayMesh" id=2]
[ext_resource path="res://player/bullet/bullet_explode.wav" type="AudioStream" id=3]
[ext_resource path="res://player/bullet/effect/BlastMaterial.tres" type="Material" id=4]
[ext_resource path="res://player/bullet/effect/light_rays_material.tres" type="Material" id=5]
[ext_resource path="res://player/bullet/effect/Plane.tres" type="ArrayMesh" id=6]
[ext_resource path="res://player/bullet/blue_myst.png" type="Texture" id=8]
[ext_resource path="res://player/bullet/bullet_material.tres" type="Material" id=9]
@@ -210,7 +209,10 @@ scale = 0.8
scale_curve = SubResource( 12 )
color_ramp = SubResource( 10 )
[sub_resource type="Shader" id=14]
[sub_resource type="QuadMesh" id=14]
size = Vector2( 2, 2 )
[sub_resource type="Shader" id=15]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_alpha_prepass,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
@@ -228,42 +230,42 @@ void fragment() {
}
"
[sub_resource type="ShaderMaterial" id=15]
shader = SubResource( 14 )
[sub_resource type="ShaderMaterial" id=16]
shader = SubResource( 15 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/point_size = 1.0
shader_param/emission_energy = 7.34
[sub_resource type="Gradient" id=16]
[sub_resource type="Gradient" id=17]
offsets = PoolRealArray( 0, 0.237037, 0.859259 )
colors = PoolColorArray( 1, 1, 1, 1, 0, 0.972656, 0.972656, 0.967582, 0.0107751, 0.00360107, 0.921875, 0.478431 )
[sub_resource type="GradientTexture" id=17]
gradient = SubResource( 16 )
[sub_resource type="GradientTexture" id=18]
gradient = SubResource( 17 )
width = 128
[sub_resource type="Curve" id=18]
[sub_resource type="Curve" id=19]
_data = [ Vector2( 0, 1 ), 0.0, -1.96199e-07, 0, 0, Vector2( 0.848101, 0.781818 ), -1.30578, -1.30578, 0, 0, Vector2( 1, 0.0090909 ), -0.0813035, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=19]
[sub_resource type="CurveTexture" id=20]
width = 128
curve = SubResource( 18 )
curve = SubResource( 19 )
[sub_resource type="ParticlesMaterial" id=20]
[sub_resource type="ParticlesMaterial" id=21]
flag_align_y = true
direction = Vector3( 0, 1, 0 )
spread = 151.58
gravity = Vector3( 0, 0, 0 )
initial_velocity = 12.0
damping = 31.5
scale_curve = SubResource( 19 )
color_ramp = SubResource( 17 )
scale_curve = SubResource( 20 )
color_ramp = SubResource( 18 )
[sub_resource type="SphereMesh" id=21]
[sub_resource type="SphereMesh" id=22]
radius = 0.03
height = 0.06
[sub_resource type="SpatialMaterial" id=22]
[sub_resource type="SpatialMaterial" id=23]
flags_transparent = true
vertex_color_use_as_albedo = true
params_cull_mode = 2
@@ -276,42 +278,45 @@ particles_anim_loop = false
albedo_color = Color( 0.701961, 0.701961, 0.701961, 0.560784 )
albedo_texture = ExtResource( 8 )
[sub_resource type="Curve" id=23]
[sub_resource type="Curve" id=24]
min_value = -1.0
_data = [ Vector2( 0, 0.890909 ), 0.0, 0.0, 0, 0, Vector2( 1, -0.0545454 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=24]
[sub_resource type="CurveTexture" id=25]
width = 128
curve = SubResource( 23 )
curve = SubResource( 24 )
[sub_resource type="Gradient" id=25]
[sub_resource type="Gradient" id=26]
offsets = PoolRealArray( 0, 0.918519 )
colors = PoolColorArray( 1, 1, 1, 0.8, 0, 0.309753, 0.792969, 0.0196078 )
[sub_resource type="GradientTexture" id=26]
gradient = SubResource( 25 )
[sub_resource type="GradientTexture" id=27]
gradient = SubResource( 26 )
width = 128
[sub_resource type="Curve" id=27]
[sub_resource type="Curve" id=28]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.14557, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), -3.50114, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=28]
[sub_resource type="CurveTexture" id=29]
width = 128
curve = SubResource( 27 )
curve = SubResource( 28 )
[sub_resource type="ParticlesMaterial" id=29]
[sub_resource type="ParticlesMaterial" id=30]
emission_shape = 1
emission_sphere_radius = 0.4
gravity = Vector3( 0, 2, 0 )
angular_velocity = 82.76
angular_velocity_random = 0.53
angular_velocity_curve = SubResource( 24 )
angular_velocity_curve = SubResource( 25 )
angle = -248.2
angle_random = 0.44
scale_curve = SubResource( 28 )
color_ramp = SubResource( 26 )
scale_curve = SubResource( 29 )
color_ramp = SubResource( 27 )
[sub_resource type="SpatialMaterial" id=30]
[sub_resource type="QuadMesh" id=31]
size = Vector2( 2, 2 )
[sub_resource type="SpatialMaterial" id=32]
albedo_color = Color( 0.00784314, 0.988235, 0.988235, 1 )
emission_enabled = true
emission = Color( 0, 0.486275, 1, 1 )
@@ -319,22 +324,22 @@ emission_energy = 4.0
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="Curve" id=31]
[sub_resource type="Curve" id=33]
min_value = -1.0
_data = [ Vector2( 0, 0.0181819 ), 0.0, 0.0, 0, 0, Vector2( 1, -0.745454 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=32]
width = 128
curve = SubResource( 31 )
[sub_resource type="Curve" id=33]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.746835, 1 ), 2.15455, -3.73455, 0, 1, Vector2( 1, 0.0545454 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=34]
width = 128
curve = SubResource( 33 )
[sub_resource type="ParticlesMaterial" id=35]
[sub_resource type="Curve" id=35]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.746835, 1 ), 2.15455, -3.73455, 0, 1, Vector2( 1, 0.0545454 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=36]
width = 128
curve = SubResource( 35 )
[sub_resource type="ParticlesMaterial" id=37]
emission_shape = 1
emission_sphere_radius = 0.3
direction = Vector3( 0, 1, 0 )
@@ -342,53 +347,53 @@ spread = 180.0
gravity = Vector3( 0, 3, 0 )
initial_velocity = 0.3
radial_accel = 1.0
radial_accel_curve = SubResource( 32 )
radial_accel_curve = SubResource( 34 )
scale = 1.5
scale_random = 1.0
scale_curve = SubResource( 34 )
scale_curve = SubResource( 36 )
[sub_resource type="SphereMesh" id=36]
[sub_resource type="SphereMesh" id=38]
radius = 0.05
height = 0.1
radial_segments = 4
rings = 4
[sub_resource type="Curve" id=37]
[sub_resource type="Curve" id=39]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.379747, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=38]
[sub_resource type="CurveTexture" id=40]
width = 128
curve = SubResource( 37 )
curve = SubResource( 39 )
[sub_resource type="ParticlesMaterial" id=39]
[sub_resource type="ParticlesMaterial" id=41]
gravity = Vector3( 0, 0, 0 )
scale_curve = SubResource( 38 )
scale_curve = SubResource( 40 )
[sub_resource type="SphereMesh" id=40]
[sub_resource type="SphereMesh" id=42]
radius = 0.3
height = 0.6
[sub_resource type="Gradient" id=41]
[sub_resource type="Gradient" id=43]
colors = PoolColorArray( 1, 1, 1, 1, 1, 1, 1, 0 )
[sub_resource type="GradientTexture" id=42]
gradient = SubResource( 41 )
[sub_resource type="GradientTexture" id=44]
gradient = SubResource( 43 )
[sub_resource type="Curve" id=43]
[sub_resource type="Curve" id=45]
max_value = 4.0
_data = [ Vector2( 0.150987, 4 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.6936 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=44]
curve = SubResource( 43 )
[sub_resource type="CurveTexture" id=46]
curve = SubResource( 45 )
[sub_resource type="ParticlesMaterial" id=45]
[sub_resource type="ParticlesMaterial" id=47]
spread = 180.0
gravity = Vector3( 0, -1, 0 )
scale = 0.3
scale_curve = SubResource( 44 )
color_ramp = SubResource( 42 )
scale_curve = SubResource( 46 )
color_ramp = SubResource( 44 )
[sub_resource type="SpatialMaterial" id=46]
[sub_resource type="SpatialMaterial" id=48]
flags_transparent = true
vertex_color_use_as_albedo = true
vertex_color_is_srgb = true
@@ -399,28 +404,28 @@ emission_energy = 2.0
emission_operator = 0
emission_on_uv2 = false
[sub_resource type="SphereMesh" id=47]
material = SubResource( 46 )
[sub_resource type="SphereMesh" id=49]
material = SubResource( 48 )
radius = 0.1
height = 0.2
radial_segments = 5
rings = 3
[sub_resource type="Gradient" id=48]
[sub_resource type="Gradient" id=50]
colors = PoolColorArray( 1, 1, 1, 1, 0, 0.0313726, 0.501961, 0.752941 )
[sub_resource type="GradientTexture" id=49]
gradient = SubResource( 48 )
[sub_resource type="GradientTexture" id=51]
gradient = SubResource( 50 )
width = 128
[sub_resource type="Curve" id=50]
[sub_resource type="Curve" id=52]
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.417722, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=51]
[sub_resource type="CurveTexture" id=53]
width = 128
curve = SubResource( 50 )
curve = SubResource( 52 )
[sub_resource type="ParticlesMaterial" id=52]
[sub_resource type="ParticlesMaterial" id=54]
emission_shape = 1
emission_sphere_radius = 0.1
flag_align_y = true
@@ -430,10 +435,10 @@ gravity = Vector3( 0, 0, 0 )
initial_velocity = 9.0
damping = 9.0
scale = 0.3
scale_curve = SubResource( 51 )
color_ramp = SubResource( 49 )
scale_curve = SubResource( 53 )
color_ramp = SubResource( 51 )
[sub_resource type="SphereMesh" id=53]
[sub_resource type="SphereMesh" id=55]
radius = 0.05
height = 0.3
radial_segments = 4
@@ -487,37 +492,37 @@ amount = 1
lifetime = 0.15
one_shot = true
process_material = SubResource( 13 )
draw_pass_1 = ExtResource( 6 )
draw_pass_1 = SubResource( 14 )
[node name="BlastSparks" type="Particles" parent="Blast"]
material_override = SubResource( 15 )
material_override = SubResource( 16 )
emitting = false
amount = 10
lifetime = 0.3
one_shot = true
explosiveness = 0.92
process_material = SubResource( 20 )
draw_pass_1 = SubResource( 21 )
process_material = SubResource( 21 )
draw_pass_1 = SubResource( 22 )
[node name="Smoke" type="Particles" parent="Blast"]
material_override = SubResource( 22 )
material_override = SubResource( 23 )
emitting = false
amount = 5
lifetime = 1.5
one_shot = true
explosiveness = 1.0
process_material = SubResource( 29 )
draw_pass_1 = ExtResource( 6 )
process_material = SubResource( 30 )
draw_pass_1 = SubResource( 31 )
[node name="LightParticle" type="Particles" parent="Blast"]
material_override = SubResource( 30 )
material_override = SubResource( 32 )
emitting = false
amount = 3
lifetime = 0.8
one_shot = true
explosiveness = 0.84
process_material = SubResource( 35 )
draw_pass_1 = SubResource( 36 )
process_material = SubResource( 37 )
draw_pass_1 = SubResource( 38 )
[node name="InnerBlastLight" type="Particles" parent="Blast"]
material_override = ExtResource( 9 )
@@ -525,8 +530,8 @@ emitting = false
amount = 1
lifetime = 0.2
one_shot = true
process_material = SubResource( 39 )
draw_pass_1 = SubResource( 40 )
process_material = SubResource( 41 )
draw_pass_1 = SubResource( 42 )
[node name="MeshInstance2" type="MeshInstance" parent="."]
visible = false
@@ -541,12 +546,12 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00988865, 0, 0 )
amount = 100
lifetime = 0.1
local_coords = false
process_material = SubResource( 45 )
draw_pass_1 = SubResource( 47 )
process_material = SubResource( 47 )
draw_pass_1 = SubResource( 49 )
[node name="Trail" type="Particles" parent="BulletBody"]
material_override = ExtResource( 9 )
amount = 10
local_coords = false
process_material = SubResource( 52 )
draw_pass_1 = SubResource( 53 )
process_material = SubResource( 54 )
draw_pass_1 = SubResource( 55 )

View File

@@ -1,6 +1,6 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://player/bullet/effect/BlastTexture.png" type="Texture" id=1]
[ext_resource path="res://effects_shared/BlastTexture.png" type="Texture" id=1]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;

File diff suppressed because one or more lines are too long

View File

@@ -1,15 +0,0 @@
[gd_resource type="ArrayMesh" format=2]
[resource]
resource_name = "Plane"
surfaces/0 = {
"aabb": AABB( -1, -1, 0, 2, 2, 1e-05 ),
"array_data": PoolByteArray( 255, 255, 127, 191, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, 127, 0, 126, 0, 0, 127, 0, 0, 0, 60, 255, 255, 127, 63, 0, 0, 128, 191, 0, 0, 0, 128, 0, 0, 127, 0, 127, 0, 0, 127, 0, 60, 0, 60, 255, 255, 127, 191, 0, 0, 128, 63, 0, 0, 0, 128, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 0, 255, 255, 127, 63, 0, 0, 128, 63, 0, 0, 0, 128, 0, 0, 127, 0, 126, 0, 0, 127, 0, 60, 0, 0 ),
"array_index_data": PoolByteArray( 0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 3, 0 ),
"blend_shape_data": [ ],
"format": 97559,
"index_count": 6,
"primitive": 4,
"skeleton_aabb": [ ],
"vertex_count": 4
}

View File

@@ -6,7 +6,7 @@ const DECAY_RATE = 1.5
const MAX_YAW = 0.05
const MAX_PITCH = 0.05
const MAX_ROLL = 0.1
const MAX_TRAUMA = 0.6
const MAX_TRAUMA = 1.2
# Default values.
var start_rotation = rotation

View File

@@ -219,3 +219,7 @@ func rotate_camera(move):
camera_x_rot += move.y
camera_x_rot = clamp(camera_x_rot, deg2rad(CAMERA_X_ROT_MIN), deg2rad(CAMERA_X_ROT_MAX))
camera_rot.rotation.x = camera_x_rot
func add_camera_shake_trauma(amount):
camera_camera.add_trauma(amount)

View File

@@ -270,11 +270,8 @@ script = ExtResource( 1 )
[node name="Robot_Skeleton" parent="PlayerModel" index="0"]
transform = Transform( 0.803991, 0, 0, 0, 0.803991, 0, 0, 0, 0.803991, 0, 0, 0 )
[node name="Skeleton" parent="PlayerModel/Robot_Skeleton" index="0"]
bones/46/bound_children = [ NodePath("GunBone") ]
[node name="GunBone" type="BoneAttachment" parent="PlayerModel/Robot_Skeleton/Skeleton" index="5"]
transform = Transform( 0.910445, -0.245469, 0.333205, -0.249845, -0.967833, -0.0306525, 0.330045, -0.0553138, -0.942356, -0.207136, 1.37525, 0.51601 )
transform = Transform( 0.897421, -0.247601, 0.365395, -0.262988, -0.964798, -0.00816901, 0.354591, -0.0887302, -0.930816, -0.207098, 1.36135, 0.549705 )
bone_name = "hand.R"
[node name="ShootFrom" type="Position3D" parent="PlayerModel/Robot_Skeleton/Skeleton/GunBone"]