Skip to content
4 changes: 3 additions & 1 deletion player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://cf3emyoet5j64"]
[gd_scene load_steps=11 format=3 uid="uid://cf3emyoet5j64"]

[ext_resource type="Script" path="res://player.gd" id="1_ft17v"]
[ext_resource type="SpriteFrames" uid="uid://b06a3lft4r7qs" path="res://player_overworld.tres" id="2_3mhg4"]
Expand All @@ -8,6 +8,7 @@
[ext_resource type="Script" path="res://resources/attack_rsc.gd" id="6_bcgn8"]
[ext_resource type="Resource" uid="uid://cs60ixhmh86wm" path="res://resources/attacks/normal_attack.tres" id="6_i87wm"]
[ext_resource type="Resource" uid="uid://hodugild11n5" path="res://resources/attacks/slash_attack.tres" id="7_u0ent"]
[ext_resource type="PackedScene" uid="uid://b18463a7xv7jr" path="res://src/components/defend_component.tscn" id="9_uluyt"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_8s1xf"]
height = 38.0
Expand All @@ -32,3 +33,4 @@ zoom = Vector2(3, 3)

[node name="AttackComponent" parent="." instance=ExtResource("5_xlubi")]
attacks = Array[ExtResource("6_bcgn8")]([ExtResource("6_i87wm"), ExtResource("7_u0ent")])
[node name="DefendComponent" parent="." instance=ExtResource("9_uluyt")]
20 changes: 20 additions & 0 deletions src/components/defend_component.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extends Node

@export var defence = 10

@export_category("Animation")
@export var animation : AnimationPlayer

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


func generate_mitigated_attack(incoming_attack : Attack) -> Attack:
# Placeholder calculation
return Attack.new(
incoming_attack.name,
incoming_attack.description,
incoming_attack.damage - defence,
incoming_attack.accuracy
)
6 changes: 6 additions & 0 deletions src/components/defend_component.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://b18463a7xv7jr"]

[ext_resource type="Script" path="res://src/components/defend_component.gd" id="1_xsk6h"]

[node name="DefendComponent" type="Node"]
script = ExtResource("1_xsk6h")