Reworked weapons and projectiles

This commit is contained in:
2025-12-20 18:35:27 +03:00
parent 2ecc53416a
commit 8227e8bcf3
312 changed files with 2466 additions and 1376 deletions
@@ -1,5 +1,5 @@
class_name LauncherProjectile
extends BlastProjectile
class_name AbstractLauncherProjectile
extends AbstractBlastProjectile
@export_range(0, 360) var rotation_speed: int
@@ -9,8 +9,8 @@ var target : AbstractShip = null
@onready var sprites : Array[Sprite2D] = [
$Sprite2D_E, $Sprite2D_SE, $Sprite2D_S, $Sprite2D_SW,
$Sprite2D_W, $Sprite2D_NW, $Sprite2D_N, $Sprite2D_NE,
$Sprites/E, $Sprites/SE, $Sprites/S, $Sprites/SW,
$Sprites/W, $Sprites/NW, $Sprites/N, $Sprites/NE,
]
@onready var explosion_particles : ExplosionParticles = $ExplosionParticles
@@ -1,17 +1,17 @@
[gd_scene load_steps=20 format=3 uid="uid://dukgbg13ujkv2"]
[ext_resource type="PackedScene" uid="uid://betr5ry5tc75e" path="res://game/entities/weapons/blast_projectile.tscn" id="1_0mcat"]
[ext_resource type="Script" uid="uid://dkvur5bdwg3sr" path="res://game/entities/weapons/launcher/launcher_projectile.gd" id="2_6hdsf"]
[ext_resource type="PackedScene" uid="uid://bhxib2ltpkcbf" path="res://game/entities/other/explosion_particles.tscn" id="3_iqm85"]
[ext_resource type="PackedScene" uid="uid://betr5ry5tc75e" path="res://game/entities/weapons/abstract_blast_projectile.tscn" id="1_0mcat"]
[ext_resource type="Script" uid="uid://dkvur5bdwg3sr" path="res://game/entities/weapons/launcher/abstract_launcher_projectile.gd" id="2_6hdsf"]
[ext_resource type="PackedScene" uid="uid://bhxib2ltpkcbf" path="res://game/entities/explosions/explosion_particles.tscn" id="3_iqm85"]
[ext_resource type="Texture2D" uid="uid://gh7mwehpqfco" path="res://particle_textures/flame_medium.tres" id="3_kos01"]
[ext_resource type="Script" uid="uid://dftb7hg5f06b5" path="res://game/health_system/damage/explosion_damage.gd" id="3_ycnsk"]
[ext_resource type="Script" uid="uid://dftb7hg5f06b5" path="res://game/data/damage/explosion_damage.gd" id="3_ycnsk"]
[ext_resource type="Texture2D" uid="uid://oj86smpsipw4" path="res://images/projectiles.png" id="4_kxgpk"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kxgpk"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 2.0
emission_sphere_radius = 1.0
angle_min = -179.99998
angle_max = 180.00002
spread = 15.0
@@ -73,7 +73,7 @@ gravity = Vector3(0, 0, 0)
turbulence_enabled = true
turbulence_noise_speed = Vector3(0.1, 0.1, 0.1)
[node name="LauncherProjectile" instance=ExtResource("1_0mcat")]
[node name="AbstractLauncherProjectile" instance=ExtResource("1_0mcat")]
collision_layer = 0
collision_mask = 0
script = ExtResource("2_6hdsf")
@@ -86,44 +86,46 @@ texture = ExtResource("3_kos01")
lifetime = 0.1
process_material = SubResource("ParticleProcessMaterial_kxgpk")
[node name="Sprite2D_E" type="Sprite2D" parent="." index="1"]
[node name="Sprites" type="Node2D" parent="." index="1"]
[node name="E" type="Sprite2D" parent="Sprites" index="0"]
texture = SubResource("AtlasTexture_kxgpk")
[node name="Sprite2D_SE" type="Sprite2D" parent="." index="2"]
[node name="SE" type="Sprite2D" parent="Sprites" index="1"]
texture = SubResource("AtlasTexture_kos01")
[node name="Sprite2D_S" type="Sprite2D" parent="." index="3"]
[node name="S" type="Sprite2D" parent="Sprites" index="2"]
texture = SubResource("AtlasTexture_iqm85")
[node name="Sprite2D_SW" type="Sprite2D" parent="." index="4"]
[node name="SW" type="Sprite2D" parent="Sprites" index="3"]
texture = SubResource("AtlasTexture_rno65")
[node name="Sprite2D_W" type="Sprite2D" parent="." index="5"]
[node name="W" type="Sprite2D" parent="Sprites" index="4"]
texture = SubResource("AtlasTexture_f648y")
[node name="Sprite2D_NW" type="Sprite2D" parent="." index="6"]
[node name="NW" type="Sprite2D" parent="Sprites" index="5"]
texture = SubResource("AtlasTexture_she3g")
[node name="Sprite2D_N" type="Sprite2D" parent="." index="7"]
[node name="N" type="Sprite2D" parent="Sprites" index="6"]
texture = SubResource("AtlasTexture_4wwm4")
[node name="Sprite2D_NE" type="Sprite2D" parent="." index="8"]
[node name="NE" type="Sprite2D" parent="Sprites" index="7"]
texture = SubResource("AtlasTexture_dl8vu")
[node name="CollisionShape2D" parent="." index="9"]
[node name="CollisionShape2D" parent="." index="2"]
shape = SubResource("CapsuleShape2D_6hdsf")
[node name="Blast" parent="." index="11"]
[node name="Blast" parent="." index="4"]
collision_layer = 0
collision_mask = 0
damage = SubResource("Resource_kos01")
shape = SubResource("CircleShape2D_kxgpk")
[node name="ExplosionParticles" parent="." index="12" instance=ExtResource("3_iqm85")]
[node name="ExplosionParticles" parent="." index="5" instance=ExtResource("3_iqm85")]
process_material = SubResource("ParticleProcessMaterial_iqm85")
amount_ratio = 0.05
[node name="OutOfScreenTimer" parent="." index="13"]
[node name="OutOfScreenTimer" parent="." index="6"]
wait_time = 3.0
[connection signal="finished" from="ExplosionParticles" to="." method="_on_explosion_particles_finished"]
@@ -1,8 +1,7 @@
class_name AbstractLauncherWeapon
extends AbstractWeapon
@onready var player_sprite : Sprite2D = $PlayerSprite
@onready var enemy_sprite : Sprite2D = $EnemySprite
@onready var cooldown_timer : Timer = $CooldownTimer
@@ -19,18 +18,6 @@ var _muzzle_index := 0
]
func set_belonging(belonging: Belonging) -> void:
super.set_belonging(belonging)
match _belonging:
Belonging.PLAYER:
player_sprite.show()
enemy_sprite.hide()
Belonging.ENEMY:
player_sprite.hide()
enemy_sprite.show()
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
@@ -1,10 +1,8 @@
[gd_scene load_steps=10 format=3 uid="uid://c3l866fdqt7pf"]
[gd_scene load_steps=6 format=3 uid="uid://c3l866fdqt7pf"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_sk5u1"]
[ext_resource type="Script" uid="uid://lauvvj5xhbud" path="res://game/entities/weapons/launcher/launcher_weapon.gd" id="2_mxjpe"]
[ext_resource type="PackedScene" uid="uid://dukgbg13ujkv2" path="res://game/entities/weapons/launcher/launcher_projectile.tscn" id="3_fsoo2"]
[ext_resource type="Script" uid="uid://lauvvj5xhbud" path="res://game/entities/weapons/launcher/abstract_launcher_weapon.gd" id="2_mxjpe"]
[ext_resource type="Texture2D" uid="uid://gh7mwehpqfco" path="res://particle_textures/flame_medium.tres" id="4_0brql"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_3cw5x"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_u8eh0"]
lifetime_randomness = 0.5
@@ -34,22 +32,12 @@ initial_velocity_min = 30.0
initial_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_u8eh0"]
atlas = ExtResource("6_3cw5x")
region = Rect2(224, 128, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ylgjm"]
atlas = ExtResource("6_3cw5x")
region = Rect2(224, 144, 32, 16)
[node name="LauncherWeapon" instance=ExtResource("1_sk5u1")]
[node name="AbstractLauncherWeapon" instance=ExtResource("1_sk5u1")]
script = ExtResource("2_mxjpe")
sector_angle = 5
Projectile = ExtResource("3_fsoo2")
type = 4
[node name="LeftParticles" type="GPUParticles2D" parent="." index="0"]
position = Vector2(-4, -3)
emitting = false
amount = 16
texture = ExtResource("4_0brql")
@@ -58,7 +46,6 @@ one_shot = true
process_material = SubResource("ParticleProcessMaterial_u8eh0")
[node name="RightParticles" type="GPUParticles2D" parent="." index="1"]
position = Vector2(-4, 3)
emitting = false
amount = 16
texture = ExtResource("4_0brql")
@@ -66,22 +53,10 @@ lifetime = 0.3
one_shot = true
process_material = SubResource("ParticleProcessMaterial_0brql")
[node name="PlayerSprite" type="Sprite2D" parent="." index="2"]
position = Vector2(4, 0)
texture = SubResource("AtlasTexture_u8eh0")
[node name="EnemySprite" type="Sprite2D" parent="." index="3"]
position = Vector2(4, 0)
texture = SubResource("AtlasTexture_ylgjm")
[node name="CooldownTimer" type="Timer" parent="." index="4"]
[node name="CooldownTimer" type="Timer" parent="." index="2"]
wait_time = 0.5
one_shot = true
[node name="Muzzle" parent="." index="5"]
position = Vector2(11, -3)
[node name="SecondMuzzle" type="Node2D" parent="." index="6"]
position = Vector2(11, 3)
[node name="SecondMuzzle" type="Node2D" parent="." index="4"]
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
@@ -0,0 +1,2 @@
class_name EnemyLauncherProjectile
extends AbstractLauncherProjectile
@@ -0,0 +1 @@
uid://bgl2wo0bdgh5j
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://dpbighfm8o7ij"]
[ext_resource type="PackedScene" uid="uid://dukgbg13ujkv2" path="res://game/entities/weapons/launcher/abstract_launcher_projectile.tscn" id="1_ek3l7"]
[ext_resource type="Script" uid="uid://bgl2wo0bdgh5j" path="res://game/entities/weapons/launcher/enemy_launcher_projectile.gd" id="2_idk0a"]
[node name="EnemyLauncherProjectile" instance=ExtResource("1_ek3l7")]
collision_layer = 16
collision_mask = 2
script = ExtResource("2_idk0a")
direction = Vector2(-1, 0)
[node name="Blast" parent="." index="4"]
collision_layer = 16
collision_mask = 2
@@ -0,0 +1,2 @@
class_name EnemyLauncherWeapon
extends AbstractLauncherWeapon
@@ -0,0 +1 @@
uid://3b4ft0vrkvn1
@@ -0,0 +1,58 @@
[gd_scene load_steps=8 format=3 uid="uid://b757rcwc231o2"]
[ext_resource type="PackedScene" uid="uid://c3l866fdqt7pf" path="res://game/entities/weapons/launcher/abstract_launcher_weapon.tscn" id="1_co8ul"]
[ext_resource type="Script" uid="uid://3b4ft0vrkvn1" path="res://game/entities/weapons/launcher/enemy_launcher_weapon.gd" id="2_qdxuw"]
[ext_resource type="PackedScene" uid="uid://dpbighfm8o7ij" path="res://game/entities/weapons/launcher/enemy_launcher_projectile.tscn" id="3_qdxuw"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="4_xtc8h"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_xtc8h"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 1.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
spread = 15.0
initial_velocity_min = 30.0
initial_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_avyie"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 1.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
spread = 15.0
initial_velocity_min = 30.0
initial_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_ylgjm"]
atlas = ExtResource("4_xtc8h")
region = Rect2(224, 144, 32, 16)
[node name="EnemyLauncherWeapon" instance=ExtResource("1_co8ul")]
script = ExtResource("2_qdxuw")
projectile_scene = ExtResource("3_qdxuw")
[node name="LeftParticles" parent="." index="0"]
position = Vector2(4, 3)
process_material = SubResource("ParticleProcessMaterial_xtc8h")
[node name="RightParticles" parent="." index="1"]
position = Vector2(4, -3)
process_material = SubResource("ParticleProcessMaterial_avyie")
[node name="Muzzle" parent="." index="3"]
position = Vector2(-11, 3)
[node name="SecondMuzzle" parent="." index="4"]
position = Vector2(-11, -3)
[node name="Sprite2D" type="Sprite2D" parent="." index="5"]
position = Vector2(-4, 0)
texture = SubResource("AtlasTexture_ylgjm")
@@ -1,17 +0,0 @@
[gd_resource type="Resource" script_class="WeaponData" load_steps=3 format=3 uid="uid://ddgggndifycge"]
[ext_resource type="PackedScene" uid="uid://c3l866fdqt7pf" path="res://game/entities/weapons/launcher/launcher_weapon.tscn" id="1_3oqtq"]
[ext_resource type="Script" uid="uid://870r1efinhqd" path="res://game/world/data/weapon_data.gd" id="1_tcis2"]
[resource]
script = ExtResource("1_tcis2")
id = "launcher"
name = "Launcher"
group = "explosion"
description = "Moderate damage (explosion)
Moderate firerate
Low velocity
Small explosion radius
Homing"
scene = ExtResource("1_3oqtq")
metadata/_custom_type_script = "uid://870r1efinhqd"
@@ -0,0 +1,2 @@
class_name PlayerLauncherProjectile
extends AbstractLauncherProjectile
@@ -0,0 +1 @@
uid://jxx2b1mcovtx
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://ds0xsi84rp1kb"]
[ext_resource type="PackedScene" uid="uid://dukgbg13ujkv2" path="res://game/entities/weapons/launcher/abstract_launcher_projectile.tscn" id="1_cd4up"]
[ext_resource type="Script" uid="uid://jxx2b1mcovtx" path="res://game/entities/weapons/launcher/player_launcher_projectile.gd" id="2_gkh2w"]
[node name="PlayerLauncherProjectile" instance=ExtResource("1_cd4up")]
collision_layer = 8
collision_mask = 4
script = ExtResource("2_gkh2w")
direction = Vector2(1, 0)
[node name="Blast" parent="." index="4"]
collision_layer = 8
collision_mask = 4
@@ -0,0 +1,2 @@
class_name PlayerLauncherWeapon
extends AbstractLauncherWeapon
@@ -0,0 +1 @@
uid://c3asrkguw01q2
@@ -0,0 +1,60 @@
[gd_scene load_steps=8 format=3 uid="uid://bmn3cxk1ajydl"]
[ext_resource type="PackedScene" uid="uid://c3l866fdqt7pf" path="res://game/entities/weapons/launcher/abstract_launcher_weapon.tscn" id="1_d6r67"]
[ext_resource type="Script" uid="uid://c3asrkguw01q2" path="res://game/entities/weapons/launcher/player_launcher_weapon.gd" id="2_10o3e"]
[ext_resource type="PackedScene" uid="uid://ds0xsi84rp1kb" path="res://game/entities/weapons/launcher/player_launcher_projectile.tscn" id="3_10o3e"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="4_v6ybh"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_v6ybh"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 1.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
direction = Vector3(-1, 0, 0)
spread = 15.0
initial_velocity_min = 30.0
initial_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_8lwsi"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 1.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
direction = Vector3(-1, 0, 0)
spread = 15.0
initial_velocity_min = 30.0
initial_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_u8eh0"]
atlas = ExtResource("4_v6ybh")
region = Rect2(224, 128, 32, 16)
[node name="PlayerLauncherWeapon" instance=ExtResource("1_d6r67")]
script = ExtResource("2_10o3e")
projectile_scene = ExtResource("3_10o3e")
[node name="LeftParticles" parent="." index="0"]
position = Vector2(-4, -3)
process_material = SubResource("ParticleProcessMaterial_v6ybh")
[node name="RightParticles" parent="." index="1"]
position = Vector2(-4, 3)
process_material = SubResource("ParticleProcessMaterial_8lwsi")
[node name="Muzzle" parent="." index="3"]
position = Vector2(11, -3)
[node name="SecondMuzzle" parent="." index="4"]
position = Vector2(11, 3)
[node name="Sprite2D" type="Sprite2D" parent="." index="5"]
position = Vector2(4, 0)
texture = SubResource("AtlasTexture_u8eh0")