feat: enemy orb vfx

This commit is contained in:
Sara Gerretsen 2026-06-22 14:29:54 +02:00
parent de529b9822
commit b5848396ef
21 changed files with 311 additions and 7 deletions

View file

@ -12,6 +12,9 @@ void EnemyOrb::_bind_methods() {
void EnemyOrb::process() {
if (this->player) {
this->look_at(this->player->get_global_position());
if (this->indicator) {
this->indicator->set_scale(Vector3(1, 1, this->player->get_global_position().distance_to(get_global_position())));
}
}
}
@ -38,6 +41,10 @@ void EnemyOrb::body_entered(Node3D *body) {
this->shoot_timer_running = true;
}
set_process(true);
if (this->indicator) {
this->indicator->set_visible(true);
this->indicator->set_scale(Vector3(1, 1, this->player->get_global_position().distance_to(get_global_position())));
}
}
}
@ -45,6 +52,9 @@ void EnemyOrb::body_exited(Node3D *body) {
if (this->player == body) {
this->player = nullptr;
set_process(false);
if (this->indicator) {
this->indicator->set_visible(false);
}
}
}
@ -56,12 +66,15 @@ void EnemyOrb::_notification(int what) {
default:
return;
case NOTIFICATION_READY:
if ((this->detection_area = cast_to<Area3D>(get_node(NodePath("AwarenessArea"))))) {
if (has_node(NodePath("AwarenessArea")) && (this->detection_area = cast_to<Area3D>(get_node(NodePath("AwarenessArea"))))) {
this->detection_area->connect("body_entered", callable_mp(this, &self_type::body_entered));
this->detection_area->connect("body_exited", callable_mp(this, &self_type::body_exited));
} else {
ERR_FAIL_EDMSG("Failed to find detection area");
}
if (has_node(NodePath("Indicator")) && (this->indicator = cast_to<Node3D>(get_node(NodePath("Indicator"))))) {
this->indicator->set_visible(false);
}
return;
case NOTIFICATION_PROCESS:
process();

View file

@ -23,6 +23,7 @@ private:
PlayerBody *player{ nullptr };
double shoot_delay{ 0.25 };
bool shoot_timer_running{ false };
Node3D *indicator{ nullptr };
public:
GET_SET_FNS(Ref<PackedScene>, projectile);

View file

@ -23,7 +23,7 @@ shader_parameter/top_layer_albedo = ExtResource("2_thik8")
shader_parameter/under_layer_albedo = ExtResource("3_i1ahx")
shader_parameter/under_layer_normal = ExtResource("4_thik8")
shader_parameter/under_layer_depth = ExtResource("4_i1ahx")
shader_parameter/under_layer_scale = 11.561
shader_parameter/under_layer_scale = 8.171
shader_parameter/under_layer_depth_scale = 0.081
shader_parameter/max_depth_layers = 500.0
shader_parameter/min_depth_layers = 100.0

View file

@ -1,5 +1,6 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://cirdfdncgft7o"]
[resource]
cull_mode = 2
shading_mode = 0
albedo_color = Color(0, 0, 0, 1)

BIN
project/assets/enemies/attack_indicator.blend (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,63 @@
[remap]
importer="ArrayMesh"
importer_version=1
type="ArrayMesh"
uid="uid://bxueie1actno6"
path="res://.godot/imported/attack_indicator.blend-e4d4dcaab0fd3c14a354fa64d4a9d4e9.res"
[deps]
source_file="res://assets/enemies/attack_indicator.blend"
dest_files=["res://.godot/imported/attack_indicator.blend-e4d4dcaab0fd3c14a354fa64d4a9d4e9.res"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
mesh_library/use_node_names_as_mesh_names=false
array_mesh/deduplicate_surfaces=true
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/vertex_colors=1
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2
gltf/texture_map_mode=1

Binary file not shown.

BIN
project/assets/enemies/orb.blend (Stored with Git LFS)

Binary file not shown.

View file

@ -43,8 +43,8 @@ _subresources={
"materials": {
"Pupil": {
"use_external/enabled": true,
"use_external/fallback_path": "res://assets/materials/kaleidoscope_mosaic.tres",
"use_external/path": "res://assets/materials/kaleidoscope_mosaic.tres"
"use_external/fallback_path": "res://assets/materials/kaleidoscope_mosaic_red.tres",
"use_external/path": "res://assets/materials/kaleidoscope_mosaic_red.tres"
},
"Surface": {
"use_external/enabled": true,

Binary file not shown.

View file

@ -0,0 +1,27 @@
[gd_resource type="StandardMaterial3D" load_steps=5 format=2]
[ext_resource path="kaleidoscope_mosaic_red_albedo.png" type="Texture" id=1]
[ext_resource path="kaleidoscope_mosaic_red_normal.png" type="Texture" id=3]
[ext_resource path="kaleidoscope_mosaic_red_heightmap.png" type="Texture" id=4]
[ext_resource path="kaleidoscope_mosaic_red_emission.png" type="Texture" id=5]
[resource]
albedo_color = Color(1.0, 1.0, 1.0, 1.0)
albedo_texture = ExtResource( 1 )
metallic = 1.0
roughness = 0.19
normal_enabled = true
normal_scale = 1.0
normal_texture = ExtResource( 3 )
emission_enabled = true
emission = Color( 0, 0, 0, 1 )
emission_energy = 0.03
emission_operator = 0
emission_texture = ExtResource( 5 )
heightmap_enabled = true
heightmap_scale = 7.0
heightmap_deep_parallax = true
heightmap_min_layers = 8
heightmap_max_layers = 32
heightmap_texture = ExtResource( 4 )

BIN
project/assets/materials/kaleidoscope_mosaic_red_albedo.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cb2gui7trlsnu"
path.s3tc="res://.godot/imported/kaleidoscope_mosaic_red_albedo.png-a9ec41a6589e277830779ef73132c9d7.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/materials/kaleidoscope_mosaic_red_albedo.png"
dest_files=["res://.godot/imported/kaleidoscope_mosaic_red_albedo.png-a9ec41a6589e277830779ef73132c9d7.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=0

Binary file not shown.

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4ch13h83vixt"
path.s3tc="res://.godot/imported/kaleidoscope_mosaic_red_emission.png-711737b8e4845d6b7f87c1ca97175539.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/materials/kaleidoscope_mosaic_red_emission.png"
dest_files=["res://.godot/imported/kaleidoscope_mosaic_red_emission.png-711737b8e4845d6b7f87c1ca97175539.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=0

Binary file not shown.

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cyqyk7gp2olg8"
path.s3tc="res://.godot/imported/kaleidoscope_mosaic_red_heightmap.png-7d69b796616758662f9835e885c5e2b4.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/materials/kaleidoscope_mosaic_red_heightmap.png"
dest_files=["res://.godot/imported/kaleidoscope_mosaic_red_heightmap.png-7d69b796616758662f9835e885c5e2b4.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=7
roughness/src_normal="res://assets/materials/kaleidoscope_mosaic_red_normal.png"
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=0

BIN
project/assets/materials/kaleidoscope_mosaic_red_normal.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byus05386lb8r"
path.s3tc="res://.godot/imported/kaleidoscope_mosaic_red_normal.png-e651c14b02822e024c82c3964d6b19a9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/materials/kaleidoscope_mosaic_red_normal.png"
dest_files=["res://.godot/imported/kaleidoscope_mosaic_red_normal.png-e651c14b02822e024c82c3964d6b19a9.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/materials/kaleidoscope_mosaic_red_normal.png"
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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=0

View file

@ -2,6 +2,21 @@
[ext_resource type="PackedScene" uid="uid://bmibf31n8lo2l" path="res://objects/projectiles/projectile.tscn" id="1_sf38o"]
[ext_resource type="PackedScene" uid="uid://c2sddj48b7fw1" path="res://assets/enemies/orb.tscn" id="1_sixut"]
[ext_resource type="ArrayMesh" uid="uid://bxueie1actno6" path="res://assets/enemies/attack_indicator.blend" id="2_a3yiw"]
[sub_resource type="Gradient" id="Gradient_1ycrl"]
colors = PackedColorArray(1, 0, 0, 0.4509804, 1, 0, 0, 0)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_fbx7l"]
gradient = SubResource("Gradient_1ycrl")
fill_from = Vector2(0, 1)
fill_to = Vector2(0, 0)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nndud"]
transparency = 4
cull_mode = 2
shading_mode = 0
albedo_texture = SubResource("GradientTexture2D_fbx7l")
[sub_resource type="CylinderShape3D" id="CylinderShape3D_vsqsw"]
height = 26.0
@ -11,7 +26,12 @@ radius = 10.89209
projectile = ExtResource("1_sf38o")
shoot_delay = 2.0
[node name="Indicator" type="MeshInstance3D" parent="." unique_id=1713530325]
material_override = SubResource("StandardMaterial3D_nndud")
mesh = ExtResource("2_a3yiw")
[node name="orb" parent="." unique_id=1503011283 instance=ExtResource("1_sixut")]
transform = Transform3D(1.6, 0, 0, 0, 1.6, 0, 0, 0, 1.6, 0, 0, 0)
[node name="AwarenessArea" type="Area3D" parent="." unique_id=255601634]

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://bmibf31n8lo2l"]
[ext_resource type="Material" path="res://assets/materials/kaleidoscope_mosaic_gray.tres" id="1_c1bky"]
[ext_resource type="Material" path="res://assets/materials/kaleidoscope_mosaic_red.tres" id="1_c1bky"]
[sub_resource type="GDScript" id="GDScript_exgcw"]
resource_name = "Projectile"