Added debris after ship destroying
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://d2snum2pxc2ui"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://be7k64p2kel8b" path="res://game/entities/health_system/heath_bar.gd" id="1_bx561"]
|
||||
[ext_resource type="Script" uid="uid://be7k64p2kel8b" path="res://game/entities/health_system/health_bar.gd" id="1_bx561"]
|
||||
[ext_resource type="PackedScene" uid="uid://xbfxsiumbgkp" path="res://game/entities/health_system/health_bar_part.tscn" id="2_wb6me"]
|
||||
[ext_resource type="Texture2D" uid="uid://do586oblhwuc5" path="res://images/ships/health.png" id="3_fogsl"]
|
||||
|
||||
@@ -16,7 +16,7 @@ region = Rect2(0, 0, 32, 3)
|
||||
atlas = ExtResource("3_fogsl")
|
||||
region = Rect2(0, 3, 32, 3)
|
||||
|
||||
[node name="HeathBar" type="Control"]
|
||||
[node name="HealthBar" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_bx561")
|
||||
@@ -5,18 +5,6 @@ extends CharacterBody2D
|
||||
signal destroyed
|
||||
|
||||
|
||||
const WEAPON_SCENES : Dictionary[String, String] = {
|
||||
"cannon": "res://game/entities/weapons/cannon/cannon_weapon.tscn",
|
||||
"gatling": "res://game/entities/weapons/gatling/gatling_weapon.tscn",
|
||||
"laser": "res://game/entities/weapons/laser/laser_weapon.tscn",
|
||||
"launcher": "res://game/entities/weapons/launcher/launcher_weapon.tscn",
|
||||
"minelayer": "res://game/entities/weapons/minelayer/minelayer_weapon.tscn",
|
||||
"plasma": "res://game/entities/weapons/plasma/plasma_weapon.tscn",
|
||||
"railgun": "res://game/entities/weapons/railgun/railgun_weapon.tscn",
|
||||
"shrapnel": "res://game/entities/weapons/shrapnel/shrapnel_weapon.tscn",
|
||||
"tesla": "res://game/entities/weapons/tesla/tesla_weapon.tscn",
|
||||
}
|
||||
|
||||
const SHADER_INTENSITY = "shader_parameter/intensity"
|
||||
|
||||
|
||||
@@ -33,10 +21,15 @@ var weapon_positions: Array[Vector2]
|
||||
var _weapons : Array[AbstractWeapon]
|
||||
|
||||
|
||||
@onready var ship : Node2D = $Ship
|
||||
@onready var ship_sprite : Sprite2D = $ShipSprite
|
||||
@onready var armor_sprite : Sprite2D = $ArmorSprite
|
||||
@onready var shield_sprite : Sprite2D = $ShieldSprite
|
||||
|
||||
@onready var health_bar : HealthBar = $HealthBar
|
||||
|
||||
@onready var debris_particles : GPUParticles2D = $DebrisParticles
|
||||
|
||||
@onready var health : Health = $Health
|
||||
|
||||
|
||||
@@ -95,8 +88,14 @@ func _get_new_speed(accel: float, decel: float, current_speed: float) -> float:
|
||||
|
||||
|
||||
func _on_health_depleted() -> void:
|
||||
queue_free()
|
||||
destroyed.emit()
|
||||
for weapon in _weapons:
|
||||
weapon.queue_free()
|
||||
_weapons.clear()
|
||||
ship_sprite.hide()
|
||||
armor_sprite.hide()
|
||||
shield_sprite.hide()
|
||||
health_bar.hide()
|
||||
debris_particles.emitting = true
|
||||
|
||||
|
||||
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
|
||||
@@ -123,3 +122,8 @@ func _on_armor_updated(value: int, max_value: int) -> void:
|
||||
|
||||
func _on_hull_updated(_value: int, _max_value: int) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_debris_particles_finished() -> void:
|
||||
queue_free()
|
||||
destroyed.emit()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://jvyagshykmgb"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://jvyagshykmgb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cesibaqtrgotl" path="res://game/entities/ships/abstract_ship.gd" id="1_6isjb"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/entities/ships/shield.gdshader" id="2_dokxo"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/shaders/shield.gdshader" id="2_dokxo"]
|
||||
[ext_resource type="PackedScene" uid="uid://clkymhkv3cevm" path="res://game/entities/health_system/health.tscn" id="2_xxtvk"]
|
||||
[ext_resource type="PackedScene" uid="uid://d2snum2pxc2ui" path="res://game/entities/health_system/heath_bar.tscn" id="3_l62e5"]
|
||||
[ext_resource type="PackedScene" uid="uid://d2snum2pxc2ui" path="res://game/entities/health_system/health_bar.tscn" id="3_l62e5"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dokxo"]
|
||||
resource_local_to_scene = true
|
||||
@@ -19,12 +19,32 @@ shader_parameter/speed = 5.0
|
||||
shader_parameter/scale = 20.0
|
||||
shader_parameter/intensity = 1.0
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_bkxo4"]
|
||||
particles_animation = true
|
||||
particles_anim_h_frames = 8
|
||||
particles_anim_v_frames = 4
|
||||
particles_anim_loop = false
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_dokxo"]
|
||||
lifetime_randomness = 0.5
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 16.0
|
||||
inherit_velocity_ratio = 0.3
|
||||
spread = 180.0
|
||||
initial_velocity_min = 5.0
|
||||
initial_velocity_max = 25.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
anim_offset_max = 1.0
|
||||
|
||||
[node name="AbstractShip" type="CharacterBody2D"]
|
||||
disable_mode = 1
|
||||
motion_mode = 1
|
||||
wall_min_slide_angle = 3.1415927
|
||||
script = ExtResource("1_6isjb")
|
||||
|
||||
[node name="Ship" type="Node2D" parent="."]
|
||||
|
||||
[node name="ShipSprite" type="Sprite2D" parent="."]
|
||||
|
||||
[node name="ArmorSprite" type="Sprite2D" parent="."]
|
||||
@@ -37,10 +57,19 @@ material = SubResource("ShaderMaterial_bkxo4")
|
||||
|
||||
[node name="Health" parent="." instance=ExtResource("2_xxtvk")]
|
||||
|
||||
[node name="HeathBar" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
|
||||
[node name="HealthBar" parent="." node_paths=PackedStringArray("health") instance=ExtResource("3_l62e5")]
|
||||
z_index = 51
|
||||
health = NodePath("../Health")
|
||||
|
||||
[node name="WeaponSlots" type="Node2D" parent="."]
|
||||
|
||||
[node name="DebrisParticles" type="GPUParticles2D" parent="."]
|
||||
material = SubResource("CanvasItemMaterial_bkxo4")
|
||||
emitting = false
|
||||
lifetime = 2.0
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource("ParticleProcessMaterial_dokxo")
|
||||
|
||||
[connection signal="depleted" from="Health" to="." method="_on_health_depleted"]
|
||||
[connection signal="finished" from="DebrisParticles" to="." method="_on_debris_particles_finished"]
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dwsn0lf1e3578"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dwsn0lf1e3578"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://jvyagshykmgb" path="res://game/entities/ships/abstract_ship.tscn" id="1_28j6l"]
|
||||
[ext_resource type="Script" uid="uid://byicf1t0807pq" path="res://game/entities/ships/enemies/abstract_enemy_ship.gd" id="2_fwvrd"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/entities/ships/shield.gdshader" id="3_6nnf4"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/shaders/shield.gdshader" id="3_6nnf4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsqehbymixust" path="res://game/controllers/enemy_controller.tscn" id="3_l8c0n"]
|
||||
[ext_resource type="Texture2D" uid="uid://nx7sl808ghaj" path="res://images/projectiles/debris_enemy.png" id="5_6nnf4"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dlmr1"]
|
||||
resource_local_to_scene = true
|
||||
@@ -35,6 +36,9 @@ ship = NodePath("..")
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." index="5"]
|
||||
|
||||
[node name="DebrisParticles" parent="." index="9"]
|
||||
texture = ExtResource("5_6nnf4")
|
||||
|
||||
[connection signal="accelerate" from="EnemyController" to="." method="accelerate"]
|
||||
[connection signal="screen_entered" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_entered"]
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://dwsn0lf1e3578" path="res://game/entities/ships/enemies/abstract_enemy_ship.tscn" id="1_wvvpj"]
|
||||
[ext_resource type="Script" uid="uid://cxomr1oojcrcl" path="res://game/entities/ships/enemies/heavy/heavy_enemy_ship.gd" id="2_3umer"]
|
||||
[ext_resource type="Texture2D" uid="uid://5cgq8o5oqunq" path="res://images/ships/enemies/heavy.png" id="3_xqe8d"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/entities/ships/shield.gdshader" id="4_qawoi"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/shaders/shield.gdshader" id="4_qawoi"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_xqe8d"]
|
||||
atlas = ExtResource("3_xqe8d")
|
||||
@@ -58,7 +58,7 @@ rect = Rect2(-29, -21, 58, 42)
|
||||
[node name="Health" parent="." index="6"]
|
||||
max_hull = 200
|
||||
|
||||
[node name="HeathBar" parent="." index="7"]
|
||||
[node name="HealthBar" parent="." index="7"]
|
||||
offset_top = 27.0
|
||||
offset_bottom = 27.0
|
||||
|
||||
@@ -70,3 +70,6 @@ position = Vector2(8, -16)
|
||||
|
||||
[node name="Third" type="Node2D" parent="WeaponSlots" index="2"]
|
||||
position = Vector2(8, 16)
|
||||
|
||||
[node name="DebrisParticles" parent="." index="9"]
|
||||
amount = 32
|
||||
|
||||
@@ -1,17 +1,32 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cye5ndbh0ht7w"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://cye5ndbh0ht7w"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dwsn0lf1e3578" path="res://game/entities/ships/enemies/abstract_enemy_ship.tscn" id="1_16owb"]
|
||||
[ext_resource type="Script" uid="uid://dcpqrdvp4nk82" path="res://game/entities/ships/enemies/medium/medium_enemy_ship.gd" id="2_dgwiy"]
|
||||
[ext_resource type="Texture2D" uid="uid://dkwvm246s0wnd" path="res://images/ships/enemies/medium.png" id="3_d2xji"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/shaders/shield.gdshader" id="4_om3xa"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d2xji"]
|
||||
atlas = ExtResource("3_d2xji")
|
||||
region = Rect2(0, 0, 48, 32)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jorhn"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("4_om3xa")
|
||||
shader_parameter/speed = 0.0
|
||||
shader_parameter/scale = 20.0
|
||||
shader_parameter/intensity = 1.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_om3xa"]
|
||||
atlas = ExtResource("3_d2xji")
|
||||
region = Rect2(0, 32, 48, 32)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ren2c"]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource("4_om3xa")
|
||||
shader_parameter/speed = 5.0
|
||||
shader_parameter/scale = 20.0
|
||||
shader_parameter/intensity = 1.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jorhn"]
|
||||
atlas = ExtResource("3_d2xji")
|
||||
region = Rect2(0, 64, 48, 32)
|
||||
@@ -27,9 +42,11 @@ mass = 250
|
||||
texture = SubResource("AtlasTexture_d2xji")
|
||||
|
||||
[node name="ArmorSprite" parent="." index="1"]
|
||||
material = SubResource("ShaderMaterial_jorhn")
|
||||
texture = SubResource("AtlasTexture_om3xa")
|
||||
|
||||
[node name="ShieldSprite" parent="." index="2"]
|
||||
material = SubResource("ShaderMaterial_ren2c")
|
||||
texture = SubResource("AtlasTexture_jorhn")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="." index="3"]
|
||||
@@ -41,7 +58,7 @@ rect = Rect2(-13, -21, 26, 42)
|
||||
[node name="Health" parent="." index="6"]
|
||||
max_hull = 100
|
||||
|
||||
[node name="HeathBar" parent="." index="7"]
|
||||
[node name="HealthBar" parent="." index="7"]
|
||||
offset_top = 19.0
|
||||
offset_bottom = 19.0
|
||||
|
||||
@@ -50,3 +67,6 @@ position = Vector2(4, -8)
|
||||
|
||||
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
|
||||
position = Vector2(4, 8)
|
||||
|
||||
[node name="DebrisParticles" parent="." index="9"]
|
||||
amount = 16
|
||||
|
||||
@@ -41,7 +41,7 @@ rect = Rect2(-13, -5, 26, 10)
|
||||
[node name="Health" parent="." index="6"]
|
||||
max_hull = 50
|
||||
|
||||
[node name="HeathBar" parent="." index="7"]
|
||||
[node name="HealthBar" parent="." index="7"]
|
||||
offset_top = 11.0
|
||||
offset_bottom = 11.0
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://br074cqcnul3d"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://br074cqcnul3d"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://jvyagshykmgb" path="res://game/entities/ships/abstract_ship.tscn" id="1_6otxb"]
|
||||
[ext_resource type="Script" uid="uid://ruxw1n03iq4i" path="res://game/entities/ships/player/player_ship.gd" id="2_625ti"]
|
||||
[ext_resource type="PackedScene" uid="uid://dh1oj1w5wx4je" path="res://game/controllers/player_controller.tscn" id="3_4mjo1"]
|
||||
[ext_resource type="Texture2D" uid="uid://y2yfli24n51v" path="res://images/ships/player.png" id="3_uf2n1"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/entities/ships/shield.gdshader" id="4_ui1ht"]
|
||||
[ext_resource type="Shader" uid="uid://dwh22f35u5qqi" path="res://game/shaders/shield.gdshader" id="4_ui1ht"]
|
||||
[ext_resource type="PackedScene" uid="uid://d20nvskf38vpo" path="res://game/entities/ships/player/blink_charge_indicator.tscn" id="5_uf2n1"]
|
||||
[ext_resource type="Texture2D" uid="uid://bq7eqj7n3dplh" path="res://images/projectiles/debris_player.png" id="7_waejo"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4mjo1"]
|
||||
atlas = ExtResource("3_uf2n1")
|
||||
@@ -55,25 +56,21 @@ deceleration = 46
|
||||
max_speed = 92
|
||||
mass = 250
|
||||
|
||||
[node name="ShipSprite" parent="." index="0"]
|
||||
[node name="ShipSprite" parent="." index="1"]
|
||||
texture = SubResource("AtlasTexture_4mjo1")
|
||||
|
||||
[node name="ArmorSprite" parent="." index="1"]
|
||||
[node name="ArmorSprite" parent="." index="2"]
|
||||
material = SubResource("ShaderMaterial_waejo")
|
||||
texture = SubResource("AtlasTexture_uf2n1")
|
||||
|
||||
[node name="ShieldSprite" parent="." index="2"]
|
||||
[node name="ShieldSprite" parent="." index="3"]
|
||||
material = SubResource("ShaderMaterial_5xifi")
|
||||
texture = SubResource("AtlasTexture_ui1ht")
|
||||
|
||||
[node name="CollisionPolygon2D" parent="." index="3"]
|
||||
polygon = PackedVector2Array(-23, -10, -17, -14, -3, -15, 21, -13, 22, -12, 22, 12, 21, 13, -3, 15, -17, 14, -23, 10)
|
||||
|
||||
[node name="PlayerController" parent="." index="4" instance=ExtResource("3_4mjo1")]
|
||||
|
||||
[node name="Health" parent="." index="5"]
|
||||
max_shield = 250
|
||||
max_hull = 1000
|
||||
[node name="CollisionPolygon2D" parent="." index="5"]
|
||||
polygon = PackedVector2Array(-23, -10, -17, -14, -3, -15, 21, -13, 22, -12, 22, 12, 21, 13, -3, 15, -17, 14, -23, 10)
|
||||
|
||||
[node name="BlinkTimer" type="Timer" parent="." index="6"]
|
||||
process_callback = 0
|
||||
@@ -88,18 +85,26 @@ lifetime = 0.1
|
||||
one_shot = true
|
||||
process_material = SubResource("ParticleProcessMaterial_pjmi2")
|
||||
|
||||
[node name="HeathBar" parent="." index="8"]
|
||||
[node name="Health" parent="." index="8"]
|
||||
max_shield = 250
|
||||
max_hull = 1000
|
||||
|
||||
[node name="HealthBar" parent="." index="9"]
|
||||
offset_top = 19.0
|
||||
offset_bottom = 19.0
|
||||
|
||||
[node name="BlinkChargeIndicator" parent="." index="10" instance=ExtResource("5_uf2n1")]
|
||||
position = Vector2(-11, 0)
|
||||
|
||||
[node name="First" type="Node2D" parent="WeaponSlots" index="0"]
|
||||
position = Vector2(-2, -8)
|
||||
|
||||
[node name="Second" type="Node2D" parent="WeaponSlots" index="1"]
|
||||
position = Vector2(-2, 8)
|
||||
|
||||
[node name="BlinkChargeIndicator" parent="." index="10" instance=ExtResource("5_uf2n1")]
|
||||
position = Vector2(-11, 0)
|
||||
[node name="DebrisParticles" parent="." index="12"]
|
||||
amount = 16
|
||||
texture = ExtResource("7_waejo")
|
||||
|
||||
[connection signal="accelerate" from="PlayerController" to="." method="accelerate"]
|
||||
[connection signal="blink" from="PlayerController" to="." method="_blink"]
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float speed = 5.0;
|
||||
uniform float scale = 20.0;
|
||||
uniform float intensity = 1;
|
||||
uniform sampler2D noise;
|
||||
|
||||
float rand(vec2 coord) {
|
||||
return fract(sin(dot(coord, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float cellular(vec2 coord) {
|
||||
vec2 i = floor(coord);
|
||||
vec2 f = fract(coord);
|
||||
|
||||
float min_dist = 1.0;
|
||||
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec2 neighbor = vec2(float(x), float(y));
|
||||
vec2 point = vec2(rand(i + neighbor), rand(i + neighbor + vec2(1000.0)));
|
||||
point = 0.5 * sin(TIME * speed + 6.2831 * point);
|
||||
vec2 diff = neighbor + point - f;
|
||||
float dist = length(diff);
|
||||
min_dist = min(min_dist, dist);
|
||||
}
|
||||
}
|
||||
|
||||
return min_dist;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
if (COLOR.a != 0.0) {
|
||||
vec2 coord = UV * scale;
|
||||
|
||||
float pattern = cellular(coord);
|
||||
|
||||
COLOR = vec4(COLOR.rgb, (pattern > intensity) ? 0.0 : 1.0);
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://dwh22f35u5qqi
|
||||
@@ -4,7 +4,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://cpn5x0ijgl7ei" path="res://game/controllers/enemy_swamp_controller.tscn" id="2_72vqi"]
|
||||
[ext_resource type="PackedScene" uid="uid://br074cqcnul3d" path="res://game/entities/ships/player/player_ship.tscn" id="3_r3x05"]
|
||||
[ext_resource type="PackedScene" uid="uid://chdrjc7c6bdpb" path="res://game/entities/world/background.tscn" id="4_cuj01"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1n7qejdcrpkf" path="res://images/projectiles/passage_process.png" id="5_yetnv"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1n7qejdcrpkf" path="res://images/passage/passage_process.png" id="5_yetnv"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_ltkyg"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user