-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
1,724 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extends Label | ||
|
||
@export var float_speed : Vector2 = Vector2(0, -60) | ||
|
||
func _process(delta): | ||
position += float_speed * delta | ||
|
||
func _on_timer_timeout(): | ||
queue_free() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://cpb651k7lnqc1"] | ||
|
||
[ext_resource type="Script" path="res://UI/health_changed_label.gd" id="1_pinmb"] | ||
|
||
[node name="HealthChangedLabel" type="Label"] | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
scale = Vector2(-1, 1) | ||
text = "1000" | ||
script = ExtResource("1_pinmb") | ||
|
||
[node name="Timer" type="Timer" parent="."] | ||
wait_time = 0.25 | ||
one_shot = true | ||
autostart = true | ||
|
||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extends Control | ||
|
||
@export var health_changed_label : PackedScene | ||
@export var damage_color : Color = Color.RED | ||
@export var heal_color : Color = Color.DARK_GREEN | ||
|
||
func _ready(): | ||
SignalBus.connect("on_health_changed", on_signal_health_changed) | ||
|
||
func on_signal_health_changed(node : Node, amount_changed : int): | ||
var label_instance : Label = health_changed_label.instantiate() | ||
node.add_child(label_instance) | ||
label_instance.text = str(amount_changed) | ||
|
||
if (amount_changed >= 0): | ||
label_instance.modulate = heal_color | ||
else: | ||
label_instance.modulate = damage_color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[gd_scene load_steps=3 format=3 uid="uid://crpf2r1wyh8dc"] | ||
|
||
[ext_resource type="Script" path="res://UI/health_changed_manager.gd" id="1_7poyf"] | ||
[ext_resource type="PackedScene" uid="uid://cpb651k7lnqc1" path="res://UI/health_changed_label.tscn" id="2_0iu2e"] | ||
|
||
[node name="HealthChangedManager" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 0 | ||
offset_right = 40.0 | ||
offset_bottom = 40.0 | ||
script = ExtResource("1_7poyf") | ||
health_changed_label = ExtResource("2_0iu2e") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
extends CharacterBody2D | ||
|
||
@onready var animation_tree : AnimationTree = $AnimationTree | ||
@onready var state_machine : CharacterStateMachine = $CharacterStateMachine | ||
|
||
@export var direction_moviment : Vector2 = Vector2.LEFT | ||
@export var moviment_speed : float = 30.0 | ||
@export var hit_state : State | ||
|
||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") | ||
|
||
func _ready(): | ||
animation_tree.active = true | ||
|
||
func _physics_process(delta): | ||
# Add the gravity. | ||
if not is_on_floor(): | ||
velocity.y += gravity * delta | ||
|
||
var direction = direction_moviment | ||
if direction && state_machine.check_if_can_move(): | ||
velocity.x = direction.x * moviment_speed | ||
elif state_machine.current_state != hit_state: | ||
velocity.x = move_toward(velocity.x, 0, moviment_speed) | ||
|
||
move_and_slide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
[gd_scene load_steps=18 format=3 uid="uid://be48g266pduuv"] | ||
|
||
[ext_resource type="Script" path="res://actors/enemies/skeleton.gd" id="1_fcts4"] | ||
[ext_resource type="Texture2D" uid="uid://d2asilpuorawd" path="res://sprites/enemies/skeleton/Skeleton_Warrior/Walk.png" id="1_o72yl"] | ||
[ext_resource type="Texture2D" uid="uid://bxrnjqdaig4vi" path="res://sprites/enemies/skeleton/Skeleton_Warrior/Dead.png" id="1_ocgkr"] | ||
[ext_resource type="Script" path="res://scripts/character/Damageable.gd" id="3_2npcb"] | ||
[ext_resource type="Script" path="res://scripts/character/CharacterStateMachine.gd" id="4_jolhm"] | ||
[ext_resource type="Script" path="res://scripts/character/State.gd" id="5_chvoe"] | ||
[ext_resource type="Script" path="res://scripts/character/HitState.gd" id="6_r1ria"] | ||
|
||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_j8pvb"] | ||
size = Vector2(24, 63) | ||
|
||
[sub_resource type="Animation" id="Animation_ossw2"] | ||
resource_name = "walk" | ||
length = 0.7 | ||
loop_mode = 1 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath("Sprite2D:texture") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [ExtResource("1_o72yl")] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/path = NodePath("Sprite2D:hframes") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [7] | ||
} | ||
tracks/2/type = "value" | ||
tracks/2/imported = false | ||
tracks/2/enabled = true | ||
tracks/2/path = NodePath("Sprite2D:frame") | ||
tracks/2/interp = 1 | ||
tracks/2/loop_wrap = true | ||
tracks/2/keys = { | ||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), | ||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), | ||
"update": 1, | ||
"values": [0, 1, 2, 3, 4, 5, 6] | ||
} | ||
|
||
[sub_resource type="Animation" id="Animation_cs8li"] | ||
length = 0.001 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath("Sprite2D:frame") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [0] | ||
} | ||
|
||
[sub_resource type="Animation" id="Animation_n85pf"] | ||
resource_name = "dead" | ||
length = 0.6 | ||
tracks/0/type = "value" | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/path = NodePath("Sprite2D:texture") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [ExtResource("1_ocgkr")] | ||
} | ||
tracks/1/type = "value" | ||
tracks/1/imported = false | ||
tracks/1/enabled = true | ||
tracks/1/path = NodePath("Sprite2D:hframes") | ||
tracks/1/interp = 1 | ||
tracks/1/loop_wrap = true | ||
tracks/1/keys = { | ||
"times": PackedFloat32Array(0), | ||
"transitions": PackedFloat32Array(1), | ||
"update": 1, | ||
"values": [4] | ||
} | ||
tracks/2/type = "value" | ||
tracks/2/imported = false | ||
tracks/2/enabled = true | ||
tracks/2/path = NodePath("Sprite2D:frame") | ||
tracks/2/interp = 1 | ||
tracks/2/loop_wrap = true | ||
tracks/2/keys = { | ||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3), | ||
"transitions": PackedFloat32Array(1, 1, 1, 1), | ||
"update": 1, | ||
"values": [0, 1, 2, 3] | ||
} | ||
|
||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n33he"] | ||
_data = { | ||
"RESET": SubResource("Animation_cs8li"), | ||
"dead": SubResource("Animation_n85pf"), | ||
"walk": SubResource("Animation_ossw2") | ||
} | ||
|
||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_y4jw7"] | ||
animation = &"dead" | ||
|
||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ckqfr"] | ||
animation = &"walk" | ||
|
||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8rppm"] | ||
advance_mode = 2 | ||
|
||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_wpq2y"] | ||
|
||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1qqu5"] | ||
states/dead/node = SubResource("AnimationNodeAnimation_y4jw7") | ||
states/dead/position = Vector2(519, 100) | ||
states/walk/node = SubResource("AnimationNodeAnimation_ckqfr") | ||
states/walk/position = Vector2(367, 100) | ||
transitions = ["Start", "walk", SubResource("AnimationNodeStateMachineTransition_8rppm"), "walk", "dead", SubResource("AnimationNodeStateMachineTransition_wpq2y")] | ||
|
||
[node name="Skeleton" type="CharacterBody2D" node_paths=PackedStringArray("hit_state")] | ||
scale = Vector2(-1, 1) | ||
collision_layer = 4 | ||
collision_mask = 2 | ||
script = ExtResource("1_fcts4") | ||
hit_state = NodePath("CharacterStateMachine/Hit") | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
position = Vector2(-3, 31.5) | ||
shape = SubResource("RectangleShape2D_j8pvb") | ||
|
||
[node name="Sprite2D" type="Sprite2D" parent="."] | ||
texture = ExtResource("1_ocgkr") | ||
hframes = 4 | ||
|
||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||
libraries = { | ||
"": SubResource("AnimationLibrary_n33he") | ||
} | ||
|
||
[node name="Damageable" type="Node" parent="."] | ||
script = ExtResource("3_2npcb") | ||
|
||
[node name="AnimationTree" type="AnimationTree" parent="."] | ||
tree_root = SubResource("AnimationNodeStateMachine_1qqu5") | ||
anim_player = NodePath("../AnimationPlayer") | ||
|
||
[node name="CharacterStateMachine" type="Node" parent="." node_paths=PackedStringArray("character", "animation_tree", "current_state")] | ||
script = ExtResource("4_jolhm") | ||
character = NodePath("..") | ||
animation_tree = NodePath("../AnimationTree") | ||
current_state = NodePath("Walk") | ||
|
||
[node name="Walk" type="Node" parent="CharacterStateMachine"] | ||
script = ExtResource("5_chvoe") | ||
|
||
[node name="Dead" type="Node" parent="CharacterStateMachine"] | ||
script = ExtResource("5_chvoe") | ||
|
||
[node name="Hit" type="Node" parent="CharacterStateMachine" node_paths=PackedStringArray("damageable", "dead_state", "return_state")] | ||
script = ExtResource("6_r1ria") | ||
damageable = NodePath("../../Damageable") | ||
dead_state = NodePath("../Dead") | ||
return_state = NodePath("../Walk") | ||
can_move = false | ||
|
||
[node name="Timer" type="Timer" parent="CharacterStateMachine/Hit"] | ||
wait_time = 0.25 | ||
one_shot = true | ||
|
||
[connection signal="animation_finished" from="AnimationTree" to="Damageable" method="_on_animation_tree_animation_finished"] | ||
[connection signal="timeout" from="CharacterStateMachine/Hit/Timer" to="CharacterStateMachine/Hit" method="_on_timer_timeout"] |
Oops, something went wrong.