init
This commit is contained in:
BIN
player/audio/SwordSwoosh.wav
Normal file
BIN
player/audio/SwordSwoosh.wav
Normal file
Binary file not shown.
24
player/audio/SwordSwoosh.wav.import
Normal file
24
player/audio/SwordSwoosh.wav.import
Normal file
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://qsxe4l0o268q"
|
||||
path="res://.godot/imported/SwordSwoosh.wav-f30e293b6421bffc875aeb09805a5384.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/audio/SwordSwoosh.wav"
|
||||
dest_files=["res://.godot/imported/SwordSwoosh.wav-f30e293b6421bffc875aeb09805a5384.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
BIN
player/audio/hit_player.wav
Normal file
BIN
player/audio/hit_player.wav
Normal file
Binary file not shown.
24
player/audio/hit_player.wav.import
Normal file
24
player/audio/hit_player.wav.import
Normal file
@@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://dgqiq3755uttq"
|
||||
path="res://.godot/imported/hit_player.wav-906e5c3229ae8f245a876efcb6d12a8d.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/audio/hit_player.wav"
|
||||
dest_files=["res://.godot/imported/hit_player.wav-906e5c3229ae8f245a876efcb6d12a8d.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
716
player/player.tscn
Normal file
716
player/player.tscn
Normal file
@@ -0,0 +1,716 @@
|
||||
[gd_scene format=3 uid="uid://c3v8niwu0avmm"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bh2madpelppjn" path="res://player/scripts/player.gd" id="1_rkbax"]
|
||||
[ext_resource type="Texture2D" uid="uid://cge4rwsf016ej" path="res://player/sprites/PlayerSprite02.png" id="2_qjkh3"]
|
||||
[ext_resource type="Texture2D" uid="uid://b0hgmxuickvw8" path="res://player/sprites/AttackSprite01.png" id="3_boad6"]
|
||||
[ext_resource type="Script" uid="uid://cbmwqg1xr14sg" path="res://player/scripts/player_state_machine.gd" id="3_yw30f"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxqdnnk4dqnu5" path="res://player/sprites/Shadow.png" id="4_hg6s5"]
|
||||
[ext_resource type="Script" uid="uid://cabtgwm5i08oe" path="res://player/scripts/state_idle.gd" id="4_qjkh3"]
|
||||
[ext_resource type="Script" uid="uid://c6p40pfivsfxo" path="res://player/scripts/state_walk.gd" id="5_qjkh3"]
|
||||
[ext_resource type="Script" uid="uid://rkjhx7gfma1e" path="res://player/scripts/state_attack.gd" id="6_g6k8r"]
|
||||
[ext_resource type="AudioStream" uid="uid://qsxe4l0o268q" path="res://player/audio/SwordSwoosh.wav" id="8_rgyib"]
|
||||
[ext_resource type="Script" uid="uid://ba6scm5um18sd" path="res://player/scripts/player_interactions_host.gd" id="10_2ieo8"]
|
||||
[ext_resource type="PackedScene" uid="uid://mwyvk4gke34" path="res://general/hurtbox/hurtbox.tscn" id="10_8t03j"]
|
||||
[ext_resource type="Script" uid="uid://gyjl7owe3dxx" path="res://player/scripts/camera.gd" id="11_ebec5"]
|
||||
[ext_resource type="Script" uid="uid://pr4o7w6faw08" path="res://player/scripts/state_stun.gd" id="11_wodsf"]
|
||||
[ext_resource type="PackedScene" uid="uid://cda6fr5vhb4ty" path="res://general/hitbox/hitbox.tscn" id="13_yllr7"]
|
||||
[ext_resource type="Script" uid="uid://cyff8l2rrvtl" path="res://player/scripts/push_area.gd" id="14_32hag"]
|
||||
[ext_resource type="AudioStream" uid="uid://dgqiq3755uttq" path="res://player/audio/hit_player.wav" id="14_kb6p2"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ebec5"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 10)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:show_behind_parent")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yllr7"]
|
||||
resource_name = "attack_down"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 3]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 10)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:show_behind_parent")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_kb6p2"]
|
||||
resource_name = "attack_side"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [8, 11]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(10, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:show_behind_parent")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wodsf"]
|
||||
resource_name = "attack_up"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [4, 7]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -10)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath(".:show_behind_parent")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath(".:visible")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_32hag"]
|
||||
resource_name = "no_attack"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_32hag"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_ebec5"),
|
||||
&"attack_down": SubResource("Animation_yllr7"),
|
||||
&"attack_side": SubResource("Animation_kb6p2"),
|
||||
&"attack_up": SubResource("Animation_wodsf"),
|
||||
&"no_attack": SubResource("Animation_32hag")
|
||||
}
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_2ieo8"]
|
||||
radius = 20.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_rkbax"]
|
||||
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]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D/attack_hurtbox:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 36)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hg6s5"]
|
||||
resource_name = "attack_down"
|
||||
length = 0.3
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [21, 23]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D/attack_hurtbox:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 17)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8t03j"]
|
||||
resource_name = "attack_side"
|
||||
length = 0.3
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [27, 29]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D/attack_hurtbox:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(17, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_2ieo8"]
|
||||
resource_name = "attack_up"
|
||||
length = 0.3
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [24, 26]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite2D/attack_hurtbox:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -17)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_g1dw6"]
|
||||
resource_name = "idle_down"
|
||||
length = 0.4
|
||||
loop_mode = 2
|
||||
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, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 2]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_yw30f"]
|
||||
resource_name = "idle_side"
|
||||
length = 0.4
|
||||
loop_mode = 2
|
||||
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, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [6, 8]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qjkh3"]
|
||||
resource_name = "idle_up"
|
||||
length = 0.4
|
||||
loop_mode = 2
|
||||
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, 0.4),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [3, 5]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_tqiix"]
|
||||
resource_name = "stun_down"
|
||||
length = 0.3
|
||||
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": 0,
|
||||
"values": [30]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_e7oew"]
|
||||
resource_name = "stun_side"
|
||||
length = 0.3
|
||||
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": 0,
|
||||
"values": [32]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_c35mf"]
|
||||
resource_name = "stun_up"
|
||||
length = 0.3
|
||||
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": 0,
|
||||
"values": [31]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_g6k8r"]
|
||||
resource_name = "walk_down"
|
||||
length = 0.3
|
||||
loop_mode = 2
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [9, 12]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_boad6"]
|
||||
resource_name = "walk_side"
|
||||
length = 0.3
|
||||
loop_mode = 2
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [17, 20]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_rgyib"]
|
||||
resource_name = "walk_up"
|
||||
length = 0.3
|
||||
loop_mode = 2
|
||||
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, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [13, 16]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hg6s5"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_rkbax"),
|
||||
&"attack_down": SubResource("Animation_hg6s5"),
|
||||
&"attack_side": SubResource("Animation_8t03j"),
|
||||
&"attack_up": SubResource("Animation_2ieo8"),
|
||||
&"idle_down": SubResource("Animation_g1dw6"),
|
||||
&"idle_side": SubResource("Animation_yw30f"),
|
||||
&"idle_up": SubResource("Animation_qjkh3"),
|
||||
&"stun_down": SubResource("Animation_tqiix"),
|
||||
&"stun_side": SubResource("Animation_e7oew"),
|
||||
&"stun_up": SubResource("Animation_c35mf"),
|
||||
&"walk_down": SubResource("Animation_g6k8r"),
|
||||
&"walk_side": SubResource("Animation_boad6"),
|
||||
&"walk_up": SubResource("Animation_rgyib")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wodsf"]
|
||||
size = Vector2(20, 8.999985)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_32hag"]
|
||||
size = Vector2(20, 16.499956)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_edjgo"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_kb6p2"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_65viv"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bjvpn"]
|
||||
resource_name = "damaged"
|
||||
step = 0.1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4015934, 0.49814668, 0.6092257, 0.7100513, 0.8040412),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0.09803922), Color(1, 1, 1, 1), Color(1, 1, 1, 0.05882353), Color(1, 1, 1, 1), Color(1, 1, 1, 0.39215687), Color(1, 1, 1, 1), Color(1, 1, 1, 0.09803922), Color(1, 1, 1, 1)]
|
||||
}
|
||||
tracks/1/type = "audio"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("audio/audio")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"clips": [{
|
||||
"end_offset": 0.0,
|
||||
"start_offset": 0.0,
|
||||
"stream": ExtResource("14_kb6p2")
|
||||
}],
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
tracks/1/use_blend = true
|
||||
|
||||
[sub_resource type="Animation" id="Animation_x7c3f"]
|
||||
resource_name = "default"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:modulate")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_bjvpn"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_65viv"),
|
||||
&"damaged": SubResource("Animation_bjvpn"),
|
||||
&"default": SubResource("Animation_x7c3f")
|
||||
}
|
||||
|
||||
[node name="player" type="CharacterBody2D" unique_id=267810811]
|
||||
collision_mask = 16
|
||||
motion_mode = 1
|
||||
wall_min_slide_angle = 0.17453292
|
||||
script = ExtResource("1_rkbax")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=536210534]
|
||||
position = Vector2(0, -20)
|
||||
texture = ExtResource("2_qjkh3")
|
||||
hframes = 16
|
||||
vframes = 3
|
||||
|
||||
[node name="shadow" type="Sprite2D" parent="Sprite2D" unique_id=175175930]
|
||||
modulate = Color(0, 0, 0, 0.5176471)
|
||||
show_behind_parent = true
|
||||
position = Vector2(0, 20)
|
||||
texture = ExtResource("4_hg6s5")
|
||||
|
||||
[node name="attack_effect" type="Sprite2D" parent="Sprite2D" unique_id=707156114]
|
||||
position = Vector2(0, 10)
|
||||
texture = ExtResource("3_boad6")
|
||||
hframes = 12
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Sprite2D/attack_effect" unique_id=1619018780]
|
||||
libraries/ = SubResource("AnimationLibrary_32hag")
|
||||
autoplay = &"no_attack"
|
||||
|
||||
[node name="attack_hurtbox" parent="Sprite2D" unique_id=38213362 instance=ExtResource("10_8t03j")]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, 36)
|
||||
rotation = 0.002383499
|
||||
scale = Vector2(0.99999994, 0.99999994)
|
||||
collision_mask = 256
|
||||
monitoring = false
|
||||
|
||||
[node name="collision" type="CollisionShape2D" parent="Sprite2D/attack_hurtbox" unique_id=1176445286]
|
||||
shape = SubResource("CircleShape2D_2ieo8")
|
||||
debug_color = Color(0.99431497, 0, 0.2313017, 0.41960785)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=65643183]
|
||||
libraries/ = SubResource("AnimationLibrary_hg6s5")
|
||||
|
||||
[node name="state_machine" type="Node2D" parent="." unique_id=1189850546]
|
||||
script = ExtResource("3_yw30f")
|
||||
|
||||
[node name="idle" type="Node2D" parent="state_machine" unique_id=1427450181]
|
||||
script = ExtResource("4_qjkh3")
|
||||
|
||||
[node name="walk" type="Node2D" parent="state_machine" unique_id=1531939313]
|
||||
script = ExtResource("5_qjkh3")
|
||||
|
||||
[node name="attack" type="Node2D" parent="state_machine" unique_id=1875111878]
|
||||
script = ExtResource("6_g6k8r")
|
||||
attack_sound = ExtResource("8_rgyib")
|
||||
|
||||
[node name="stun" type="Node2D" parent="state_machine" unique_id=242638647]
|
||||
script = ExtResource("11_wodsf")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=77105996]
|
||||
position = Vector2(6, -5)
|
||||
script = ExtResource("11_ebec5")
|
||||
|
||||
[node name="audio" type="Node2D" parent="." unique_id=1455470313]
|
||||
|
||||
[node name="audio" type="AudioStreamPlayer2D" parent="audio" unique_id=245569319]
|
||||
max_polyphony = 4
|
||||
|
||||
[node name="interactions" type="Node2D" parent="." unique_id=446148331]
|
||||
rotation = 0.002383499
|
||||
script = ExtResource("10_2ieo8")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="interactions" unique_id=265616332]
|
||||
collision_layer = 4
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="interactions/Area2D" unique_id=902291624]
|
||||
position = Vector2(0, 6)
|
||||
shape = SubResource("RectangleShape2D_wodsf")
|
||||
debug_color = Color(3.3691526e-07, 0.6381925, 0.38625547, 0.41960785)
|
||||
|
||||
[node name="PushArea" type="Area2D" parent="interactions" unique_id=2049347269]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitorable = false
|
||||
script = ExtResource("14_32hag")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="interactions/PushArea" unique_id=992735310]
|
||||
position = Vector2(-0.002383499, 2.7499897)
|
||||
scale = Vector2(1.0000002, 1.0000002)
|
||||
shape = SubResource("RectangleShape2D_32hag")
|
||||
debug_color = Color(0.86947346, 0.09178855, 0.8239628, 0.41960785)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1933391791]
|
||||
shape = SubResource("CircleShape2D_edjgo")
|
||||
|
||||
[node name="Hitbox" parent="." unique_id=1876591880 instance=ExtResource("13_yllr7")]
|
||||
collision_layer = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox" unique_id=130293538]
|
||||
position = Vector2(0, -8)
|
||||
shape = SubResource("CircleShape2D_kb6p2")
|
||||
debug_color = Color(0.75446975, 0.45642966, 0.03938905, 0.41960785)
|
||||
|
||||
[node name="effect_animation" type="AnimationPlayer" parent="." unique_id=658262531]
|
||||
libraries/ = SubResource("AnimationLibrary_bjvpn")
|
||||
11
player/scripts/camera.gd
Normal file
11
player/scripts/camera.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
class_name Camera extends Camera2D
|
||||
|
||||
func _ready() -> void:
|
||||
LevelManager.Tilemap_boudns_change.connect(update_limits)
|
||||
|
||||
func update_limits(bounds: Array[Vector2]) -> void:
|
||||
limit_left = int(bounds[0].x)
|
||||
limit_top = int(bounds[0].y)
|
||||
limit_right = int(bounds[1].x)
|
||||
limit_bottom = int(bounds[1].y)
|
||||
|
||||
1
player/scripts/camera.gd.uid
Normal file
1
player/scripts/camera.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://gyjl7owe3dxx
|
||||
87
player/scripts/player.gd
Normal file
87
player/scripts/player.gd
Normal file
@@ -0,0 +1,87 @@
|
||||
class_name Player extends CharacterBody2D
|
||||
|
||||
const DIR_4 = [
|
||||
Vector2.RIGHT,
|
||||
Vector2.DOWN,
|
||||
Vector2.LEFT,
|
||||
Vector2.UP,
|
||||
]
|
||||
|
||||
signal direction_change(new_direction: Vector2)
|
||||
signal player_damaged(hurtbox: Hurtbox)
|
||||
|
||||
@onready var animation_player : AnimationPlayer = $AnimationPlayer
|
||||
@onready var sprite : Sprite2D = $Sprite2D
|
||||
@onready var state_machine: PlayerStateMachine = $state_machine
|
||||
@onready var hitbox: Hitbox = $Hitbox
|
||||
@onready var effect_animation: AnimationPlayer = $effect_animation
|
||||
|
||||
@export_group("Stats")
|
||||
@export var hp: int = 6
|
||||
@export var maxHp: int = 6
|
||||
|
||||
var cardinal_direction : Vector2 = Vector2.DOWN
|
||||
var direction : Vector2 = Vector2.ZERO
|
||||
var invlunerable: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
PlayerManager.player = self
|
||||
state_machine.initialize(self)
|
||||
hitbox.damaged.connect(on_damage)
|
||||
update_hp(99)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
direction = Vector2(
|
||||
Input.get_axis("left", "right"),
|
||||
Input.get_axis("up", "down"),
|
||||
).normalized()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
||||
func set_direction() -> bool:
|
||||
if direction == Vector2.ZERO:
|
||||
return false
|
||||
|
||||
var new_direction = DIR_4[int(round((direction + cardinal_direction * 0.1).angle() / TAU * DIR_4.size()))]
|
||||
|
||||
if new_direction == cardinal_direction:
|
||||
return false
|
||||
cardinal_direction = new_direction
|
||||
direction_change.emit(new_direction)
|
||||
sprite.scale.x = -1 if cardinal_direction == Vector2.LEFT else 1
|
||||
return true
|
||||
|
||||
func update_animation(state: String) -> void:
|
||||
animation_player.play(state + "_" + anim_direction())
|
||||
|
||||
func anim_direction() -> String:
|
||||
var direction_result : String = "side"
|
||||
if cardinal_direction == Vector2.DOWN:
|
||||
direction_result = "down"
|
||||
elif cardinal_direction == Vector2.UP:
|
||||
direction_result = "up"
|
||||
return direction_result
|
||||
|
||||
func on_damage(hurtbox: Hurtbox) -> void:
|
||||
if invlunerable:
|
||||
return
|
||||
update_hp(-hurtbox.damage)
|
||||
if hp > 0:
|
||||
player_damaged.emit(hurtbox)
|
||||
else:
|
||||
player_damaged.emit(hurtbox)
|
||||
update_hp(99)
|
||||
|
||||
func update_hp(more_hp: int) -> void:
|
||||
hp = clampi(hp + more_hp, 0, maxHp)
|
||||
Hud.update_hp(hp, maxHp)
|
||||
|
||||
func make_invulnerable(duration: float = 1.0) -> void:
|
||||
invlunerable = true
|
||||
hitbox.monitoring = false
|
||||
|
||||
await get_tree().create_timer(duration).timeout
|
||||
invlunerable = false
|
||||
hitbox.monitoring = true
|
||||
|
||||
1
player/scripts/player.gd.uid
Normal file
1
player/scripts/player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bh2madpelppjn
|
||||
19
player/scripts/player_interactions_host.gd
Normal file
19
player/scripts/player_interactions_host.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
class_name PlayerInteractionsHost extends Node2D
|
||||
|
||||
@onready var player: Player = $".."
|
||||
|
||||
func _ready() -> void:
|
||||
player.direction_change.connect(update_direction)
|
||||
|
||||
func update_direction(new_direction: Vector2) -> void:
|
||||
match new_direction:
|
||||
Vector2.DOWN:
|
||||
rotation_degrees = 0
|
||||
Vector2.UP:
|
||||
rotation_degrees = 180
|
||||
Vector2.LEFT:
|
||||
rotation_degrees = 90
|
||||
Vector2.RIGHT:
|
||||
rotation_degrees = 270
|
||||
_:
|
||||
rotation_degrees = 0
|
||||
1
player/scripts/player_interactions_host.gd.uid
Normal file
1
player/scripts/player_interactions_host.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ba6scm5um18sd
|
||||
46
player/scripts/player_state_machine.gd
Normal file
46
player/scripts/player_state_machine.gd
Normal file
@@ -0,0 +1,46 @@
|
||||
class_name PlayerStateMachine extends Node
|
||||
|
||||
var states: Array[State]
|
||||
var previous_state: State
|
||||
var current_state: State
|
||||
|
||||
func _ready() -> void:
|
||||
process_mode = Node.PROCESS_MODE_DISABLED
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
change_state(current_state.process(delta))
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
change_state(current_state.process(delta))
|
||||
|
||||
func _unhandled_input(event) -> void:
|
||||
change_state(current_state.handle_input(event))
|
||||
|
||||
func initialize(player: Player) -> void:
|
||||
states = []
|
||||
for child in get_children():
|
||||
if child is State:
|
||||
states.append(child)
|
||||
if states.is_empty():
|
||||
return
|
||||
|
||||
var firstState = states[0]
|
||||
firstState.player = player
|
||||
firstState.state_machine = self
|
||||
|
||||
for state in states:
|
||||
state.init()
|
||||
|
||||
change_state(firstState)
|
||||
process_mode = Node.PROCESS_MODE_INHERIT
|
||||
|
||||
func change_state(new_state: State) -> void:
|
||||
if new_state == null or new_state == current_state:
|
||||
return
|
||||
|
||||
if current_state:
|
||||
current_state.exit()
|
||||
|
||||
previous_state = current_state
|
||||
current_state = new_state
|
||||
current_state.enter()
|
||||
1
player/scripts/player_state_machine.gd.uid
Normal file
1
player/scripts/player_state_machine.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cbmwqg1xr14sg
|
||||
13
player/scripts/push_area.gd
Normal file
13
player/scripts/push_area.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Area2D
|
||||
|
||||
func _ready() -> void:
|
||||
body_entered.connect(on_body_entered)
|
||||
body_exited.connect(on_body_exited)
|
||||
|
||||
func on_body_entered(body: Node2D) -> void:
|
||||
if body is PushableStatute:
|
||||
body.push_direction = PlayerManager.player.direction
|
||||
|
||||
func on_body_exited(body: Node2D) -> void:
|
||||
if body is PushableStatute:
|
||||
body.push_direction = Vector2.ZERO
|
||||
1
player/scripts/push_area.gd.uid
Normal file
1
player/scripts/push_area.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cyff8l2rrvtl
|
||||
25
player/scripts/state.gd
Normal file
25
player/scripts/state.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
class_name State extends Node
|
||||
|
||||
static var player : Player
|
||||
static var state_machine: PlayerStateMachine
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func init() -> void:
|
||||
pass
|
||||
|
||||
func enter() -> void:
|
||||
pass
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func process(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func physics(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(_event : InputEvent) -> State:
|
||||
return null
|
||||
1
player/scripts/state.gd.uid
Normal file
1
player/scripts/state.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cmcwtkqxxkhik
|
||||
44
player/scripts/state_attack.gd
Normal file
44
player/scripts/state_attack.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
class_name State_Attack extends State
|
||||
|
||||
@onready var walk: State = $"../walk"
|
||||
@onready var idle: State = $"../idle"
|
||||
@onready var animation_player: AnimationPlayer = $"../../AnimationPlayer"
|
||||
@onready var attack_animation_player: AnimationPlayer = $"../../Sprite2D/attack_effect/AnimationPlayer"
|
||||
@onready var audio_player: AudioStreamPlayer2D = $"../../audio/audio"
|
||||
@onready var hurtbox: Hurtbox = %attack_hurtbox
|
||||
@export var attack_sound: AudioStream
|
||||
@export_range(1, 20, 0.5) var decelerate_speed: float = 5.0
|
||||
var attacking: bool = false
|
||||
|
||||
func enter() -> void:
|
||||
animation_player.animation_finished.connect(end_attack)
|
||||
player.update_animation("attack")
|
||||
attack_animation_player.play("attack_" + player.anim_direction())
|
||||
audio_player.stream = attack_sound
|
||||
audio_player.pitch_scale = randf_range(0.9, 1.1)
|
||||
audio_player.play()
|
||||
attacking = true
|
||||
|
||||
await get_tree().create_timer(0.075).timeout
|
||||
if attacking:
|
||||
hurtbox.monitoring = true
|
||||
|
||||
func exit() -> void:
|
||||
animation_player.animation_finished.disconnect(end_attack)
|
||||
attacking = false
|
||||
hurtbox.monitoring = false
|
||||
|
||||
func process(delta : float) -> State:
|
||||
player.velocity -= player.velocity * decelerate_speed * delta
|
||||
if attacking:
|
||||
return null
|
||||
return idle if player.direction == Vector2.ZERO else walk
|
||||
|
||||
func physics(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(_event : InputEvent) -> State:
|
||||
return null
|
||||
|
||||
func end_attack(_new_animation_name: String) -> void:
|
||||
attacking = false
|
||||
1
player/scripts/state_attack.gd.uid
Normal file
1
player/scripts/state_attack.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://rkjhx7gfma1e
|
||||
26
player/scripts/state_idle.gd
Normal file
26
player/scripts/state_idle.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
class_name State_Idle extends State
|
||||
|
||||
@onready var walk: State = $"../walk"
|
||||
@onready var attack: State = $"../attack"
|
||||
|
||||
func enter() -> void:
|
||||
player.update_animation("idle")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func process(_delta : float) -> State:
|
||||
if player.direction != Vector2.ZERO:
|
||||
return walk
|
||||
player.velocity = Vector2.ZERO
|
||||
return null
|
||||
|
||||
func physics(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(event : InputEvent) -> State:
|
||||
if event.is_action_pressed("attack"):
|
||||
return attack
|
||||
if event.is_action_pressed("interact"):
|
||||
PlayerManager.interact_pressed.emit()
|
||||
return null
|
||||
1
player/scripts/state_idle.gd.uid
Normal file
1
player/scripts/state_idle.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cabtgwm5i08oe
|
||||
46
player/scripts/state_stun.gd
Normal file
46
player/scripts/state_stun.gd
Normal file
@@ -0,0 +1,46 @@
|
||||
class_name StateStun extends State
|
||||
|
||||
@export var knockback_speed: float = 200.0
|
||||
@export var decelerate_speed: float = 10.0
|
||||
@export var invulnerable_duration: float = 1.0
|
||||
|
||||
@onready var idle: State = $"../idle"
|
||||
|
||||
var hurtbox: Hurtbox
|
||||
var direction: Vector2
|
||||
|
||||
var next_state: State
|
||||
|
||||
|
||||
func init() -> void:
|
||||
player.player_damaged.connect(on_damaged)
|
||||
|
||||
func enter() -> void:
|
||||
player.animation_player.animation_finished.connect(on_animation_finished)
|
||||
direction = player.global_position.direction_to(hurtbox.global_position)
|
||||
player.velocity = direction * -knockback_speed
|
||||
player.set_direction()
|
||||
player.update_animation("stun")
|
||||
player.make_invulnerable(invulnerable_duration)
|
||||
player.effect_animation.play("damaged")
|
||||
|
||||
func exit() -> void:
|
||||
player.animation_player.animation_finished.disconnect(on_animation_finished)
|
||||
next_state = null
|
||||
|
||||
func process(delta: float) -> State:
|
||||
player.velocity -= player.velocity * decelerate_speed * delta
|
||||
return next_state
|
||||
|
||||
func physics(_delta: float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(_event: InputEvent) -> State:
|
||||
return null
|
||||
|
||||
func on_damaged(incomig_hurtbox: Hurtbox) -> void:
|
||||
hurtbox = incomig_hurtbox
|
||||
state_machine.change_state(self)
|
||||
|
||||
func on_animation_finished(_name: String) -> void:
|
||||
next_state = idle
|
||||
1
player/scripts/state_stun.gd.uid
Normal file
1
player/scripts/state_stun.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://pr4o7w6faw08
|
||||
31
player/scripts/state_walk.gd
Normal file
31
player/scripts/state_walk.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
class_name State_Walk extends State
|
||||
|
||||
@export var move_speed: float = 100.0
|
||||
@onready var idle: State = $"../idle"
|
||||
@onready var attack: State = $"../attack"
|
||||
|
||||
func enter() -> void:
|
||||
player.update_animation("walk")
|
||||
|
||||
func exit() -> void:
|
||||
pass
|
||||
|
||||
func process(_delta : float) -> State:
|
||||
if player.direction == Vector2.ZERO:
|
||||
return idle
|
||||
|
||||
player.velocity = player.direction * move_speed
|
||||
|
||||
if player.set_direction():
|
||||
player.update_animation("walk")
|
||||
return null
|
||||
|
||||
func physics(_delta : float) -> State:
|
||||
return null
|
||||
|
||||
func handle_input(event : InputEvent) -> State:
|
||||
if event.is_action_pressed("attack"):
|
||||
return attack
|
||||
if event.is_action_pressed("interact"):
|
||||
PlayerManager.interact_pressed.emit()
|
||||
return null
|
||||
1
player/scripts/state_walk.gd.uid
Normal file
1
player/scripts/state_walk.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c6p40pfivsfxo
|
||||
BIN
player/sprites/AttackSprite01.png
Normal file
BIN
player/sprites/AttackSprite01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
40
player/sprites/AttackSprite01.png.import
Normal file
40
player/sprites/AttackSprite01.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b0hgmxuickvw8"
|
||||
path="res://.godot/imported/AttackSprite01.png-0575abc50558d56ec8c30b16d172511d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/sprites/AttackSprite01.png"
|
||||
dest_files=["res://.godot/imported/AttackSprite01.png-0575abc50558d56ec8c30b16d172511d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
player/sprites/ExamplePlayerSprite.png
Normal file
BIN
player/sprites/ExamplePlayerSprite.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
40
player/sprites/ExamplePlayerSprite.png.import
Normal file
40
player/sprites/ExamplePlayerSprite.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8c6f4i0v4lfb"
|
||||
path="res://.godot/imported/ExamplePlayerSprite.png-4bba829ddabbc6d45d21ad0746f328de.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/sprites/ExamplePlayerSprite.png"
|
||||
dest_files=["res://.godot/imported/ExamplePlayerSprite.png-4bba829ddabbc6d45d21ad0746f328de.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
player/sprites/PlayerSprite02.png
Normal file
BIN
player/sprites/PlayerSprite02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
40
player/sprites/PlayerSprite02.png.import
Normal file
40
player/sprites/PlayerSprite02.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cge4rwsf016ej"
|
||||
path="res://.godot/imported/PlayerSprite02.png-52d1913b1a17d0976781a54b22f3d6e0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/sprites/PlayerSprite02.png"
|
||||
dest_files=["res://.godot/imported/PlayerSprite02.png-52d1913b1a17d0976781a54b22f3d6e0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
player/sprites/Shadow.png
Normal file
BIN
player/sprites/Shadow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 281 B |
40
player/sprites/Shadow.png.import
Normal file
40
player/sprites/Shadow.png.import
Normal file
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bxqdnnk4dqnu5"
|
||||
path="res://.godot/imported/Shadow.png-feabb5c232372dba2ec097eeef7da2e3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://player/sprites/Shadow.png"
|
||||
dest_files=["res://.godot/imported/Shadow.png-feabb5c232372dba2ec097eeef7da2e3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Reference in New Issue
Block a user