Fixed shells

This commit is contained in:
2025-12-19 16:41:16 +03:00
parent 7bdace27a8
commit 2ecc53416a
7 changed files with 48 additions and 34 deletions
@@ -21,16 +21,12 @@ func shoot(ship_velocity: Vector2) -> bool:
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
_can_shoot = false
cooldown_timer.start()
_restart_particles()
return is_shot
func _restart_particles() -> void:
front_particles.restart()
left_particles.restart()
right_particles.restart()
shell_particles.restart()
shell_particles.emit_particle(Transform2D(), Vector2(), Color(), Color(), 0)
return is_shot
func _on_animated_sprite_2d_animation_finished() -> void:
@@ -145,9 +145,8 @@ animations = [{
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_nrbut"]
resource_local_to_scene = true
lifetime_randomness = 0.5
particle_flag_disable_z = true
inherit_velocity_ratio = 1.0
inherit_velocity_ratio = 0.5
direction = Vector3(0, 1, 0)
spread = 15.0
initial_velocity_min = 5.0
@@ -200,9 +199,9 @@ animation = &"player_idle"
z_index = 1
position = Vector2(-1, 1)
emitting = false
amount = 1
amount = 5
texture = ExtResource("6_i0ica")
lifetime = 2.0
lifetime = 3.0
one_shot = true
fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_nrbut")
@@ -2,7 +2,8 @@ extends AbstractWeapon
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
@onready var particles : GPUParticles2D = $GPUParticles2D
@onready var shot_particles : GPUParticles2D = $ShotParticles
@onready var shell_particles : GPUParticles2D = $ShellParticles
func set_belonging(belonging: Belonging) -> void:
@@ -16,7 +17,8 @@ func shoot(ship_velocity: Vector2) -> bool:
if is_shot:
_can_shoot = false
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
particles.restart()
shot_particles.restart()
shell_particles.emit_particle(Transform2D(), Vector2(), Color(), Color(), 0)
return is_shot
@@ -1,10 +1,11 @@
[gd_scene load_steps=16 format=3 uid="uid://c4mlppn5i55bp"]
[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
@@ -94,18 +95,28 @@ animations = [{
"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="GPUParticles2D" type="GPUParticles2D" parent="." index="0"]
[node name="ShotParticles" type="GPUParticles2D" parent="." index="0"]
position = Vector2(17, 0)
emitting = false
amount = 32
texture = ExtResource("4_ydc6p")
lifetime = 0.09999999999999999
lifetime = 0.1
one_shot = true
process_material = SubResource("ParticleProcessMaterial_v064d")
@@ -114,7 +125,18 @@ position = Vector2(6, 0)
sprite_frames = SubResource("SpriteFrames_pjn33")
animation = &"player_shot"
[node name="Muzzle" parent="." index="2"]
[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"]
@@ -19,16 +19,12 @@ func shoot(ship_velocity: Vector2) -> bool:
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
_can_shoot = false
cooldown_timer.start()
_restart_particles()
shot_particles.restart()
shell_particles.emit_particle(Transform2D(), Vector2(), Color(), Color(), 0)
return is_shot
func _restart_particles() -> void:
shot_particles.restart()
shell_particles.restart()
func _on_animated_sprite_2d_animation_finished() -> void:
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
@@ -103,7 +103,7 @@ animations = [{
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_t57yr"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 1.0
inherit_velocity_ratio = 0.5
direction = Vector3(0, 1, 0)
spread = 15.0
initial_velocity_min = 15.0
@@ -131,20 +131,20 @@ position = Vector2(7, 0)
sprite_frames = SubResource("SpriteFrames_he4pe")
animation = &"player_shot"
[node name="CooldownTimer" type="Timer" parent="." index="2"]
wait_time = 0.6
one_shot = true
[node name="ShellParticles" type="GPUParticles2D" parent="." index="3"]
[node name="ShellParticles" type="GPUParticles2D" parent="." index="2"]
z_index = 1
position = Vector2(-1, 1)
emitting = false
amount = 1
amount = 15
texture = ExtResource("6_gdolk")
lifetime = 2.0
lifetime = 3.0
one_shot = true
process_material = SubResource("ParticleProcessMaterial_t57yr")
[node name="CooldownTimer" type="Timer" parent="." index="3"]
wait_time = 0.6
one_shot = true
[node name="Muzzle" parent="." index="4"]
position = Vector2(14, 0)
+1 -2
View File
@@ -334,6 +334,5 @@ previous_reactor_scheme={
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
renderer/rendering_method="mobile"
2d/snap/snap_2d_transforms_to_pixel=true