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,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://pfvs7wqrnn08"]
[ext_resource type="Script" uid="uid://clt20ebs6shkm" path="res://game/entities/other/blast.gd" id="1_2fpxy"]
[ext_resource type="Script" uid="uid://clt20ebs6shkm" path="res://game/entities/explosions/blast.gd" id="1_2fpxy"]
[node name="Blast" type="Area2D"]
script = ExtResource("1_2fpxy")
@@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://bhxib2ltpkcbf"]
[ext_resource type="Texture2D" uid="uid://gh7mwehpqfco" path="res://particle_textures/flame_medium.tres" id="1_6awlt"]
[ext_resource type="Script" uid="uid://dhnjdam04g4tb" path="res://game/entities/other/explosion_particles.gd" id="1_w1d42"]
[ext_resource type="Script" uid="uid://dhnjdam04g4tb" path="res://game/entities/explosions/explosion_particles.gd" id="1_w1d42"]
[ext_resource type="Texture2D" uid="uid://b13al44e8ofsx" path="res://particle_textures/flame_large.tres" id="2_w1d42"]
[ext_resource type="Texture2D" uid="uid://blp4o1c7y66wv" path="res://particle_textures/flame_huge.tres" id="3_lplfr"]
+86
View File
@@ -0,0 +1,86 @@
class_name Health
extends Node
signal shield_updated(value: int, max_value: int)
signal armor_updated(value: int, max_value: int)
signal hull_updated(value: int, max_value: int)
signal depleted
@export_range(0, 5000) var max_shield: int = 0:
set(value):
max_shield = value
shield_updated.emit(shield, max_shield)
@export_range(0, 5000) var max_armor: int = 0:
set(value):
max_armor = value
armor_updated.emit(armor, max_armor)
@export_range(1, 5000) var max_hull: int = 1:
set(value):
max_hull = value
hull_updated.emit(hull, max_hull)
var shield: int:
set(value):
shield = value
shield_updated.emit(shield, max_shield)
var armor: int:
set(value):
armor = value
armor_updated.emit(armor, max_armor)
var hull: int:
set(value):
hull = value
hull_updated.emit(hull, max_hull)
@onready var shield_regen_delay_timer : Timer = $ShieldRegenDelayTimer
@onready var shield_regen_tick_timer : Timer = $ShieldRegenTickTimer
@onready var _shield_regen := floori(max_shield/30.0)
func _ready() -> void:
shield = max_shield
armor = max_armor
hull = max_hull
func apply_damage(damage: AbstractDamage) -> void:
if shield > 0:
var damage_value := ceili(damage.value * damage.shield_damage_multiplier())
shield = max(shield - damage_value, 0)
shield_regen_delay_timer.start()
elif armor > 0:
var damage_value := ceili(damage.value * damage.armor_damage_multiplier())
armor = max(armor - damage_value, 0)
else:
if hull == 0: return
var damage_value := ceili(damage.value * damage.hull_damage_multiplier())
hull = max(hull - damage_value, 0)
if hull == 0:
depleted.emit()
if not shield_regen_delay_timer.is_stopped():
shield_regen_delay_timer.start()
shield_regen_tick_timer.stop()
func _on_shield_regen_delay_timer_timeout() -> void:
shield_regen_tick_timer.start()
func _on_shield_regen_tick_timer_timeout() -> void:
var new_shield_value := shield + _shield_regen
if new_shield_value >= max_shield:
new_shield_value = max_shield
shield_regen_tick_timer.stop()
shield = new_shield_value
@@ -0,0 +1 @@
uid://d3g4xbq45qmpr
+16
View File
@@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://clkymhkv3cevm"]
[ext_resource type="Script" uid="uid://d3g4xbq45qmpr" path="res://game/entities/health_system/health.gd" id="1_gwdg4"]
[node name="Health" type="Node"]
script = ExtResource("1_gwdg4")
[node name="ShieldRegenDelayTimer" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
[node name="ShieldRegenTickTimer" type="Timer" parent="."]
wait_time = 0.1
[connection signal="timeout" from="ShieldRegenDelayTimer" to="." method="_on_shield_regen_delay_timer_timeout"]
[connection signal="timeout" from="ShieldRegenTickTimer" to="." method="_on_shield_regen_tick_timer_timeout"]
@@ -0,0 +1,61 @@
class_name HealthBarPart
extends Control
const TICK_COUNT = 5
@export var texture_value : Texture2D
@export var texture_shade : Texture2D
var _tick_size : int = 0
var _target_value: float = 0
@onready var value_bar : TextureProgressBar = $ValueBar
@onready var shade_bar : TextureProgressBar = $ShadeBar
@onready var shade_delay_timer : Timer = $ShadeDelayTimer
@onready var shade_tick_timer : Timer = $ShadeTickTimer
func _ready() -> void:
value_bar.texture_progress = texture_value
shade_bar.texture_progress = texture_shade
func set_value(value: int) -> void:
if value_bar.value == value: return
value_bar.value = value
if shade_bar.value < value_bar.value:
shade_bar.value = value_bar.value
else:
shade_delay_timer.start()
func set_max_value(max_value: int) -> void:
value_bar.max_value = max_value
shade_bar.max_value = max_value
if max_value == 0:
value_bar.hide()
shade_bar.hide()
else:
value_bar.show()
shade_bar.show()
func _on_shade_delay_timer_timeout() -> void:
var value_delta := shade_bar.value - value_bar.value
_tick_size = ceil(value_delta / TICK_COUNT)
_target_value = value_bar.value
shade_tick_timer.start()
func _on_shade_tick_timer_timeout() -> void:
shade_bar.value -= _tick_size
if shade_bar.value <= _target_value:
shade_bar.value = _target_value
shade_tick_timer.stop()
@@ -0,0 +1 @@
uid://drwgq8fxaclvn
@@ -0,0 +1,48 @@
[gd_scene load_steps=2 format=3 uid="uid://xbfxsiumbgkp"]
[ext_resource type="Script" uid="uid://drwgq8fxaclvn" path="res://game/entities/health_system/health_bar_part.gd" id="1_nuv67"]
[node name="HealthBarPart" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_nuv67")
[node name="ShadeBar" type="TextureProgressBar" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -16.0
offset_top = -1.0
offset_right = 16.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(16, 1)
[node name="ValueBar" type="TextureProgressBar" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -16.0
offset_top = -1.0
offset_right = 16.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset = Vector2(16, 1)
[node name="ShadeDelayTimer" type="Timer" parent="."]
wait_time = 0.5
one_shot = true
[node name="ShadeTickTimer" type="Timer" parent="."]
wait_time = 0.1
[connection signal="timeout" from="ShadeDelayTimer" to="." method="_on_shade_delay_timer_timeout"]
[connection signal="timeout" from="ShadeTickTimer" to="." method="_on_shade_tick_timer_timeout"]
+22
View File
@@ -0,0 +1,22 @@
class_name HealthBar
extends Control
@export var health: Health
@onready var hull_part : HealthBarPart = $HullPart
func _ready() -> void:
if not health: return
hull_part.set_max_value(health.max_hull)
hull_part.set_value(health.hull)
health.hull_updated.connect(_on_hull_updated)
func _on_hull_updated(value: int, max_value: int) -> void:
hull_part.set_value(value)
hull_part.set_max_value(max_value)
@@ -0,0 +1 @@
uid://be7k64p2kel8b
@@ -0,0 +1,36 @@
[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="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/health.png" id="3_fogsl"]
[sub_resource type="AtlasTexture" id="AtlasTexture_sgr4k"]
atlas = ExtResource("3_fogsl")
region = Rect2(0, 6, 32, 3)
[sub_resource type="AtlasTexture" id="AtlasTexture_wb6me"]
atlas = ExtResource("3_fogsl")
region = Rect2(0, 0, 32, 3)
[sub_resource type="AtlasTexture" id="AtlasTexture_fogsl"]
atlas = ExtResource("3_fogsl")
region = Rect2(0, 3, 32, 3)
[node name="HeathBar" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_bx561")
[node name="Background" type="TextureRect" parent="."]
layout_mode = 0
offset_left = -16.0
offset_top = -1.0
offset_right = 16.0
offset_bottom = 2.0
pivot_offset = Vector2(16, 1)
texture = SubResource("AtlasTexture_sgr4k")
[node name="HullPart" parent="." instance=ExtResource("2_wb6me")]
layout_mode = 0
texture_value = SubResource("AtlasTexture_wb6me")
texture_shade = SubResource("AtlasTexture_fogsl")
-1
View File
@@ -101,7 +101,6 @@ func _on_health_depleted() -> void:
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
weapon.position = weapon_position
weapon.rotation_degrees = weapon_rotation
add_child(weapon)
_weapons.append(weapon)
+2 -2
View File
@@ -2,8 +2,8 @@
[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="PackedScene" uid="uid://clkymhkv3cevm" path="res://game/health_system/health.tscn" id="2_xxtvk"]
[ext_resource type="PackedScene" uid="uid://d2snum2pxc2ui" path="res://game/health_system/health_bar/heath_bar.tscn" id="3_l62e5"]
[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"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dokxo"]
resource_local_to_scene = true
@@ -18,11 +18,6 @@ func _physics_process(delta: float) -> void:
shoot()
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
super._add_weapon(weapon, weapon_position)
weapon.set_belonging(AbstractWeapon.Belonging.ENEMY)
func _on_visible_on_screen_notifier_2d_screen_entered() -> void:
is_on_screen = true
@@ -42,12 +37,6 @@ func _set_enemy_data(data: EnemyData) -> void:
positions.remove_at(0)
for i in range(min(enemy_data.weapon_count, positions.size())):
var weapon : AbstractWeapon = enemy_data.weapon.scene.instantiate()
_add_weapon(weapon, weapon_positions[i])
func _create_weapon(weapon_id : String) -> AbstractWeapon:
var weapon_scene : PackedScene = load(WEAPON_SCENES[weapon_id])
var weapon : AbstractWeapon = weapon_scene.instantiate()
weapon_type = weapon.type
return weapon
var weapon_scene := enemy_data.weapon.enemy_scene
var weapon : AbstractWeapon = weapon_scene.instantiate()
_add_weapon(weapon, positions[i])
@@ -1,4 +1,4 @@
[gd_scene load_steps=6 format=3 uid="uid://dwsn0lf1e3578"]
[gd_scene load_steps=7 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"]
@@ -12,15 +12,24 @@ shader_parameter/speed = 0.0
shader_parameter/scale = 20.0
shader_parameter/intensity = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_l8c0n"]
resource_local_to_scene = true
shader = ExtResource("3_6nnf4")
shader_parameter/speed = 5.0
shader_parameter/scale = 20.0
shader_parameter/intensity = 1.0
[node name="AbstractEnemyShip" groups=["enemies"] instance=ExtResource("1_28j6l")]
collision_layer = 4
collision_mask = 6
script = ExtResource("2_fwvrd")
weapon_rotation = 180
[node name="ArmorSprite" parent="." index="1"]
material = SubResource("ShaderMaterial_dlmr1")
[node name="ShieldSprite" parent="." index="2"]
material = SubResource("ShaderMaterial_l8c0n")
[node name="EnemyController" parent="." index="4" node_paths=PackedStringArray("ship") instance=ExtResource("3_l8c0n")]
ship = NodePath("..")
@@ -1,17 +1,32 @@
[gd_scene load_steps=7 format=3 uid="uid://d3epy8w15qmjm"]
[gd_scene load_steps=10 format=3 uid="uid://d3epy8w15qmjm"]
[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"]
[sub_resource type="AtlasTexture" id="AtlasTexture_xqe8d"]
atlas = ExtResource("3_xqe8d")
region = Rect2(0, 0, 64, 48)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_c4do6"]
resource_local_to_scene = true
shader = ExtResource("4_qawoi")
shader_parameter/speed = 0.0
shader_parameter/scale = 20.0
shader_parameter/intensity = 1.0
[sub_resource type="AtlasTexture" id="AtlasTexture_qawoi"]
atlas = ExtResource("3_xqe8d")
region = Rect2(0, 48, 64, 48)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6d574"]
resource_local_to_scene = true
shader = ExtResource("4_qawoi")
shader_parameter/speed = 5.0
shader_parameter/scale = 20.0
shader_parameter/intensity = 1.0
[sub_resource type="AtlasTexture" id="AtlasTexture_c4do6"]
atlas = ExtResource("3_xqe8d")
region = Rect2(0, 96, 64, 48)
@@ -27,9 +42,11 @@ mass = 600
texture = SubResource("AtlasTexture_xqe8d")
[node name="ArmorSprite" parent="." index="1"]
material = SubResource("ShaderMaterial_c4do6")
texture = SubResource("AtlasTexture_qawoi")
[node name="ShieldSprite" parent="." index="2"]
material = SubResource("ShaderMaterial_6d574")
texture = SubResource("AtlasTexture_c4do6")
[node name="CollisionPolygon2D" parent="." index="3"]
+1 -6
View File
@@ -40,11 +40,6 @@ func _physics_process(delta: float) -> void:
blink_charge_indicator.value = blink_charge
func _add_weapon(weapon: AbstractWeapon, weapon_position: Vector2) -> void:
super._add_weapon(weapon, weapon_position)
weapon.set_belonging(AbstractWeapon.Belonging.PLAYER)
func _blink(direction: Vector2) -> void:
if blink_charge < BLINK_CHARGE_MAXIMUM: return
@@ -70,7 +65,7 @@ func _set_player_data(new_data: PlayerData) -> void:
player_data = new_data
_weapons.clear()
for i in range(min(player_data.weapons.size(), weapon_positions.size())):
var weapon_scene := player_data.weapons[i].scene
var weapon_scene := player_data.weapons[i].player_scene
var weapon : AbstractWeapon = weapon_scene.instantiate()
_add_weapon(weapon, weapon_positions[i])
@@ -1,4 +1,4 @@
class_name BlastProjectile
class_name AbstractBlastProjectile
extends AbstractProjectile
@@ -19,11 +19,3 @@ func _try_to_damage_by_blast() -> bool:
if _try_to_damage(overlapping_body, damage):
damaged = true
return damaged
func _apply_collision_mask() -> void:
super._apply_collision_mask()
if blast:
_apply_collision_mask_to_area(blast)
@@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://betr5ry5tc75e"]
[ext_resource type="PackedScene" uid="uid://ybkqaynvpcjm" path="res://game/entities/weapons/abstract_projectile.tscn" id="1_pd7f6"]
[ext_resource type="Script" uid="uid://bg8yrenh7x03b" path="res://game/entities/weapons/blast_projectile.gd" id="2_5vx6r"]
[ext_resource type="PackedScene" uid="uid://pfvs7wqrnn08" path="res://game/entities/other/blast.tscn" id="3_r3k86"]
[ext_resource type="Script" uid="uid://bg8yrenh7x03b" path="res://game/entities/weapons/abstract_blast_projectile.gd" id="2_5vx6r"]
[ext_resource type="PackedScene" uid="uid://pfvs7wqrnn08" path="res://game/entities/explosions/blast.tscn" id="3_r3k86"]
[node name="BlastProjectile" instance=ExtResource("1_pd7f6")]
script = ExtResource("2_5vx6r")
@@ -1,4 +1,4 @@
class_name DirectHitProjectile
class_name AbstractDirectHitProjectile
extends AbstractProjectile
@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://cdv5n4t47hr8i"]
[ext_resource type="PackedScene" uid="uid://ybkqaynvpcjm" path="res://game/entities/weapons/abstract_projectile.tscn" id="1_klynw"]
[ext_resource type="Script" uid="uid://blqs7hyu33qhu" path="res://game/entities/weapons/direct_hit_projectile.gd" id="2_0vgnq"]
[ext_resource type="Script" uid="uid://blqs7hyu33qhu" path="res://game/entities/weapons/abstract_direct_hit_projectile.gd" id="2_0vgnq"]
[node name="DirectHitProjectile" instance=ExtResource("1_klynw")]
script = ExtResource("2_0vgnq")
+6 -41
View File
@@ -9,22 +9,11 @@ const ENEMY_PROJECTILE_LAYER = 16
@export_range(0, 1000) var speed : int = 0
@export var direction : Vector2
var direction : Vector2
var ship_velocity: Vector2
var collide_players: bool:
set(value):
collide_players = value
_apply_collision_mask()
var collide_enemies: bool:
set(value):
collide_enemies = value
_apply_collision_mask()
var _velocity: Vector2
@@ -35,34 +24,12 @@ var _velocity: Vector2
func _ready() -> void:
_velocity = direction.normalized() * speed + ship_velocity
_update_collision_rotation(_velocity)
_apply_collision_mask()
func _physics_process(delta: float) -> void:
position += _velocity * delta
func _apply_collision_mask() -> void:
_apply_collision_mask_to_area(self)
func _apply_collision_mask_to_area(area: Area2D) -> void:
if collide_players:
area.collision_layer |= ENEMY_PROJECTILE_LAYER
area.collision_mask |= PLAYER_LAYER
else:
area.collision_layer &= ~ENEMY_PROJECTILE_LAYER
area.collision_mask &= ~PLAYER_LAYER
if collide_enemies:
area.collision_layer |= PLAYER_PROJECTILE_LAYER
area.collision_mask |= ENEMY_LAYER
else:
area.collision_layer &= ~PLAYER_PROJECTILE_LAYER
area.collision_mask &= ~ENEMY_LAYER
func _update_collision_rotation(velocity: Vector2) -> void:
collision.rotation = velocity.angle() - 0.5 * PI
@@ -107,16 +74,14 @@ func _get_nearest_foe(filter: Array[AbstractShip] = []) -> AbstractShip:
func _get_foes(filter: Array[AbstractShip] = []) -> Array[AbstractShip]:
var foes : Array[AbstractShip] = []
var flags_by_group : Dictionary[String, bool] = {
"enemies": collide_enemies,
"players": collide_players,
}
var groups : Array[String] = [ "enemies", "players" ]
for group in flags_by_group:
if not flags_by_group[group]: continue
for group in groups:
var nodes := get_tree().get_nodes_in_group(group)
for node in nodes:
if not node in filter:
if not node is AbstractShip: continue
var ship := node as AbstractShip
if collision_mask & ship.collision_layer and not node in filter:
foes.append(node)
return foes
+5 -24
View File
@@ -2,38 +2,27 @@ class_name AbstractWeapon
extends Node2D
enum Belonging { PLAYER, ENEMY }
enum Type { NONE, SHORT_RANGE, MEDIUM_RANGE, LONG_RANGE, HOMING, MINES }
const PREFIXES := {
Belonging.PLAYER: "player",
Belonging.ENEMY: "enemy",
}
const SHOT_POSTFIX = "_shot"
const IDLE_POSTFIX = "_idle"
const RELOAD_POSTFIX = "_reloading"
const IDLE_ANIMATION = "idle"
const SHOT_ANIMATION = "shot"
const RELOAD_ANIMATION = "reloading"
@export_range(1, 100) var bullet_per_shot : int = 1
@export_range(0, 360) var sector_angle : int = 0
@export var Projectile : PackedScene
@export var projectile_scene : PackedScene
@export var type := Type.NONE
var _belonging: Belonging
var _can_shoot := true
@onready var muzzle : Node2D = $Muzzle
func set_belonging(belonging: Belonging) -> void:
_belonging = belonging
func shoot(ship_velocity: Vector2) -> bool:
if not _can_shoot: return false
@@ -52,18 +41,10 @@ func _get_projectile_position() -> Vector2:
func _create_projectile(ship_velocity: Vector2) -> AbstractProjectile:
var projectile : AbstractProjectile = Projectile.instantiate()
var projectile : AbstractProjectile = projectile_scene.instantiate()
projectile.global_position = global_position
projectile.ship_velocity = ship_velocity
match _belonging:
Belonging.PLAYER:
projectile.direction = Vector2.RIGHT
projectile.collide_enemies = true
Belonging.ENEMY:
projectile.direction = Vector2.LEFT
projectile.collide_players = true
if sector_angle > 0:
var sector_rad := deg_to_rad(sector_angle)
var random_angle := randfn(0.0, sector_rad / 6.0)
@@ -1,5 +1,5 @@
class_name CannonProjectile
extends BlastProjectile
class_name AbstractCannonProjectile
extends AbstractBlastProjectile
@onready var sprite : Sprite2D = $Sprite2D
@@ -1,10 +1,10 @@
[gd_scene load_steps=11 format=3 uid="uid://cgi7wd84kjnyw"]
[ext_resource type="PackedScene" uid="uid://betr5ry5tc75e" path="res://game/entities/weapons/blast_projectile.tscn" id="1_20qwt"]
[ext_resource type="Script" uid="uid://dfdh0o88as054" path="res://game/entities/weapons/cannon/cannon_projectile.gd" id="2_x3axw"]
[ext_resource type="Script" uid="uid://dftb7hg5f06b5" path="res://game/health_system/damage/explosion_damage.gd" id="3_lb11p"]
[ext_resource type="PackedScene" uid="uid://betr5ry5tc75e" path="res://game/entities/weapons/abstract_blast_projectile.tscn" id="1_20qwt"]
[ext_resource type="Script" uid="uid://dfdh0o88as054" path="res://game/entities/weapons/cannon/abstract_cannon_projectile.gd" id="2_x3axw"]
[ext_resource type="Script" uid="uid://dftb7hg5f06b5" path="res://game/data/damage/explosion_damage.gd" id="3_lb11p"]
[ext_resource type="Texture2D" uid="uid://oj86smpsipw4" path="res://images/projectiles.png" id="4_bb01p"]
[ext_resource type="PackedScene" uid="uid://bhxib2ltpkcbf" path="res://game/entities/other/explosion_particles.tscn" id="5_ugryq"]
[ext_resource type="PackedScene" uid="uid://bhxib2ltpkcbf" path="res://game/entities/explosions/explosion_particles.tscn" id="5_ugryq"]
[sub_resource type="AtlasTexture" id="AtlasTexture_ugryq"]
atlas = ExtResource("4_bb01p")
@@ -33,7 +33,7 @@ gravity = Vector3(0, 0, 0)
turbulence_enabled = true
turbulence_noise_speed = Vector3(0.1, 0.1, 0.1)
[node name="CannonProjectile" instance=ExtResource("1_20qwt")]
[node name="AbstractCannonProjectile" instance=ExtResource("1_20qwt")]
collision_layer = 0
collision_mask = 0
script = ExtResource("2_x3axw")
@@ -1,3 +1,4 @@
class_name AbstractCannonWeapon
extends AbstractWeapon
@@ -9,16 +10,14 @@ extends AbstractWeapon
@onready var cooldown_timer : Timer = $CooldownTimer
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:
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
sprite.play(SHOT_ANIMATION)
_can_shoot = false
cooldown_timer.start()
front_particles.restart()
@@ -30,7 +29,7 @@ func shoot(ship_velocity: Vector2) -> bool:
func _on_animated_sprite_2d_animation_finished() -> void:
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
sprite.play(IDLE_ANIMATION)
func _on_cooldown_timer_timeout() -> void:
@@ -1,15 +1,12 @@
[gd_scene load_steps=23 format=3 uid="uid://bccaoirwdkp7n"]
[gd_scene load_steps=11 format=3 uid="uid://bccaoirwdkp7n"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_xnbws"]
[ext_resource type="PackedScene" uid="uid://cgi7wd84kjnyw" path="res://game/entities/weapons/cannon/cannon_projectile.tscn" id="2_2bjeu"]
[ext_resource type="Script" uid="uid://db24dm76b1am7" path="res://game/entities/weapons/cannon/cannon_weapon.gd" id="2_ew5um"]
[ext_resource type="Script" uid="uid://db24dm76b1am7" path="res://game/entities/weapons/cannon/abstract_cannon_weapon.gd" id="2_ew5um"]
[ext_resource type="Texture2D" uid="uid://b13al44e8ofsx" path="res://particle_textures/flame_large.tres" id="4_i0ica"]
[ext_resource type="Texture2D" uid="uid://b2tpy3y2bpuat" path="res://particle_textures/flame_small.tres" id="5_377p4"]
[ext_resource type="Texture2D" uid="uid://bi1s5xrnunw3c" path="res://particle_textures/shell_large.tres" id="6_i0ica"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_jfd4t"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_377p4"]
resource_local_to_scene = true
lifetime_randomness = 0.4
particle_flag_disable_z = true
angle_min = -179.99998
@@ -21,7 +18,6 @@ initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_i0ica"]
resource_local_to_scene = true
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
@@ -36,7 +32,6 @@ initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_jfd4t"]
resource_local_to_scene = true
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
@@ -50,119 +45,25 @@ initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_jfd4t"]
atlas = ExtResource("6_jfd4t")
region = Rect2(0, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_i0ica"]
atlas = ExtResource("6_jfd4t")
region = Rect2(32, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_377p4"]
atlas = ExtResource("6_jfd4t")
region = Rect2(64, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_nrbut"]
atlas = ExtResource("6_jfd4t")
region = Rect2(96, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_mk6k8"]
atlas = ExtResource("6_jfd4t")
region = Rect2(128, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_fxfcx"]
atlas = ExtResource("6_jfd4t")
region = Rect2(0, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_dvc0n"]
atlas = ExtResource("6_jfd4t")
region = Rect2(32, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_caj01"]
atlas = ExtResource("6_jfd4t")
region = Rect2(64, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_e28g8"]
atlas = ExtResource("6_jfd4t")
region = Rect2(96, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_f7kmj"]
atlas = ExtResource("6_jfd4t")
region = Rect2(128, 160, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_kdf62"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jfd4t")
}],
"loop": true,
"name": &"enemy_idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i0ica")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_377p4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nrbut")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mk6k8")
}],
"loop": false,
"name": &"enemy_shot",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fxfcx")
}],
"loop": true,
"name": &"player_idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dvc0n")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_caj01")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e28g8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f7kmj")
}],
"loop": false,
"name": &"player_shot",
"speed": 10.0
}]
[sub_resource type="SpriteFrames" id="SpriteFrames_veer3"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_nrbut"]
resource_local_to_scene = true
particle_flag_disable_z = true
inherit_velocity_ratio = 0.5
direction = Vector3(0, 1, 0)
spread = 15.0
spread = 5.0
initial_velocity_min = 5.0
initial_velocity_max = 15.0
gravity = Vector3(0, 0, 0)
[node name="CannonWeapon" instance=ExtResource("1_xnbws")]
[node name="AbstractCannonWeapon" instance=ExtResource("1_xnbws")]
script = ExtResource("2_ew5um")
sector_angle = 1
Projectile = ExtResource("2_2bjeu")
type = 3
[node name="ShotParticles" type="Node2D" parent="." index="0"]
[node name="Front" type="GPUParticles2D" parent="ShotParticles" index="0"]
position = Vector2(22, 0)
emitting = false
amount = 32
texture = ExtResource("4_i0ica")
@@ -173,7 +74,6 @@ fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_377p4")
[node name="Left" type="GPUParticles2D" parent="ShotParticles" index="1"]
position = Vector2(17, -4)
emitting = false
texture = ExtResource("5_377p4")
lifetime = 0.4
@@ -182,7 +82,6 @@ fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_i0ica")
[node name="Right" type="GPUParticles2D" parent="ShotParticles" index="2"]
position = Vector2(17, 4)
emitting = false
texture = ExtResource("5_377p4")
lifetime = 0.4
@@ -191,18 +90,14 @@ fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_jfd4t")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="1"]
position = Vector2(9, 0)
sprite_frames = SubResource("SpriteFrames_kdf62")
animation = &"player_idle"
sprite_frames = SubResource("SpriteFrames_veer3")
[node name="ShellParticles" type="GPUParticles2D" parent="." index="2"]
z_index = 1
position = Vector2(-1, 1)
emitting = false
amount = 5
texture = ExtResource("6_i0ica")
lifetime = 3.0
one_shot = true
fixed_fps = 10
process_material = SubResource("ParticleProcessMaterial_nrbut")
@@ -210,8 +105,5 @@ process_material = SubResource("ParticleProcessMaterial_nrbut")
wait_time = 1.2
one_shot = true
[node name="Muzzle" parent="." index="4"]
position = Vector2(20, 0)
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
@@ -1,16 +0,0 @@
[gd_resource type="Resource" script_class="WeaponData" load_steps=3 format=3 uid="uid://dxap3sahurth4"]
[ext_resource type="Script" uid="uid://870r1efinhqd" path="res://game/world/data/weapon_data.gd" id="1_c34y3"]
[ext_resource type="PackedScene" uid="uid://bccaoirwdkp7n" path="res://game/entities/weapons/cannon/cannon_weapon.tscn" id="3_2dgua"]
[resource]
script = ExtResource("1_c34y3")
id = "cannon"
name = "Cannon"
group = "explosion"
description = "High damage (explosion)
Low firerate
Moderate velocity
High explosion radius"
scene = ExtResource("3_2dgua")
metadata/_custom_type_script = "uid://870r1efinhqd"
@@ -0,0 +1,2 @@
class_name EnemyCannonProjectile
extends AbstractCannonProjectile
@@ -0,0 +1 @@
uid://crm02yyh6rcu6
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://c78rvwvr3dg5l"]
[ext_resource type="PackedScene" uid="uid://cgi7wd84kjnyw" path="res://game/entities/weapons/cannon/abstract_cannon_projectile.tscn" id="1_ksga8"]
[ext_resource type="Script" uid="uid://crm02yyh6rcu6" path="res://game/entities/weapons/cannon/enemy_cannon_projectile.gd" id="2_3s0hn"]
[node name="EnemyCannonProjectile" instance=ExtResource("1_ksga8")]
collision_layer = 16
collision_mask = 2
script = ExtResource("2_3s0hn")
direction = Vector2(-1, 0)
[node name="Blast" parent="." index="3"]
collision_layer = 16
collision_mask = 2
@@ -0,0 +1,2 @@
class_name EnemyCannonWeapon
extends AbstractCannonWeapon
@@ -0,0 +1 @@
uid://ctyvmasefboee
@@ -0,0 +1,131 @@
[gd_scene load_steps=15 format=3 uid="uid://d3co2xx0th1d0"]
[ext_resource type="PackedScene" uid="uid://bccaoirwdkp7n" path="res://game/entities/weapons/cannon/abstract_cannon_weapon.tscn" id="1_pc5pg"]
[ext_resource type="Script" uid="uid://ctyvmasefboee" path="res://game/entities/weapons/cannon/enemy_cannon_weapon.gd" id="2_1qc5g"]
[ext_resource type="PackedScene" uid="uid://c78rvwvr3dg5l" path="res://game/entities/weapons/cannon/enemy_cannon_projectile.tscn" id="2_6eedr"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="3_tvj1r"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_tvj1r"]
lifetime_randomness = 0.4
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
direction = Vector3(-1, 0, 0)
spread = 30.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_1qc5g"]
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 2.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
direction = Vector3(1, 1, 0)
spread = 5.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2rup0"]
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 2.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
direction = Vector3(1, -1, 0)
spread = 5.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_jfd4t"]
atlas = ExtResource("3_tvj1r")
region = Rect2(0, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_i0ica"]
atlas = ExtResource("3_tvj1r")
region = Rect2(32, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_377p4"]
atlas = ExtResource("3_tvj1r")
region = Rect2(64, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_nrbut"]
atlas = ExtResource("3_tvj1r")
region = Rect2(96, 176, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_mk6k8"]
atlas = ExtResource("3_tvj1r")
region = Rect2(128, 176, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_1qc5g"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jfd4t")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i0ica")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_377p4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nrbut")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mk6k8")
}],
"loop": false,
"name": &"shot",
"speed": 10.0
}]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_vumep"]
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="EnemyCannonWeapon" instance=ExtResource("1_pc5pg")]
script = ExtResource("2_1qc5g")
projectile_scene = ExtResource("2_6eedr")
[node name="Front" parent="ShotParticles" index="0"]
position = Vector2(-22, 0)
process_material = SubResource("ParticleProcessMaterial_tvj1r")
[node name="Left" parent="ShotParticles" index="1"]
position = Vector2(-17, 4)
process_material = SubResource("ParticleProcessMaterial_1qc5g")
[node name="Right" parent="ShotParticles" index="2"]
position = Vector2(-17, -4)
process_material = SubResource("ParticleProcessMaterial_2rup0")
[node name="AnimatedSprite2D" parent="." index="1"]
position = Vector2(-9, 0)
sprite_frames = SubResource("SpriteFrames_1qc5g")
animation = &"idle"
[node name="ShellParticles" parent="." index="2"]
position = Vector2(1, -1)
process_material = SubResource("ParticleProcessMaterial_vumep")
[node name="Muzzle" parent="." index="4"]
position = Vector2(-20, 0)
@@ -0,0 +1,2 @@
class_name PlayerCannonProjectile
extends AbstractCannonProjectile
@@ -0,0 +1 @@
uid://82w6uhu0q7su
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://bswe1h1qw7e4x"]
[ext_resource type="PackedScene" uid="uid://cgi7wd84kjnyw" path="res://game/entities/weapons/cannon/abstract_cannon_projectile.tscn" id="1_66byq"]
[ext_resource type="Script" uid="uid://82w6uhu0q7su" path="res://game/entities/weapons/cannon/player_cannon_projectile.gd" id="2_oftvl"]
[node name="PlayerCannonProjectile" instance=ExtResource("1_66byq")]
collision_layer = 8
collision_mask = 4
script = ExtResource("2_oftvl")
direction = Vector2(1, 0)
[node name="Blast" parent="." index="3"]
collision_layer = 8
collision_mask = 4
@@ -0,0 +1,2 @@
class_name PlayerCannonWeapon
extends AbstractCannonWeapon
@@ -0,0 +1 @@
uid://bvnecmmrk5e47
@@ -0,0 +1,130 @@
[gd_scene load_steps=15 format=3 uid="uid://mpr5kl87nx3f"]
[ext_resource type="PackedScene" uid="uid://bccaoirwdkp7n" path="res://game/entities/weapons/cannon/abstract_cannon_weapon.tscn" id="1_5v7nv"]
[ext_resource type="PackedScene" uid="uid://bswe1h1qw7e4x" path="res://game/entities/weapons/cannon/player_cannon_projectile.tscn" id="2_bgyjp"]
[ext_resource type="Script" uid="uid://bvnecmmrk5e47" path="res://game/entities/weapons/cannon/player_cannon_weapon.gd" id="2_kkp2r"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="4_myt65"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_bgyjp"]
lifetime_randomness = 0.4
particle_flag_disable_z = true
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
spread = 30.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kkp2r"]
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 2.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
direction = Vector3(-1, -1, 0)
spread = 5.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_myt65"]
lifetime_randomness = 0.1
particle_flag_disable_z = true
emission_shape = 1
emission_sphere_radius = 2.0
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 0.2
direction = Vector3(-1, 1, 0)
spread = 5.0
initial_velocity_min = 10.0
initial_velocity_max = 20.0
gravity = Vector3(0, 0, 0)
[sub_resource type="AtlasTexture" id="AtlasTexture_byluv"]
atlas = ExtResource("4_myt65")
region = Rect2(0, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_myt65"]
atlas = ExtResource("4_myt65")
region = Rect2(32, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_o2qwc"]
atlas = ExtResource("4_myt65")
region = Rect2(64, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_faaxs"]
atlas = ExtResource("4_myt65")
region = Rect2(96, 160, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_lhw8s"]
atlas = ExtResource("4_myt65")
region = Rect2(128, 160, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_irdfq"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_byluv")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_myt65")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_o2qwc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_faaxs")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lhw8s")
}],
"loop": false,
"name": &"shot",
"speed": 10.0
}]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_5v7nv"]
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="PlayerCannonWeapon" instance=ExtResource("1_5v7nv")]
script = ExtResource("2_kkp2r")
projectile_scene = ExtResource("2_bgyjp")
[node name="Front" parent="ShotParticles" index="0"]
position = Vector2(20, 0)
process_material = SubResource("ParticleProcessMaterial_bgyjp")
[node name="Left" parent="ShotParticles" index="1"]
position = Vector2(15, -4)
process_material = SubResource("ParticleProcessMaterial_kkp2r")
[node name="Right" parent="ShotParticles" index="2"]
position = Vector2(15, 4)
process_material = SubResource("ParticleProcessMaterial_myt65")
[node name="AnimatedSprite2D" parent="." index="1"]
position = Vector2(9, 0)
sprite_frames = SubResource("SpriteFrames_irdfq")
animation = &"shot"
[node name="ShellParticles" parent="." index="2"]
position = Vector2(-1, 1)
process_material = SubResource("ParticleProcessMaterial_5v7nv")
[node name="Muzzle" parent="." index="4"]
position = Vector2(18, 0)
@@ -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)
@@ -1,5 +1,5 @@
class_name LaserProjectile
extends DirectHitProjectile
class_name AbstractLaserProjectile
extends AbstractDirectHitProjectile
@onready var particles : GPUParticles2D = $GPUParticles2D
@@ -1,8 +1,8 @@
[gd_scene load_steps=8 format=3 uid="uid://cmni0xrbbfcy5"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/direct_hit__projectile.tscn" id="1_3a8fg"]
[ext_resource type="Script" uid="uid://bdxq4aflhc8vd" path="res://game/entities/weapons/laser/laser_projectile.gd" id="2_je1a2"]
[ext_resource type="Script" uid="uid://c27v705giygv4" path="res://game/health_system/damage/energy_damage.gd" id="3_ylokk"]
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/abstract_direct_hit_projectile.tscn" id="1_3a8fg"]
[ext_resource type="Script" uid="uid://bdxq4aflhc8vd" path="res://game/entities/weapons/laser/abstract_laser_projectile.gd" id="2_je1a2"]
[ext_resource type="Script" uid="uid://c27v705giygv4" path="res://game/data/damage/energy_damage.gd" id="3_ylokk"]
[ext_resource type="Texture2D" uid="uid://dk3t14mrgjmma" path="res://particle_textures/energy_medium.tres" id="4_bytws"]
[sub_resource type="Resource" id="Resource_bytws"]
@@ -16,15 +16,16 @@ radius = 1.0
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_7dd03"]
resource_local_to_scene = true
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(8, 0, 1)
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 1.0
direction = Vector3(0, 0, 0)
spread = 0.0
initial_velocity_min = -250.0
initial_velocity_max = -250.0
gravity = Vector3(0, 0, 0)
[node name="LaserProjectile" instance=ExtResource("1_3a8fg")]
[node name="AbstractLaserProjectile" instance=ExtResource("1_3a8fg")]
collision_layer = 0
collision_mask = 0
script = ExtResource("2_je1a2")
@@ -35,7 +36,8 @@ speed = 500
shape = SubResource("CircleShape2D_ylokk")
[node name="GPUParticles2D" type="GPUParticles2D" parent="." index="2"]
amount = 64
amount = 16
texture = ExtResource("4_bytws")
lifetime = 0.2
lifetime = 0.09999999999999999
fixed_fps = 20
process_material = SubResource("ParticleProcessMaterial_7dd03")
@@ -1,3 +1,4 @@
class_name AbstractLaserWeapon
extends AbstractWeapon
@@ -5,10 +6,8 @@ extends AbstractWeapon
@onready var cooldown_timer : Timer = $CooldownTimer
func set_belonging(belonging: Belonging) -> void:
super.set_belonging(belonging)
sprite.play(PREFIXES[_belonging])
func _ready() -> void:
sprite.play(SHOT_ANIMATION)
func shoot(ship_velocity: Vector2) -> bool:
@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://def1alrel4ioo"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pki4x"]
[ext_resource type="Script" uid="uid://bxr150at8ul2a" path="res://game/entities/weapons/laser/abstract_laser_weapon.gd" id="2_lbdvb"]
[sub_resource type="SpriteFrames" id="SpriteFrames_btyhf"]
[node name="AbstractLaserWeapon" instance=ExtResource("1_pki4x")]
script = ExtResource("2_lbdvb")
bullet_per_shot = 2
type = 2
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
sprite_frames = SubResource("SpriteFrames_btyhf")
[node name="CooldownTimer" type="Timer" parent="." index="1"]
process_callback = 0
wait_time = 0.05
one_shot = true
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
@@ -0,0 +1,2 @@
class_name EnemyLaserProjectile
extends AbstractLaserProjectile
@@ -0,0 +1 @@
uid://1tw0n0y7c3n4
@@ -0,0 +1,25 @@
[gd_scene load_steps=4 format=3 uid="uid://cq8vnjrk70iby"]
[ext_resource type="PackedScene" uid="uid://cmni0xrbbfcy5" path="res://game/entities/weapons/laser/abstract_laser_projectile.tscn" id="1_6hudn"]
[ext_resource type="Script" uid="uid://1tw0n0y7c3n4" path="res://game/entities/weapons/laser/enemy_laser_projectile.gd" id="2_2l4gg"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_2l4gg"]
resource_local_to_scene = true
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(16, 0, 1)
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 1.0
direction = Vector3(-1, 0, 0)
spread = 0.0
gravity = Vector3(0, 0, 0)
[node name="EnemyLaserProjectile" instance=ExtResource("1_6hudn")]
collision_layer = 16
collision_mask = 2
script = ExtResource("2_2l4gg")
direction = Vector2(-1, 0)
[node name="GPUParticles2D" parent="." index="2"]
process_material = SubResource("ParticleProcessMaterial_2l4gg")
@@ -0,0 +1,2 @@
class_name EnemyLaserWeapon
extends AbstractLaserWeapon
@@ -0,0 +1 @@
uid://bckua73myf5v7
@@ -0,0 +1,54 @@
[gd_scene load_steps=10 format=3 uid="uid://mjt8xj8k28vi"]
[ext_resource type="PackedScene" uid="uid://def1alrel4ioo" path="res://game/entities/weapons/laser/abstract_laser_weapon.tscn" id="1_wwqbk"]
[ext_resource type="Script" uid="uid://bckua73myf5v7" path="res://game/entities/weapons/laser/enemy_laser_weapon.gd" id="2_preya"]
[ext_resource type="PackedScene" uid="uid://cq8vnjrk70iby" path="res://game/entities/weapons/laser/enemy_laser_projectile.tscn" id="3_yr2si"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="4_a3m6t"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dggsl"]
atlas = ExtResource("4_a3m6t")
region = Rect2(128, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_gbu7x"]
atlas = ExtResource("4_a3m6t")
region = Rect2(160, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_2prsi"]
atlas = ExtResource("4_a3m6t")
region = Rect2(192, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_jgejx"]
atlas = ExtResource("4_a3m6t")
region = Rect2(224, 80, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_ga5wd"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dggsl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gbu7x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2prsi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jgejx")
}],
"loop": true,
"name": &"shot",
"speed": 10.0
}]
[node name="EnemyLaserWeapon" instance=ExtResource("1_wwqbk")]
script = ExtResource("2_preya")
projectile_scene = ExtResource("3_yr2si")
[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(-3, 0)
sprite_frames = SubResource("SpriteFrames_ga5wd")
animation = &"shot"
[node name="Muzzle" parent="." index="2"]
position = Vector2(-5, 0)
@@ -1,15 +0,0 @@
[gd_resource type="Resource" script_class="WeaponData" load_steps=3 format=3 uid="uid://y7ccba1uqf2d"]
[ext_resource type="PackedScene" uid="uid://def1alrel4ioo" path="res://game/entities/weapons/laser/laser_weapon.tscn" id="1_aey1r"]
[ext_resource type="Script" uid="uid://870r1efinhqd" path="res://game/world/data/weapon_data.gd" id="1_ipxhy"]
[resource]
script = ExtResource("1_ipxhy")
id = "laser"
name = "Laser"
group = "energy"
description = "Low damage (energetic)
High firerate
Low velocity"
scene = ExtResource("1_aey1r")
metadata/_custom_type_script = "uid://870r1efinhqd"
@@ -1,93 +0,0 @@
[gd_scene load_steps=14 format=3 uid="uid://def1alrel4ioo"]
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pki4x"]
[ext_resource type="PackedScene" uid="uid://cmni0xrbbfcy5" path="res://game/entities/weapons/laser/laser_projectile.tscn" id="2_fecho"]
[ext_resource type="Script" uid="uid://bxr150at8ul2a" path="res://game/entities/weapons/laser/laser_weapon.gd" id="2_lbdvb"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_c8tb4"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dggsl"]
atlas = ExtResource("6_c8tb4")
region = Rect2(128, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_gbu7x"]
atlas = ExtResource("6_c8tb4")
region = Rect2(160, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_2prsi"]
atlas = ExtResource("6_c8tb4")
region = Rect2(192, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_jgejx"]
atlas = ExtResource("6_c8tb4")
region = Rect2(224, 80, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_5c4fv"]
atlas = ExtResource("6_c8tb4")
region = Rect2(128, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_2jgsd"]
atlas = ExtResource("6_c8tb4")
region = Rect2(160, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_4n6qh"]
atlas = ExtResource("6_c8tb4")
region = Rect2(192, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_amoq0"]
atlas = ExtResource("6_c8tb4")
region = Rect2(224, 64, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_c8tb4"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dggsl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gbu7x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2prsi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jgejx")
}],
"loop": true,
"name": &"enemy",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5c4fv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2jgsd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4n6qh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_amoq0")
}],
"loop": true,
"name": &"player",
"speed": 10.0
}]
[node name="LaserWeapon" instance=ExtResource("1_pki4x")]
script = ExtResource("2_lbdvb")
bullet_per_shot = 2
Projectile = ExtResource("2_fecho")
type = 2
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
position = Vector2(3, 0)
sprite_frames = SubResource("SpriteFrames_c8tb4")
animation = &"player"
[node name="CooldownTimer" type="Timer" parent="." index="1"]
process_callback = 0
wait_time = 0.05
one_shot = true
[connection signal="timeout" from="CooldownTimer" to="." method="_on_cooldown_timer_timeout"]
@@ -0,0 +1,2 @@
class_name PlayerLaserProjectile
extends AbstractLaserProjectile
@@ -0,0 +1 @@
uid://v7pcdd8yxdse
@@ -0,0 +1,24 @@
[gd_scene load_steps=4 format=3 uid="uid://cyskk1kc88lgf"]
[ext_resource type="PackedScene" uid="uid://cmni0xrbbfcy5" path="res://game/entities/weapons/laser/abstract_laser_projectile.tscn" id="1_q67uk"]
[ext_resource type="Script" uid="uid://v7pcdd8yxdse" path="res://game/entities/weapons/laser/player_laser_projectile.gd" id="2_truhp"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_truhp"]
resource_local_to_scene = true
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(16, 0, 1)
angle_min = -179.99998
angle_max = 180.00002
inherit_velocity_ratio = 1.0
spread = 0.0
gravity = Vector3(0, 0, 0)
[node name="PlayerLaserProjectile" instance=ExtResource("1_q67uk")]
collision_layer = 8
collision_mask = 4
script = ExtResource("2_truhp")
direction = Vector2(1, 0)
[node name="GPUParticles2D" parent="." index="2"]
process_material = SubResource("ParticleProcessMaterial_truhp")
@@ -0,0 +1,2 @@
class_name PlayerLaserWeapon
extends AbstractLaserWeapon
@@ -0,0 +1 @@
uid://824ta0lbinkb
@@ -0,0 +1,54 @@
[gd_scene load_steps=10 format=3 uid="uid://cargptjtnale2"]
[ext_resource type="PackedScene" uid="uid://def1alrel4ioo" path="res://game/entities/weapons/laser/abstract_laser_weapon.tscn" id="1_nky8c"]
[ext_resource type="Script" uid="uid://824ta0lbinkb" path="res://game/entities/weapons/laser/player_laser_weapon.gd" id="2_oqbns"]
[ext_resource type="PackedScene" uid="uid://cyskk1kc88lgf" path="res://game/entities/weapons/laser/player_laser_projectile.tscn" id="3_62i0g"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="4_oaprh"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5c4fv"]
atlas = ExtResource("4_oaprh")
region = Rect2(128, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_2jgsd"]
atlas = ExtResource("4_oaprh")
region = Rect2(160, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_4n6qh"]
atlas = ExtResource("4_oaprh")
region = Rect2(192, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_amoq0"]
atlas = ExtResource("4_oaprh")
region = Rect2(224, 64, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_geipx"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5c4fv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2jgsd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4n6qh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_amoq0")
}],
"loop": true,
"name": &"shot",
"speed": 10.0
}]
[node name="PlayerLaserWeapon" instance=ExtResource("1_nky8c")]
script = ExtResource("2_oqbns")
projectile_scene = ExtResource("3_62i0g")
[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(3, 0)
sprite_frames = SubResource("SpriteFrames_geipx")
animation = &"shot"
[node name="Muzzle" parent="." index="2"]
position = Vector2(5, 0)
@@ -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

Some files were not shown because too many files have changed in this diff Show More