Updated directory structure for easier weapon parsing.

This commit is contained in:
Henry Faber 2026-06-15 16:35:53 +01:00
parent 0bcb386a0f
commit 54efa89e4e
7 changed files with 7 additions and 7 deletions

View file

@ -0,0 +1,40 @@
extends Area2D
@onready var bullet: PackedScene = load("res://scenes/player_weapons/weapon_stock.tscn")
@onready var shot_data: = load("res://resources/player_weapon_resources/weapon_shot_stock.tres")
# Time offset when this bullet was fired (relative to other bullets in the same shot)
var time_offset: float = 0.5
# When this bullet should fire (absolute time)
var fire_time: float = 0.0
# Track if this bullet is currently active in the shot
var is_active: bool = false
func _process(delta):
var current_time = Time.get_ticks_msec() / 1000.0
# Fire if it's time and bullet isn't already active
if !is_active and current_time >= fire_time:
activate()
# Move the bullet
position.y -= shot_data.speed * delta
func activate():
is_active = true
visible = true
# # Emit signal for hit detection
# emit_signal("activate")
func _on_visible_on_screen_notifier_2d_screen_exited():
queue_free()
# Set fire_time for the next shot (staggered firing)
var current_time = Time.get_ticks_msec() / 1000.0
fire_time = current_time + shot_data.stagger_offset

View file

@ -0,0 +1 @@
uid://c5blhfopjpfny

View file

@ -0,0 +1,53 @@
[gd_scene format=3 uid="uid://ddpclu2vdy2ve"]
[ext_resource type="Script" uid="uid://c5blhfopjpfny" path="res://scenes/player_weapons/weapon_stock.gd" id="1_u1d5o"]
[ext_resource type="Texture2D" uid="uid://bnpm8b62n1pr5" path="res://graphics/shot_stock_og.png" id="2_u1d5o"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5bykt"]
atlas = ExtResource("2_u1d5o")
region = Rect2(0, 0, 7, 11)
[sub_resource type="AtlasTexture" id="AtlasTexture_vsqoq"]
atlas = ExtResource("2_u1d5o")
region = Rect2(7, 0, 7, 11)
[sub_resource type="AtlasTexture" id="AtlasTexture_yqx5m"]
atlas = ExtResource("2_u1d5o")
region = Rect2(14, 0, 7, 11)
[sub_resource type="SpriteFrames" id="SpriteFrames_fdubj"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5bykt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vsqoq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yqx5m")
}],
"loop": true,
"name": &"default",
"speed": 24.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mvdrj"]
size = Vector2(6.666667, 14)
[node name="StockWeapon" type="Area2D" unique_id=1832200900]
script = ExtResource("1_u1d5o")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1831184252]
scale = Vector2(1.5, 1.5)
sprite_frames = SubResource("SpriteFrames_fdubj")
autoplay = "default"
frame_progress = 0.35886022
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1890946059]
shape = SubResource("RectangleShape2D_mvdrj")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=985862716]
rect = Rect2(-3, -7, 6, 14)
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]