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
@@ -0,0 +1,2 @@
class_name AbstractGatlingProjectile
extends AbstractDirectHitProjectile
@@ -1,8 +1,8 @@
[gd_scene load_steps=8 format=3 uid="uid://yfvluap3uy1r"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/direct_hit__projectile.tscn" id="1_3tgt7"]
[ext_resource type="Script" uid="uid://rtsf1n0djorp" path="res://game/entities/weapons/gatling/gatling_projectile.gd" id="2_hbgoq"]
[ext_resource type="Script" uid="uid://bhqvk5cnjg5mv" path="res://game/health_system/damage/kinetic_damage.gd" id="3_2tbeq"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/abstract_direct_hit_projectile.tscn" id="1_3tgt7"]
[ext_resource type="Script" uid="uid://rtsf1n0djorp" path="res://game/entities/weapons/gatling/abstract_gatling_projectile.gd" id="2_hbgoq"]
[ext_resource type="Script" uid="uid://bhqvk5cnjg5mv" path="res://game/data/damage/kinetic_damage.gd" id="3_2tbeq"]
[ext_resource type="Texture2D" uid="uid://oj86smpsipw4" path="res://images/projectiles.png" id="4_ndegg"]
[sub_resource type="Resource" id="Resource_ndegg"]
@@ -17,13 +17,12 @@ region = Rect2(0, 0, 16, 16)
[sub_resource type="CircleShape2D" id="CircleShape2D_2tbeq"]
radius = 1.0
[node name="GatlingProjectile" instance=ExtResource("1_3tgt7")]
[node name="AbstractGatlingProjectile" instance=ExtResource("1_3tgt7")]
collision_layer = 0
collision_mask = 0
script = ExtResource("2_hbgoq")
damage = SubResource("Resource_ndegg")
speed = 600
piercing = 1
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
texture = SubResource("AtlasTexture_11x32")
@@ -1,3 +1,4 @@
class_name AbstractGatlingWeapon
extends AbstractWeapon
@@ -6,17 +7,15 @@ extends AbstractWeapon
@onready var shell_particles : GPUParticles2D = $ShellParticles
func set_belonging(belonging: Belonging) -> void:
super.set_belonging(belonging)
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
func _ready() -> void:
sprite.play(IDLE_ANIMATION)
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
_can_shoot = false
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
sprite.play(SHOT_ANIMATION)
shot_particles.restart()
shell_particles.emit_particle(Transform2D(), Vector2(), Color(), Color(), 0)
@@ -25,3 +24,4 @@ func shoot(ship_velocity: Vector2) -> bool:
func _on_animated_sprite_2d_animation_finished() -> void:
_can_shoot = true
sprite.play(IDLE_ANIMATION)
@@ -0,0 +1,54 @@
[gd_scene load_steps=8 format=3 uid="uid://c4mlppn5i55bp"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_5wvix"]
[ext_resource type="Script" uid="uid://c1bsvmj7xhnxe" path="res://game/entities/weapons/gatling/abstract_gatling_weapon.gd" id="2_no4ra"]
[ext_resource type="Texture2D" uid="uid://b2tpy3y2bpuat" path="res://particle_textures/flame_small.tres" id="3_pm5f5"]
[ext_resource type="Texture2D" uid="uid://bib4q76bmnajw" path="res://particle_textures/shell_small.tres" id="5_17k52"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_v064d"]
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
initial_velocity_min = 5.0
initial_velocity_max = 25.0
gravity = Vector3(0, 0, 0)
[sub_resource type="SpriteFrames" id="SpriteFrames_qqle0"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_pjn33"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 0.5
direction = Vector3(0, -1, 0)
spread = 15.0
initial_velocity_min = 5.0
initial_velocity_max = 15.0
gravity = Vector3(0, 0, 0)
[node name="AbstractGatlingWeapon" instance=ExtResource("1_5wvix")]
script = ExtResource("2_no4ra")
sector_angle = 5
type = 1
[node name="ShotParticles" type="GPUParticles2D" parent="." index="0"]
emitting = false
texture = ExtResource("3_pm5f5")
lifetime = 0.1
one_shot = true
process_material = SubResource("ParticleProcessMaterial_v064d")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="1"]
sprite_frames = SubResource("SpriteFrames_qqle0")
[node name="ShellParticles" type="GPUParticles2D" parent="." index="2"]
z_index = 1
emitting = false
amount = 20
texture = ExtResource("5_17k52")
lifetime = 3.0
one_shot = true
fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_pjn33")
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
@@ -0,0 +1,2 @@
class_name EnemyGatlingProjectile
extends AbstractGatlingProjectile
@@ -0,0 +1 @@
uid://b63edlkleako8
@@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://b5qcmktgysdw6"]
[ext_resource type="PackedScene" uid="uid://yfvluap3uy1r" path="res://game/entities/weapons/gatling/abstract_gatling_projectile.tscn" id="1_qxjms"]
[ext_resource type="Script" uid="uid://b63edlkleako8" path="res://game/entities/weapons/gatling/enemy_gatling_projectile.gd" id="2_uhyou"]
[node name="EnemyGatlingProjectile" instance=ExtResource("1_qxjms")]
collision_layer = 16
collision_mask = 2
script = ExtResource("2_uhyou")
direction = Vector2(-1, 0)
@@ -0,0 +1,2 @@
class_name EnemyGatlingWeapon
extends AbstractGatlingWeapon
@@ -0,0 +1 @@
uid://bj6mviyrgggty
@@ -0,0 +1,86 @@
[gd_scene load_steps=12 format=3 uid="uid://b0ajhllwm5qux"]
[ext_resource type="PackedScene" uid="uid://c4mlppn5i55bp" path="res://game/entities/weapons/gatling/abstract_gatling_weapon.tscn" id="1_dil8o"]
[ext_resource type="Script" uid="uid://bj6mviyrgggty" path="res://game/entities/weapons/gatling/enemy_gatling_weapon.gd" id="2_v0vlv"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="3_2opsk"]
[ext_resource type="PackedScene" uid="uid://b5qcmktgysdw6" path="res://game/entities/weapons/gatling/enemy_gatling_projectile.tscn" id="3_nk3h5"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2opsk"]
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
initial_velocity_min = 5.0
initial_velocity_max = 25.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_ydc6p"]
atlas = ExtResource("3_2opsk")
region = Rect2(160, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_pjn33"]
atlas = ExtResource("3_2opsk")
region = Rect2(192, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_kkima"]
atlas = ExtResource("3_2opsk")
region = Rect2(224, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_i25po"]
atlas = ExtResource("3_2opsk")
region = Rect2(160, 176, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_nk3h5"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ydc6p")
}],
"loop": true,
"name": &"idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_pjn33")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kkima")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i25po")
}],
"loop": false,
"name": &"shot",
"speed": 30.0
}]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_cxn0h"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 0.5
direction = Vector3(0, -1, 0)
spread = 5.0
initial_velocity_min = 5.0
initial_velocity_max = 15.0
gravity = Vector3(0, 0, 0)
[node name="EnemyGatlingWeapon" instance=ExtResource("1_dil8o")]
script = ExtResource("2_v0vlv")
projectile_scene = ExtResource("3_nk3h5")
[node name="ShotParticles" parent="." index="0"]
position = Vector2(-17, 0)
process_material = SubResource("ParticleProcessMaterial_2opsk")
[node name="AnimatedSprite2D" parent="." index="1"]
position = Vector2(-6, 0)
sprite_frames = SubResource("SpriteFrames_nk3h5")
animation = &"shot"
[node name="ShellParticles" parent="." index="2"]
position = Vector2(0, 1)
process_material = SubResource("ParticleProcessMaterial_cxn0h")
[node name="Muzzle" parent="." index="3"]
position = Vector2(-15, 0)
@@ -1,15 +0,0 @@
[gd_resource type="Resource" script_class="WeaponData" load_steps=3 format=3 uid="uid://djelo5gu3ybuf"]
[ext_resource type="Script" uid="uid://870r1efinhqd" path="res://game/world/data/weapon_data.gd" id="1_bt4k8"]
[ext_resource type="PackedScene" uid="uid://c4mlppn5i55bp" path="res://game/entities/weapons/gatling/gatling_weapon.tscn" id="3_2rwg6"]
[resource]
script = ExtResource("1_bt4k8")
id = "gatling"
name = "Gatling"
group = "kinetic"
description = "Low damage (kinetic)
High firerate
Moderate velocity"
scene = ExtResource("3_2rwg6")
metadata/_custom_type_script = "uid://870r1efinhqd"
@@ -1,2 +0,0 @@
class_name GatlingProjectile
extends DirectHitProjectile
@@ -1,142 +0,0 @@
[gd_scene load_steps=18 format=3 uid="uid://c4mlppn5i55bp"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_gblx7"]
[ext_resource type="Script" uid="uid://c1bsvmj7xhnxe" path="res://game/entities/weapons/gatling/gatling_weapon.gd" id="1_kg6du"]
[ext_resource type="PackedScene" uid="uid://yfvluap3uy1r" path="res://game/entities/weapons/gatling/gatling_projectile.tscn" id="2_ylc0n"]
[ext_resource type="Texture2D" uid="uid://b2tpy3y2bpuat" path="res://particle_textures/flame_small.tres" id="4_ydc6p"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="5_ydc6p"]
[ext_resource type="Texture2D" uid="uid://bib4q76bmnajw" path="res://particle_textures/shell_small.tres" id="6_v064d"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_v064d"]
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
initial_velocity_min = 5.0
initial_velocity_max = 25.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_ydc6p"]
atlas = ExtResource("5_ydc6p")
region = Rect2(160, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_pjn33"]
atlas = ExtResource("5_ydc6p")
region = Rect2(192, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_kkima"]
atlas = ExtResource("5_ydc6p")
region = Rect2(224, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_i25po"]
atlas = ExtResource("5_ydc6p")
region = Rect2(160, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_v064d"]
atlas = ExtResource("5_ydc6p")
region = Rect2(160, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_pm1cd"]
atlas = ExtResource("5_ydc6p")
region = Rect2(192, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_t1uk2"]
atlas = ExtResource("5_ydc6p")
region = Rect2(224, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_colwf"]
atlas = ExtResource("5_ydc6p")
region = Rect2(160, 160, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_pjn33"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ydc6p")
}],
"loop": true,
"name": &"enemy_idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_pjn33")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kkima")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i25po")
}],
"loop": false,
"name": &"enemy_shot",
"speed": 30.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_v064d")
}],
"loop": true,
"name": &"player_idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_pm1cd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t1uk2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_colwf")
}],
"loop": false,
"name": &"player_shot",
"speed": 30.0
}]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_pjn33"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 0.5
direction = Vector3(0, -1, 0)
spread = 15.0
initial_velocity_min = 5.0
initial_velocity_max = 15.0
gravity = Vector3(0, 0, 0)
[node name="GatlingWeapon" instance=ExtResource("1_gblx7")]
script = ExtResource("1_kg6du")
sector_angle = 5
Projectile = ExtResource("2_ylc0n")
type = 1
[node name="ShotParticles" type="GPUParticles2D" parent="." index="0"]
position = Vector2(17, 0)
emitting = false
amount = 32
texture = ExtResource("4_ydc6p")
lifetime = 0.1
one_shot = true
process_material = SubResource("ParticleProcessMaterial_v064d")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="1"]
position = Vector2(6, 0)
sprite_frames = SubResource("SpriteFrames_pjn33")
animation = &"player_shot"
[node name="ShellParticles" type="GPUParticles2D" parent="." index="2"]
z_index = 1
position = Vector2(0, -1)
emitting = false
amount = 20
texture = ExtResource("6_v064d")
lifetime = 3.0
one_shot = true
fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_pjn33")
[node name="Muzzle" parent="." index="3"]
position = Vector2(14, 0)
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
@@ -0,0 +1,2 @@
class_name PlayerGatlingProjectile
extends AbstractGatlingProjectile
@@ -0,0 +1 @@
uid://b8nunmccyxmkr
@@ -0,0 +1,10 @@
[gd_scene load_steps=3 format=3 uid="uid://c0dh3x5olsjtd"]
[ext_resource type="PackedScene" uid="uid://yfvluap3uy1r" path="res://game/entities/weapons/gatling/abstract_gatling_projectile.tscn" id="1_71wkj"]
[ext_resource type="Script" uid="uid://b8nunmccyxmkr" path="res://game/entities/weapons/gatling/player_gatling_projectile.gd" id="2_5ur67"]
[node name="PlayerGatlingProjectile" instance=ExtResource("1_71wkj")]
collision_layer = 8
collision_mask = 4
script = ExtResource("2_5ur67")
direction = Vector2(1, 0)
@@ -0,0 +1,2 @@
class_name PlayerGatlingWeapon
extends AbstractGatlingWeapon
@@ -0,0 +1 @@
uid://622qtvleceha
@@ -0,0 +1,86 @@
[gd_scene load_steps=12 format=3 uid="uid://ca2cjffcrfxkq"]
[ext_resource type="PackedScene" uid="uid://c4mlppn5i55bp" path="res://game/entities/weapons/gatling/abstract_gatling_weapon.tscn" id="1_y0rod"]
[ext_resource type="Script" uid="uid://622qtvleceha" path="res://game/entities/weapons/gatling/player_gatling_weapon.gd" id="2_5q7qs"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="3_5q7qs"]
[ext_resource type="PackedScene" uid="uid://c0dh3x5olsjtd" path="res://game/entities/weapons/gatling/player_gatling_projectile.tscn" id="3_gqtte"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gqtte"]
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.5
initial_velocity_min = 5.0
initial_velocity_max = 25.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_v064d"]
atlas = ExtResource("3_5q7qs")
region = Rect2(160, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_pm1cd"]
atlas = ExtResource("3_5q7qs")
region = Rect2(192, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_t1uk2"]
atlas = ExtResource("3_5q7qs")
region = Rect2(224, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_colwf"]
atlas = ExtResource("3_5q7qs")
region = Rect2(160, 160, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_34dp1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_v064d")
}],
"loop": true,
"name": &"idle",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_pm1cd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t1uk2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_colwf")
}],
"loop": false,
"name": &"shot",
"speed": 30.0
}]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_5smu4"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 0.5
direction = Vector3(0, -1, 0)
spread = 5.0
initial_velocity_min = 5.0
initial_velocity_max = 15.0
gravity = Vector3(0, 0, 0)
[node name="PlayerGatlingWeapon" instance=ExtResource("1_y0rod")]
script = ExtResource("2_5q7qs")
projectile_scene = ExtResource("3_gqtte")
[node name="ShotParticles" parent="." index="0"]
position = Vector2(17, 0)
process_material = SubResource("ParticleProcessMaterial_gqtte")
[node name="AnimatedSprite2D" parent="." index="1"]
position = Vector2(6, 0)
sprite_frames = SubResource("SpriteFrames_34dp1")
animation = &"shot"
[node name="ShellParticles" parent="." index="2"]
position = Vector2(0, -1)
process_material = SubResource("ParticleProcessMaterial_5smu4")
[node name="Muzzle" parent="." index="3"]
position = Vector2(15, 0)