Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added addons/top_down/assets/images/weapon/gun_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions addons/top_down/resources/DamageResource/asault_rifle_damage.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_resource type="Resource" script_class="DamageResource" load_steps=2 format=3 uid="uid://do8gj8tk86oou"]

[ext_resource type="Script" path="res://addons/top_down/scripts/damage/DamageResource.gd" id="1_5exdr"]

[resource]
resource_name = "Asault riffle damage"
script = ExtResource("1_5exdr")
value = 1.0
critical_multiply = 1.5
critical_chance = 0.3
direction = Vector2(0, 0)
is_critical = false
hit_list = []
total_damage = 0.0
projectile_multiply = 0.5
kickback_strength = 30.0
report_callback = Callable()
transmission_name = &"damage"
state = -1
valid = true
version = 0
not_saved = false
5 changes: 3 additions & 2 deletions addons/top_down/resources/DamageResource/gun_damage.tres
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
resource_name = "Gun damage"
script = ExtResource("1_g4ik4")
value = 1.0
projectile_multiply = 1.0
critical_multiply = 1.5
critical_chance = 0.3
direction = Vector2(0, 0)
kickback_strength = 0.0
is_critical = false
hit_list = []
total_damage = 0.0
projectile_multiply = 1.0
kickback_strength = 60.0
report_callback = Callable()
transmission_name = &"damage"
state = -1
valid = true
Expand Down
5 changes: 3 additions & 2 deletions addons/top_down/resources/DamageResource/shotgun_damage.tres
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
resource_name = "Shotgun damage"
script = ExtResource("1_jwgv3")
value = 2.0
projectile_multiply = 1.0
critical_multiply = 1.5
critical_chance = 0.3
direction = Vector2(0, 0)
kickback_strength = 0.0
is_critical = false
hit_list = []
total_damage = 0.0
projectile_multiply = 0.5
kickback_strength = 30.0
report_callback = Callable()
transmission_name = &"damage"
state = -1
valid = true
Expand Down
6 changes: 3 additions & 3 deletions addons/top_down/scenes/actors/player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=56 format=3 uid="uid://bmp0g88dtijqw"]
[gd_scene load_steps=57 format=3 uid="uid://bmp0g88dtijqw"]

[ext_resource type="PackedScene" uid="uid://botai66n8rwt3" path="res://addons/top_down/scenes/actors/actor.tscn" id="1_mvls6"]
[ext_resource type="Script" path="res://addons/great_games_library/nodes/ResourceNode/ResourceNodeItem.gd" id="2_20qkb"]
Expand All @@ -20,6 +20,7 @@
[ext_resource type="Resource" uid="uid://b8o2o4evevl8k" path="res://addons/top_down/resources/ReferenceNodeResources/player_reference.tres" id="12_l6ujm"]
[ext_resource type="Resource" uid="uid://dyfuc7bon78d" path="res://addons/top_down/resources/InstanceResources/actors/player_dead_instance_resource.tres" id="12_yuaod"]
[ext_resource type="Resource" uid="uid://dsk5usbvnbqi3" path="res://addons/top_down/resources/global_resources/action_resource.tres" id="13_ju15f"]
[ext_resource type="PackedScene" uid="uid://bbfknmfp5j4s0" path="res://addons/top_down/scenes/weapons/assault_riffle.tscn" id="16_chj10"]
[ext_resource type="Script" path="res://addons/top_down/scripts/actor/DashAbility.gd" id="16_vooxc"]
[ext_resource type="Script" path="res://addons/top_down/scripts/actor/player/PlayerJuice.gd" id="17_32qwh"]
[ext_resource type="Resource" uid="uid://diqvd4u0lbw7h" path="res://addons/top_down/resources/CommandNodeResource/color_flash.tres" id="18_5jtne"]
Expand Down Expand Up @@ -304,8 +305,7 @@ action_resource = ExtResource("13_ju15f")

[node name="WeaponManager" type="Node2D" parent="." index="14" node_paths=PackedStringArray("resource_node")]
script = ExtResource("9_hpc12")
projectile_parent_path = "../.."
auto_instance_weapons = Array[PackedScene]([ExtResource("11_nnusp"), ExtResource("12_gom0h"), ExtResource("10_x7xjs")])
auto_instance_weapons = Array[PackedScene]([ExtResource("11_nnusp"), ExtResource("16_chj10"), ExtResource("12_gom0h"), ExtResource("10_x7xjs")])
resource_node = NodePath("../ResourceNode")
collision_mask = 4

Expand Down
1 change: 0 additions & 1 deletion addons/top_down/scenes/projectiles/bullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ scale_curve = SubResource("CurveTexture_k2ccc")
color_ramp = SubResource("GradientTexture1D_138ku")

[node name="Bullet" instance=ExtResource("1_omfnw")]
kickback_strength = 60.0

