Added PlasmaWeapon textures

This commit is contained in:
2025-11-23 19:04:34 +03:00
parent a6185d7ce1
commit 3e5e2dbe0f
15 changed files with 178 additions and 121 deletions
@@ -1 +1,42 @@
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 shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
sprite.play(PREFIXES[_belonging] + SHOT_POSTFIX)
_can_shoot = false
cooldown_timer.start()
return is_shot
func _get_projectile_position() -> Vector2:
var projectile_position : Vector2
match _belonging:
Belonging.PLAYER:
projectile_position = Vector2(-5, 2)
Belonging.ENEMY:
projectile_position = Vector2(5, -2)
return projectile_position
func _on_animated_sprite_2d_animation_finished() -> void:
sprite.play(PREFIXES[_belonging] + RELOAD_POSTFIX)
func _on_cooldown_timer_timeout() -> void:
sprite.play(PREFIXES[_belonging] + IDLE_POSTFIX)
_can_shoot = true
+101 -12
View File
@@ -1,24 +1,113 @@
[gd_scene load_steps=8 format=3 uid="uid://cj1jclfterepm"]
[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="Script" uid="uid://ccpriilfr3kme" path="res://game/reloaders/abstract_reloader.gd" id="3_fnsb7"]
[ext_resource type="Script" uid="uid://b255rb32vc6co" path="res://game/reloaders/firerate_reloader.gd" id="4_gpth1"]
[ext_resource type="Texture2D" uid="uid://6hh66k8s4a1e" path="res://images/weapons.png" id="6_u6d2q"]
[sub_resource type="Resource" id="Resource_yluvp"]
script = ExtResource("4_gpth1")
firerate = 150
metadata/_custom_type_script = "uid://b255rb32vc6co"
[sub_resource type="AtlasTexture" id="AtlasTexture_vj3ee"]
atlas = ExtResource("6_u6d2q")
region = Rect2(0, 48, 32, 16)
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_dra6h"]
size = Vector2(10, 7)
[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")
reloaders = Array[ExtResource("3_fnsb7")]([SubResource("Resource_yluvp")])
[node name="Sprite2D" type="Sprite2D" parent="." index="0"]
texture = SubResource("PlaceholderTexture2D_dra6h")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="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
[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"]