diff --git a/scenes/weapons/gun.tscn b/scenes/weapons/gun.tscn index 80a48273..bb0d685c 100644 --- a/scenes/weapons/gun.tscn +++ b/scenes/weapons/gun.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://do8p6aamuv46h" path="res://scenes/weapons/weapon.tscn" id="1_1sltl"] [ext_resource type="PackedScene" uid="uid://dc8ulx4o43ue3" path="res://scenes/projectiles/bullet.tscn" id="2_4cp7v"] -[ext_resource type="Texture2D" uid="uid://ch26kh0j2e3ev" path="res://assets/images/weapon/gun_0.png" id="2_l47j0"] +[ext_resource type="Texture2D" uid="uid://c033lvuk0vrbu" path="res://assets/images/weapon/gun_0.png" id="2_l47j0"] [ext_resource type="Resource" uid="uid://bsgm5x8805se7" path="res://resources/sounds/bullet.tres" id="3_k087s"] [ext_resource type="Script" path="res://scripts/weapon_system/WeaponRotation.gd" id="4_3cx23"] [ext_resource type="Script" path="res://scripts/weapon_system/projectile/ProjectileInterval.gd" id="4_a4uon"] @@ -52,6 +52,7 @@ _data = { projectile_scene = ExtResource("2_4cp7v") sound_resource = ExtResource("3_k087s") projectile_parent_reference = ExtResource("4_c42bw") +projectile_damage = 3 [node name="ProjectileInterval" type="Node" parent="." index="0" node_paths=PackedStringArray("weapon")] script = ExtResource("4_a4uon") diff --git a/scenes/weapons/shotgun.tscn b/scenes/weapons/shotgun.tscn index ea471758..64ba3428 100644 --- a/scenes/weapons/shotgun.tscn +++ b/scenes/weapons/shotgun.tscn @@ -1,10 +1,11 @@ [gd_scene load_steps=3 format=3 uid="uid://ghnv48d18ftl"] [ext_resource type="PackedScene" uid="uid://bxf4p5yoajpdu" path="res://scenes/weapons/gun.tscn" id="1_xioje"] -[ext_resource type="Texture2D" uid="uid://cim2x6e31yf1g" path="res://assets/images/weapon/gun_1.png" id="2_hrbvp"] +[ext_resource type="Texture2D" uid="uid://c8xqcvug18kj" path="res://assets/images/weapon/gun_1.png" id="2_hrbvp"] [node name="Shotgun" instance=ExtResource("1_xioje")] projectile_angles = Array[float]([0.0, -5.0, 5.0, -10.0, 10.0]) +projectile_damage = 1 [node name="ProjectileInterval" parent="." index="0"] interval = 0.75 diff --git a/scenes/weapons/sword.tscn b/scenes/weapons/sword.tscn index cdf2d629..88834534 100644 --- a/scenes/weapons/sword.tscn +++ b/scenes/weapons/sword.tscn @@ -2,7 +2,7 @@ [ext_resource type="PackedScene" uid="uid://bxf4p5yoajpdu" path="res://scenes/weapons/gun.tscn" id="1_tcvta"] [ext_resource type="PackedScene" uid="uid://c6ys2qs8aeu8n" path="res://scenes/projectiles/sword_slash.tscn" id="2_x78ie"] -[ext_resource type="Texture2D" uid="uid://bapiaemh2qekg" path="res://assets/images/weapon/sword_0.png" id="3_ah0df"] +[ext_resource type="Texture2D" uid="uid://cnygfi3chigkm" path="res://assets/images/weapon/sword_0.png" id="3_ah0df"] [sub_resource type="Animation" id="Animation_ku8ja"] length = 0.001 @@ -67,6 +67,7 @@ _data = { [node name="Sword" instance=ExtResource("1_tcvta")] projectile_scene = ExtResource("2_x78ie") +projectile_damage = 4 [node name="ProjectileInterval" parent="." index="0"] interval = 0.4 diff --git a/scripts/weapon_system/Weapon.gd b/scripts/weapon_system/Weapon.gd index 2dc52e39..a2a6dfde 100644 --- a/scripts/weapon_system/Weapon.gd +++ b/scripts/weapon_system/Weapon.gd @@ -26,7 +26,8 @@ signal prepare_spawn ## No angle, no projectile ## Use prepare_spawn signal to manipulate spread @export var projectile_angles:Array[float] = [0.0] - +## Used for defining projectile damage +@export var projectile_damage:int = 1 func _ready()->void: set_enabled(enabled) @@ -53,6 +54,7 @@ func spawn_projectile()->void: for angle:float in projectile_angles: var direction:Vector2 = mover.input_resource.aim_direction.rotated(deg_to_rad(angle)) var inst:Projectile2D = projectile_scene.instantiate() + inst.damage = projectile_damage inst.direction = direction inst.collision_mask = Bitwise.append_flags(inst.collision_mask, collision_mask) projectile_parent_reference.node.add_child(inst)