[node name="Shadow" type="Sprite2D" parent="." index="1"]
modulate = Color(1, 0.983333, 0, 0.168627)
Expand Down
1 change: 0 additions & 1 deletion addons/top_down/scenes/projectiles/shotgun_bullet.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ not_saved = false
[node name="ShotgunBullet" instance=ExtResource("1_fx1dm")]
speed = 170.0
damage_multiply = 0.5
kickback_strength = 40.0

[node name="DamageDataTransmitter" parent="AreaTransmitter2D" index="2"]
transmission_resource = SubResource("Resource_ii8uo")
Expand Down
9 changes: 4 additions & 5 deletions addons/top_down/scenes/projectiles/sword_projectile.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[gd_scene load_steps=13 format=3 uid="uid://dmskvynh1rsk"]

[ext_resource type="PackedScene" uid="uid://beifde6xst23w" path="res://addons/top_down/scenes/projectiles/projectile.tscn" id="1_3klw8"]
[ext_resource type="Texture2D" uid="uid://b3gj1j73p318" path="res://addons/top_down/assets/images/shadow.png" id="2_jihd4"]
[ext_resource type="Texture2D" uid="uid://c87lf6ubef5eg" path="res://addons/top_down/assets/images/shadow.png" id="2_jihd4"]
[ext_resource type="PackedScene" uid="uid://djobi3eqlcjvo" path="res://addons/top_down/scenes/vfx/trail_particle.tscn" id="3_icwgt"]
[ext_resource type="Texture2D" uid="uid://d2deop4hqut1j" path="res://addons/top_down/assets/images/vfx/slash_1_strip4.png" id="4_7va1q"]
[ext_resource type="Texture2D" uid="uid://co307xh0djfed" path="res://addons/top_down/assets/images/vfx/slash_1_strip4.png" id="4_7va1q"]

[sub_resource type="Gradient" id="Gradient_vk3jb"]
interpolation_mode = 2
Expand Down Expand Up @@ -96,8 +96,8 @@ _data = {

[node name="SwordProjectile" instance=ExtResource("1_3klw8")]
speed = 150.0
damage_multiply = 0.5
kickback_strength = 30.0
damage_multiply = 0.25
kickback_multiply = 0.25

[node name="Shadow" type="Sprite2D" parent="." index="1"]
visible = false
Expand Down Expand Up @@ -128,4 +128,3 @@ time = 0.4
ready_nodes = [NodePath(".."), NodePath("../ProjectileSetup"), NodePath("../ProjectileLifetime"), NodePath("../HitLimit"), NodePath("../ProjectileRotation"), NodePath("../RotatedNode/Sprite2D/AnimationPlayer"), NodePath("../RotatedNode/TrailParticle")]
animation_player_list = [NodePath("../RotatedNode/Sprite2D/AnimationPlayer")]
particle2d_list = [NodePath("../RotatedNode/TrailParticle")]
debug = true
2 changes: 1 addition & 1 deletion addons/top_down/scenes/projectiles/zombie_slash.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://cm7673sbsnyya"]

[ext_resource type="PackedScene" uid="uid://beifde6xst23w" path="res://addons/top_down/scenes/projectiles/projectile.tscn" id="1_5ra58"]
[ext_resource type="Texture2D" uid="uid://cv5ossx1x5twk" path="res://addons/top_down/assets/images/vfx/slash_2_strip5.png" id="2_eg08h"]
[ext_resource type="Texture2D" uid="uid://rh43xpygle30" path="res://addons/top_down/assets/images/vfx/slash_2_strip5.png" id="2_eg08h"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_5a4j3"]
size = Vector2(8, 4)
Expand Down
14 changes: 14 additions & 0 deletions addons/top_down/scenes/weapons/assault_riffle.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=3 uid="uid://bbfknmfp5j4s0"]

[ext_resource type="PackedScene" uid="uid://bxf4p5yoajpdu" path="res://addons/top_down/scenes/weapons/gun.tscn" id="1_fl1fv"]
[ext_resource type="Texture2D" uid="uid://cfkd4hikkxfte" path="res://addons/top_down/assets/images/weapon/gun_3.png" id="2_a6vce"]
[ext_resource type="Resource" uid="uid://do8gj8tk86oou" path="res://addons/top_down/resources/DamageResource/asault_rifle_damage.tres" id="2_diydu"]

[node name="AssaultRiffle" instance=ExtResource("1_fl1fv")]
damage_resource = ExtResource("2_diydu")

[node name="Sprite2D" parent="RotatedNode" index="0"]
texture = ExtResource("2_a6vce")

[node name="ProjectileInterval" parent="WeaponTrigger" index="0"]
interval = 0.1
16 changes: 8 additions & 8 deletions addons/top_down/scenes/weapons/sword.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ tracks/1/keys = {
"values": [Vector2(0, 0)]
}

[sub_resource type="Animation" id="Animation_l1rlv"]
resource_name = "slash_2"
[sub_resource type="Animation" id="Animation_k26j0"]
resource_name = "slash_1"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
Expand All @@ -45,7 +45,7 @@ tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667),
"transitions": PackedFloat32Array(0.5, 1),
"update": 0,
"values": [3.14159, 0.0]
"values": [0.0, 3.14159]
}
tracks/1/type = "value"
tracks/1/imported = false
Expand All @@ -57,11 +57,11 @@ tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.166667),
"transitions": PackedFloat32Array(0.5, 1, 1),
"update": 0,
"values": [Vector2(0, 2), Vector2(5, 0), Vector2(0, 0)]
"values": [Vector2(0, 0), Vector2(5, 0), Vector2(0, 2)]
}

