diff --git a/resources/shot_stock.tres b/resources/shot_stock.tres deleted file mode 100644 index 6134269..0000000 --- a/resources/shot_stock.tres +++ /dev/null @@ -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" diff --git a/scenes/stock_weapon.tscn b/scenes/stock_weapon.tscn index 077183a..88a79a5 100644 --- a/scenes/stock_weapon.tscn +++ b/scenes/stock_weapon.tscn @@ -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") diff --git a/scenes/stock_weapon_single_old.tscn b/scenes/stock_weapon_single_old.tscn index a1dcfbc..9fb8e5a 100644 --- a/scenes/stock_weapon_single_old.tscn +++ b/scenes/stock_weapon_single_old.tscn @@ -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"] diff --git a/scripts/player.gd b/scripts/player.gd index 8a0d763..cc64ced 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -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 diff --git a/scripts/player_shot.gd b/scripts/player_shot.gd index 1f433f3..64b9dd1 100644 --- a/scripts/player_shot.gd +++ b/scripts/player_shot.gd @@ -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