Updated resources and working Player scene to share the same variables

as the new component setup.
This commit is contained in:
Henry 2026-04-06 01:31:50 +01:00
parent 9b3841775c
commit 5d2efe9983
5 changed files with 16 additions and 19 deletions

View file

@ -1,13 +0,0 @@
[gd_resource type="Resource" script_class="PlayerShot" format=3 uid="uid://cels8t3hqjtsu"]
[ext_resource type="Script" uid="uid://ccdohs4gduee5" path="res://scripts/player_shot.gd" id="1_dpne1"]
[ext_resource type="Texture2D" uid="uid://ti1uy42vnnhw" path="res://graphics/shot.png" id="2_fu23f"]
[resource]
script = ExtResource("1_dpne1")
shot_name = "Stock"
damage = 3
speed = -350
projectiles = 1
cooldown = 0.0
metadata/_custom_type_script = "uid://ccdohs4gduee5"

View file

@ -1,15 +1,24 @@
[gd_scene format=3 uid="uid://ddpclu2vdy2ve"]
[ext_resource type="Script" uid="uid://d1rwqotmrag1r" path="res://scripts/stock_weapon.gd" id="1_hsma2"]
[ext_resource type="Resource" uid="uid://cels8t3hqjtsu" path="res://resources/shot_stock.tres" id="2_ckjv1"]
[ext_resource type="Script" uid="uid://ccdohs4gduee5" path="res://scripts/player_shot.gd" id="2_mvdrj"]
[ext_resource type="Texture2D" uid="uid://ti1uy42vnnhw" path="res://graphics/shot.png" id="3_mvdrj"]
[sub_resource type="Resource" id="Resource_pax02"]
script = ExtResource("2_mvdrj")
shot_name = "Stock"
damage = 3
speed = -350
projectiles = 1
cooldown = 0.0
metadata/_custom_type_script = "uid://ccdohs4gduee5"
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mvdrj"]
size = Vector2(6, 14)
[node name="StockWeapon" type="Area2D" unique_id=1832200900]
script = ExtResource("1_hsma2")
shot_data = ExtResource("2_ckjv1")
shot_data = SubResource("Resource_pax02")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2134507225]
texture = ExtResource("3_mvdrj")

View file

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://b2ltmeb14nc17"]
[ext_resource type="Script" uid="uid://d1rwqotmrag1r" path="res://scripts/stock_weapon.gd" id="1_kx6bj"]
[ext_resource type="Resource" uid="uid://cels8t3hqjtsu" path="res://resources/shot_stock.tres" id="2_hefae"]
[ext_resource type="Resource" uid="uid://cels8t3hqjtsu" path="res://resources/player_weapons/shot_stock.tres" id="2_hefae"]
[ext_resource type="Texture2D" uid="uid://ti1uy42vnnhw" path="res://graphics/shot.png" id="3_58qml"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mvdrj"]

View file

@ -87,7 +87,7 @@ func _on_weapon_cooldown_timeout() -> void:
func shoot():
var projectiles: int = 4
var projectiles: int = 3
const PROJECTILE_SPACING: float = 10
const MUZZLE_HEIGHT: int = -23
for b in projectiles:
@ -99,7 +99,7 @@ func shoot():
# Get weapon speed and spacing for equidistant calculations
weapon_rate = bullet.shot_data.rate
weapon_spacing = bullet.shot_data.spacing
weapon_spacing = bullet.shot_data.projectile_spacing
bullet_speed = abs(bullet.shot_data.speed)
# Print which weapon is firing

View file

@ -11,4 +11,5 @@ extends Resource
@export var projectiles: int = 2
@export var rate: float = 0.1
@export var cooldown: float = 0.25
@export var spacing: float = 35
@export var projectile_spacing: float = 35
@export var projectile_origin: int = -23