[sub_resource type="Animation" id="Animation_k26j0"]
resource_name = "slash_1"
[sub_resource type="Animation" id="Animation_l1rlv"]
resource_name = "slash_2"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
Expand All @@ -73,7 +73,7 @@ tracks/0/keys = {
"times": PackedFloat32Array(0, 0.166667),
"transitions": PackedFloat32Array(0.5, 1),
"update": 0,
"values": [0.0, 3.14159]
"values": [3.14159, 0.0]
}
tracks/1/type = "value"
tracks/1/imported = false
Expand All @@ -85,7 +85,7 @@ tracks/1/keys = {
"times": PackedFloat32Array(0, 0.0333333, 0.166667),
"transitions": PackedFloat32Array(0.5, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(5, 0), Vector2(0, 2)]
"values": [Vector2(0, 2), Vector2(5, 0), Vector2(0, 0)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_sorlh"]
Expand Down
3 changes: 0 additions & 3 deletions addons/top_down/scenes/weapons/zombie_attack.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ visible = false
[node name="WeaponTrigger" parent="." index="3"]
sound_resource = ExtResource("3_4gid6")

[node name="AnimationTrigger" parent="WeaponTrigger" index="1"]
animation_name = &""

[node name="ProjectileSpawner" parent="." index="4"]
projectile_instance_resource = ExtResource("6_3bs3g")

Expand Down
20 changes: 16 additions & 4 deletions addons/top_down/scripts/damage/DamageResource.gd
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
class_name DamageResource
extends TransmissionResource

## Initial base damage value
@export var value:float = 1
@export var projectile_multiply:float = 1.0

## Critical damage multiplier
@export var critical_multiply:float = 1.5

## Probability of critical damage happening
@export var critical_chance:float = 0.3

## Direction of dealth damage
@export var direction:Vector2
@export var kickback_strength:float

## An information for a damage report
@export var is_critical:bool = false
Expand All @@ -17,7 +22,14 @@ extends TransmissionResource

## pre-calculated value
@export var total_damage:float
## TODO: include information from source character

## Projectile damage multiplier, manipulated in ProjectileSetup
@export var projectile_multiply:float = 1.0

## Kickback given to damage target, manipulated in ProjectileSetup
@export var kickback_strength:float

## Callback function to receive DamageResource that hit a target
@export var report_callback:Callable


Expand Down Expand Up @@ -86,5 +98,5 @@ func process(resource_node:ResourceNode)->void:

success()

if report_callback.is_valid:
if report_callback.is_valid():
report_callback.call(self)
3 changes: 0 additions & 3 deletions addons/top_down/scripts/weapon_system/WeaponManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ extends Node2D
signal weapon_changed
signal damage_report(damage:DamageResource)

## Relative to this manager
## Will be modified to correct for instanced wepons
@export var projectile_parent_path:String

## Scene files that will be instanced and added to the user in disabled state
@export var auto_instance_weapons:Array[PackedScene]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ signal prepare_exit_event
@export var damage_multiply:float = 1.0

## Force pushing a damage receiver
@export var kickback_strength:float = 120.0
@export var kickback_multiply:float = 1.0

## Holds information about damage stats and events
@export var damage_resource:DamageResource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class_name ProjectileSetup
extends Node

@export var projectile:Projectile2D
Expand All @@ -9,8 +10,8 @@ extends Node
func _ready()->void:
var _damage_resource:DamageResource = projectile.damage_resource
# fill last values that projectile is controlling
_damage_resource.kickback_strength = projectile.kickback_strength
_damage_resource.projectile_multiply = projectile.damage_multiply
_damage_resource.kickback_strength *= projectile.kickback_multiply
_damage_resource.projectile_multiply *= projectile.damage_multiply
_damage_resource.initialize_generation()

area_transmitter.collision_mask = Bitwise.append_flags(area_transmitter.collision_mask, projectile.collision_mask)
Expand Down