Bullets sparks

This commit is contained in:
Marco 2025-08-06 15:31:52 +02:00
commit b7686411ff
10 changed files with 1691 additions and 1550 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -56,7 +56,7 @@ shadow_blur = 0.51
sky_mode = 1
[node name="StartPosition" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 77.738815, 1.2967, -15.401192)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 77.738815, 1.4317098, -15.401192)
script = ExtResource("9_g4gcm")
[node name="CameraTarget" type="Marker3D" parent="."]

View file

@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="BulletResource" load_steps=4 format=3 uid="uid://dye4820oabo2f"]
[ext_resource type="PackedScene" uid="uid://c85ht0mlk0ruv" path="res://Scenes/Weapons/generic_bullet_deat_particle_3D.tscn" id="1_r5jsy"]
[ext_resource type="Texture2D" uid="uid://cw027a7llqhns" path="res://Sprites/Bullets/spark_001.png" id="2_4r7h6"]
[ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="2_r5jsy"]
[resource]
script = ExtResource("2_r5jsy")
BulletScene = ExtResource("1_r5jsy")
BulletSprite = ExtResource("2_4r7h6")
BulletSpeed = 0.0
BulletDamage = 0.0
MaxDamage = 0.0
Knockback = 0.0
LifeTime = 0.1
GrazeValue = 1.0
Attributes = 16
TimeModifiers = []

View file

@ -1,7 +1,8 @@
[gd_resource type="Resource" script_class="BulletResource" load_steps=4 format=3 uid="uid://csmq6hngkx41e"]
[gd_resource type="Resource" script_class="BulletResource" load_steps=5 format=3 uid="uid://csmq6hngkx41e"]
[ext_resource type="PackedScene" uid="uid://byc67yxbkefyk" path="res://Scenes/Weapons/bullet_3D.tscn" id="1_qojek"]
[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="2_663pf"]
[ext_resource type="Resource" uid="uid://dye4820oabo2f" path="res://Resources/Bullets/3D/Bullet_Spark_Harmless_3D.tres" id="3_k31eh"]
[ext_resource type="Script" uid="uid://dslyrfcej3g2n" path="res://Scripts/Resources/BulletResource.cs" id="3_xep6w"]
[resource]
@ -9,14 +10,12 @@ script = ExtResource("3_xep6w")
BulletScene = ExtResource("1_qojek")
BulletSprite = ExtResource("2_663pf")
BulletSize = 0.08
DestructionParticlesBullet = ExtResource("3_k31eh")
BulletSpeed = 10.0
Direction = Vector2(1, 0)
BulletDamage = 0.5
MaxDamage = 1.2
Knockback = 100.0
LifeTime = 10.0
Owner = 1
DamageType = 3
GrazeValue = 0.2
Attributes = 256
TimeModifiers = []

View file

@ -0,0 +1,54 @@
[gd_scene load_steps=8 format=3 uid="uid://c85ht0mlk0ruv"]
[ext_resource type="Script" uid="uid://cg6y36s7buapp" path="res://Scripts/Weapons/Bullet3D.cs" id="1_bgea7"]
[ext_resource type="Texture2D" uid="uid://dmwi86k7hr8sl" path="res://Sprites/Bullets/small_bullet_green.png" id="2_bgea7"]
[ext_resource type="AudioStream" uid="uid://b3rm0vj6x54k4" path="res://SFX/th_knockoff_sfx/click_collect.wav" id="3_f6xij"]
[ext_resource type="Material" uid="uid://ogkwkokxevat" path="res://Resources/Particles/graze_particle_3D.tres" id="4_yuh7f"]
[sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"]
radius = 0.161126
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_t5ure"]
vertex_color_use_as_albedo = true
[sub_resource type="QuadMesh" id="QuadMesh_nd0aw"]
lightmap_size_hint = Vector2i(2, 2)
material = SubResource("StandardMaterial3D_t5ure")
size = Vector2(0.1, 0.1)
orientation = 1
[node name="Bullet" type="Area3D" groups=["bullets"]]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_bgea7")
Speed = 200.0
metadata/_edit_group_ = true
[node name="Sprite" type="Sprite3D" parent="."]
transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 0, 0)
pixel_size = 0.05
texture_filter = 0
texture = ExtResource("2_bgea7")
[node name="CollisionShape" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_pklkt")
[node name="VisibleOnScreenNotifier" type="VisibleOnScreenNotifier3D" parent="."]
[node name="GrazeSound" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("3_f6xij")
bus = &"Effects"
[node name="GrazeParticles" type="GPUParticles3D" parent="."]
transform = Transform3D(0.70710677, 0.49999997, 0.49999997, 0, 0.70710677, -0.70710677, -0.70710677, 0.49999997, 0.49999997, 0, 0, 0)
emitting = false
amount = 2
lifetime = 0.2
one_shot = true
local_coords = true
process_material = ExtResource("4_yuh7f")
draw_pass_1 = SubResource("QuadMesh_nd0aw")
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]

View file

@ -16,6 +16,7 @@ public partial class BulletResource : Resource
[Export] public Texture2D BulletSprite { get; set; }
[Export] public float BulletSize { get; set; }
[Export] public PackedScene DestructionParticlesScene { get; set; }
[Export] public BulletResource DestructionParticlesBullet { get; set; }
[Export] public float BulletSpeed = 100f;
[Export] public Vector2 Direction = Vector2.Right;
[Export] public float BulletDamage = 1;

View file

@ -402,8 +402,15 @@ public partial class Bullet3D : Area3D, IBullet
private void Destroy()
{
if (_bulletInfo?.DestructionParticlesScene != null)
if (_bulletInfo?.OriginalBulletResource.DestructionParticlesBullet != null)
{
var particleData =
_bulletInfo?.OriginalBulletResource.DestructionParticlesBullet.MakeBullet(
this.GlobalPosition.ToVector2());
var particle = PoolingManager.Instance.SpawnBullet<Bullet3D>(particleData.OriginalBulletResource);
particle.GlobalPosition = this.GlobalPosition;
particle.Initialize(particleData);
//this.CreateSibling<Node2D>(_bulletInfo.DestructionParticlesScene);
//particle.Init();

BIN
Sprites/Bullets/spark_001.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cw027a7llqhns"
path="res://.godot/imported/spark_001.png-e4a85262c137ea19ce57c9e9b36af6ba.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Sprites/Bullets/spark_001.png"
dest_files=["res://.godot/imported/spark_001.png-e4a85262c137ea19ce57c9e9b36af6ba.ctex"]
[params]
compress/mode=3
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