Reworked weapons and projectiles
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
class_name AbstractPlasmaProjectile
|
||||
extends AbstractDirectHitProjectile
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cgvb0hjrl5h4s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/direct_hit__projectile.tscn" id="1_x58hw"]
|
||||
[ext_resource type="Script" uid="uid://bu5sjoh4hwkhn" path="res://game/entities/weapons/plasma/plasma_projectile.gd" id="2_0deih"]
|
||||
[ext_resource type="Script" uid="uid://c27v705giygv4" path="res://game/health_system/damage/energy_damage.gd" id="3_dlvdm"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdv5n4t47hr8i" path="res://game/entities/weapons/abstract_direct_hit_projectile.tscn" id="1_x58hw"]
|
||||
[ext_resource type="Script" uid="uid://bu5sjoh4hwkhn" path="res://game/entities/weapons/plasma/abstract_plasma_projectile.gd" id="2_0deih"]
|
||||
[ext_resource type="Script" uid="uid://c27v705giygv4" path="res://game/data/damage/energy_damage.gd" id="3_dlvdm"]
|
||||
[ext_resource type="Texture2D" uid="uid://dk3t14mrgjmma" path="res://particle_textures/energy_medium.tres" id="4_5enq5"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5enq5"]
|
||||
@@ -24,7 +24,7 @@ angle_max = 180.00002
|
||||
inherit_velocity_ratio = 0.5
|
||||
gravity = Vector3(0, 0, 0)
|
||||
|
||||
[node name="PlasmaProjectile" instance=ExtResource("1_x58hw")]
|
||||
[node name="AbstractPlasmaProjectile" instance=ExtResource("1_x58hw")]
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
script = ExtResource("2_0deih")
|
||||
+6
-8
@@ -1,20 +1,18 @@
|
||||
class_name AbstractPlasmaWeapon
|
||||
extends AbstractWeapon
|
||||
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
||||
@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()
|
||||
|
||||
@@ -22,9 +20,9 @@ func shoot(ship_velocity: Vector2) -> bool:
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
sprite.play(PREFIXES[_belonging] + RELOAD_POSTFIX)
|
||||
sprite.play(RELOAD_ANIMATION)
|
||||
|
||||
|
||||
func _on_cooldown_timer_timeout() -> void:
|
||||
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
|
||||
sprite.play(IDLE_ANIMATION)
|
||||
_can_shoot = true
|
||||
@@ -0,0 +1,22 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cj1jclfterepm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pkk8e"]
|
||||
[ext_resource type="Script" uid="uid://cu6ck2oqqdem8" path="res://game/entities/weapons/plasma/abstract_plasma_weapon.gd" id="2_fnsb7"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_j5go4"]
|
||||
|
||||
[node name="AbstractPlasmaWeapon" instance=ExtResource("1_pkk8e")]
|
||||
script = ExtResource("2_fnsb7")
|
||||
sector_angle = 2
|
||||
type = 2
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
|
||||
sprite_frames = SubResource("SpriteFrames_j5go4")
|
||||
|
||||
[node name="CooldownTimer" type="Timer" parent="." index="1"]
|
||||
process_callback = 0
|
||||
wait_time = 0.4
|
||||
one_shot = true
|
||||
|
||||
[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"]
|
||||
@@ -0,0 +1,2 @@
|
||||
class_name EnemyPlasmaProjectile
|
||||
extends AbstractPlasmaProjectile
|
||||
@@ -0,0 +1 @@
|
||||
uid://c74fy73pue7dj
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://yr3sadet3ds1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgvb0hjrl5h4s" path="res://game/entities/weapons/plasma/abstract_plasma_projectile.tscn" id="1_mmivs"]
|
||||
[ext_resource type="Script" uid="uid://c74fy73pue7dj" path="res://game/entities/weapons/plasma/enemy_plasma_projectile.gd" id="2_h1fou"]
|
||||
|
||||
[node name="EnemyPlasmaProjectile" instance=ExtResource("1_mmivs")]
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
script = ExtResource("2_h1fou")
|
||||
direction = Vector2(-1, 0)
|
||||
@@ -0,0 +1,2 @@
|
||||
class_name EnemyPlasmaWeapon
|
||||
extends AbstractPlasmaWeapon
|
||||
@@ -0,0 +1 @@
|
||||
uid://dliivclhsvxq8
|
||||
@@ -0,0 +1,67 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dtl3d7soletdn"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cj1jclfterepm" path="res://game/entities/weapons/plasma/abstract_plasma_weapon.tscn" id="1_cuvu2"]
|
||||
[ext_resource type="Script" uid="uid://dliivclhsvxq8" path="res://game/entities/weapons/plasma/enemy_plasma_weapon.gd" id="2_82g15"]
|
||||
[ext_resource type="PackedScene" uid="uid://yr3sadet3ds1" path="res://game/entities/weapons/plasma/enemy_plasma_projectile.tscn" id="3_82g15"]
|
||||
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="3_437d6"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vj3ee"]
|
||||
atlas = ExtResource("3_437d6")
|
||||
region = Rect2(0, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u6d2q"]
|
||||
atlas = ExtResource("3_437d6")
|
||||
region = Rect2(96, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ity8s"]
|
||||
atlas = ExtResource("3_437d6")
|
||||
region = Rect2(32, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dm1ox"]
|
||||
atlas = ExtResource("3_437d6")
|
||||
region = Rect2(64, 48, 32, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_82g15"]
|
||||
resource_local_to_scene = true
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vj3ee")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_u6d2q")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"reloading",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ity8s")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dm1ox")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"shot",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[node name="EnemyPlasmaWeapon" instance=ExtResource("1_cuvu2")]
|
||||
script = ExtResource("2_82g15")
|
||||
sector_angle = 0
|
||||
projectile_scene = ExtResource("3_82g15")
|
||||
type = 0
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="0"]
|
||||
position = Vector2(-8, 0)
|
||||
sprite_frames = SubResource("SpriteFrames_82g15")
|
||||
animation = &"shot"
|
||||
|
||||
[node name="Muzzle" parent="." index="2"]
|
||||
position = Vector2(-9, -2)
|
||||
@@ -1,15 +0,0 @@
|
||||
[gd_resource type="Resource" script_class="WeaponData" load_steps=3 format=3 uid="uid://dq0pjpg3slr8s"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://870r1efinhqd" path="res://game/world/data/weapon_data.gd" id="1_3fasx"]
|
||||
[ext_resource type="PackedScene" uid="uid://cj1jclfterepm" path="res://game/entities/weapons/plasma/plasma_weapon.tscn" id="1_rcvob"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_3fasx")
|
||||
id = "plasma"
|
||||
name = "Plasma"
|
||||
group = "energy"
|
||||
description = "Moderate damage (energetic)
|
||||
Moderate firerate
|
||||
Moderate velocity"
|
||||
scene = ExtResource("1_rcvob")
|
||||
metadata/_custom_type_script = "uid://870r1efinhqd"
|
||||
@@ -1,2 +0,0 @@
|
||||
class_name PlasmaProjectile
|
||||
extends DirectHitProjectile
|
||||
@@ -1,118 +0,0 @@
|
||||
[gd_scene load_steps=14 format=3 uid="uid://cj1jclfterepm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://1o2ta17yc5bp" path="res://game/entities/weapons/abstract_weapon.tscn" id="1_pkk8e"]
|
||||
[ext_resource type="Script" uid="uid://cu6ck2oqqdem8" path="res://game/entities/weapons/plasma/plasma_weapon.gd" id="2_fnsb7"]
|
||||
[ext_resource type="PackedScene" uid="uid://cgvb0hjrl5h4s" path="res://game/entities/weapons/plasma/plasma_projectile.tscn" id="2_yluvp"]
|
||||
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_u6d2q"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_vj3ee"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(0, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u6d2q"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(96, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ity8s"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(32, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dm1ox"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(64, 48, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x71d5"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(0, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j64vb"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(96, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pevdi"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(32, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_40asj"]
|
||||
atlas = ExtResource("6_u6d2q")
|
||||
region = Rect2(64, 32, 32, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_hyw35"]
|
||||
resource_local_to_scene = true
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_vj3ee")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"enemy_idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_u6d2q")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"enemy_reloading",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ity8s")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dm1ox")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"enemy_shot",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_x71d5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"player_idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j64vb")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"player_reloading",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pevdi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_40asj")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"player_shot",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[node name="PlasmaWeapon" instance=ExtResource("1_pkk8e")]
|
||||
script = ExtResource("2_fnsb7")
|
||||
sector_angle = 2
|
||||
Projectile = ExtResource("2_yluvp")
|
||||
type = 2
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="0"]
|
||||
position = Vector2(8, 0)
|
||||
sprite_frames = SubResource("SpriteFrames_hyw35")
|
||||
animation = &"player_reloading"
|
||||
|
||||
[node name="CooldownTimer" type="Timer" parent="." index="1"]
|
||||
process_callback = 0
|
||||
wait_time = 0.4
|
||||
one_shot = true
|
||||
|
||||
[node name="Muzzle" parent="." index="2"]
|
||||
position = Vector2(9, 2)
|
||||
|
||||
[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"]
|
||||
@@ -0,0 +1,2 @@
|
||||
class_name PlayerPlasmaProjectile
|
||||
extends AbstractPlasmaProjectile
|
||||
@@ -0,0 +1 @@
|
||||
uid://c5fn0axm8b3hq
|
||||
@@ -0,0 +1,10 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cnjka7edh3tlt"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cgvb0hjrl5h4s" path="res://game/entities/weapons/plasma/abstract_plasma_projectile.tscn" id="1_04w4k"]
|
||||
[ext_resource type="Script" uid="uid://c5fn0axm8b3hq" path="res://game/entities/weapons/plasma/player_plasma_projectile.gd" id="2_7eiay"]
|
||||
|
||||
[node name="PlayerPlasmaProjectile" instance=ExtResource("1_04w4k")]
|
||||
collision_layer = 8
|
||||
collision_mask = 4
|
||||
script = ExtResource("2_7eiay")
|
||||
direction = Vector2(1, 0)
|
||||
@@ -0,0 +1,2 @@
|
||||
class_name PlayerPlasmaWeapon
|
||||
extends AbstractPlasmaWeapon
|
||||
@@ -0,0 +1 @@
|
||||
uid://btp6bb7dvtxl6
|
||||
@@ -0,0 +1,64 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://dd8juohu1x2xo"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cj1jclfterepm" path="res://game/entities/weapons/plasma/abstract_plasma_weapon.tscn" id="1_ee068"]
|
||||
[ext_resource type="Script" uid="uid://btp6bb7dvtxl6" path="res://game/entities/weapons/plasma/player_plasma_weapon.gd" id="2_hxkfe"]
|
||||
[ext_resource type="PackedScene" uid="uid://cnjka7edh3tlt" path="res://game/entities/weapons/plasma/player_plasma_projectile.tscn" id="3_hxkfe"]
|
||||
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="3_l4q6k"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_x71d5"]
|
||||
atlas = ExtResource("3_l4q6k")
|
||||
region = Rect2(0, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_j64vb"]
|
||||
atlas = ExtResource("3_l4q6k")
|
||||
region = Rect2(96, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_pevdi"]
|
||||
atlas = ExtResource("3_l4q6k")
|
||||
region = Rect2(32, 32, 32, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_40asj"]
|
||||
atlas = ExtResource("3_l4q6k")
|
||||
region = Rect2(64, 32, 32, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_hxkfe"]
|
||||
resource_local_to_scene = true
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_x71d5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_j64vb")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"reloading",
|
||||
"speed": 10.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_pevdi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_40asj")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"shot",
|
||||
"speed": 10.0
|
||||
}]
|
||||
|
||||
[node name="PlayerPlasmaWeapon" instance=ExtResource("1_ee068")]
|
||||
script = ExtResource("2_hxkfe")
|
||||
projectile_scene = ExtResource("3_hxkfe")
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="0"]
|
||||
sprite_frames = SubResource("SpriteFrames_hxkfe")
|
||||
animation = &"shot"
|
||||
|
||||
[node name="Muzzle" parent="." index="2"]
|
||||
position = Vector2(1, 2)
|
||||
Reference in New Issue
Block a user