SupaLidlGame/Characters/Player.tscn

281 lines
8.2 KiB
Plaintext

[gd_scene load_steps=28 format=3 uid="uid://b2254pup8k161"]
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"]
[ext_resource type="Texture2D" uid="uid://dxymfduyrbuvx" path="res://Assets/Sprites/Characters/forsen.png" id="3_ig4hs"]
[ext_resource type="Script" path="res://Characters/States/Machine.cs" id="3_npkjp"]
[ext_resource type="Script" path="res://Characters/States/PlayerIdleState.cs" id="4_4k4mb"]
[ext_resource type="PackedScene" uid="uid://cl56eadpklnbo" path="res://Utils/PlayerCamera.tscn" id="4_ym125"]
[ext_resource type="Script" path="res://Characters/States/PlayerMoveState.cs" id="5_tx5rw"]
[ext_resource type="Script" path="res://Characters/States/PlayerRollState.cs" id="6_6bgrj"]
[ext_resource type="Script" path="res://Items/Inventory.cs" id="7_xyenu"]
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="9_avyu4"]
[ext_resource type="AudioStream" uid="uid://njun3e6v4854" path="res://Assets/Sounds/hurt.wav" id="12_h0x0g"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h78y7"]
shader = ExtResource("2_ngsgt")
shader_parameter/color = Quaternion(1, 1, 1, 1)
shader_parameter/intensity = 0.0
[sub_resource type="AtlasTexture" id="AtlasTexture_us1ce"]
atlas = ExtResource("3_ig4hs")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_hn4kf"]
atlas = ExtResource("3_ig4hs")
region = Rect2(24, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_wfbeq"]
atlas = ExtResource("3_ig4hs")
region = Rect2(48, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_qlmwk"]
atlas = ExtResource("3_ig4hs")
region = Rect2(72, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_l1vgu"]
atlas = ExtResource("3_ig4hs")
region = Rect2(96, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_ytlaa"]
atlas = ExtResource("3_ig4hs")
region = Rect2(120, 0, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_1q30d"]
atlas = ExtResource("3_ig4hs")
region = Rect2(144, 0, 24, 24)
[sub_resource type="SpriteFrames" id="SpriteFrames_2h7cf"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_us1ce")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hn4kf")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_wfbeq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qlmwk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l1vgu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ytlaa")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1q30d")
}],
"loop": true,
"name": &"move",
"speed": 12.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bfqew"]
size = Vector2(16, 8)
[sub_resource type="LabelSettings" id="LabelSettings_q5h1n"]
font_size = 24
[sub_resource type="CSharpScript" id="CSharpScript_rcje3"]
script/source = "using Godot;
using SupaLidlGame.Characters;
namespace SupaLidlGame.Items
{
public partial class ItemInfo : Resource
{
[Export]
public string ItemName { get; set; } = \"Item Name\";
[Export]
public string Description { get; set; } = \"Item description.\";
[Export]
public bool CanStack { get; set; } = false;
[Export]
public int Count { get; set; } = 1;
[Export]
public bool IsOneHanded { get; set; } = false;
[Export]
public Character CharacterOwner { get; set; } = null;
[Export]
public Texture2D Texture { get; set; }
[Export]
public string ScenePath { get; set; }
/// <summary>
/// Determines if this item can directly stack with other items
/// </summary>
public virtual bool StacksWith(ItemInfo itemInfo)
{
if (!CanStack)
{
return false;
}
if (ItemName != itemInfo.ItemName)
{
return false;
}
// several more conditions may be added soon
return true;
}
public Item InstantiateItem(string name = \"Primary\")
{
var scene = ResourceLoader.Load<PackedScene>(ScenePath);
var instance = scene.Instantiate<Item>();
instance.Name = name;
return instance;
}
}
}
"
[sub_resource type="RectangleShape2D" id="RectangleShape2D_cjk6b"]
size = Vector2(16, 24)
[sub_resource type="Animation" id="Animation_dxevc"]
resource_name = "Hurt"
length = 0.6
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6),
"transitions": PackedFloat32Array(4, 4, 4, 4, 4, 4, 4),
"update": 0,
"values": [0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0]
}
[sub_resource type="Animation" id="Animation_k6l16"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:material:shader_parameter/intensity")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_xe5eq"]
_data = {
"Hurt": SubResource("Animation_dxevc"),
"RESET": SubResource("Animation_k6l16")
}
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "Sprite", "Inventory", "StateMachine")]
y_sort_enabled = true
texture_filter = 3
material = SubResource("ShaderMaterial_h78y7")
position = Vector2(0, -12)
collision_layer = 6
script = ExtResource("1_flygr")
Camera = NodePath("Camera2D")
Speed = 64.0
Sprite = NodePath("Sprite")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
Faction = 1
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
position_smoothing_speed = 8.0
[node name="Sprite" type="AnimatedSprite2D" parent="."]
use_parent_material = true
sprite_frames = SubResource("SpriteFrames_2h7cf")
animation = &"idle"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 8)
shape = SubResource("RectangleShape2D_bfqew")
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
script = ExtResource("3_npkjp")
InitialState = NodePath("Idle")
Character = NodePath("..")
DebugLevel = 2
[node name="Idle" type="Node" parent="StateMachine" node_paths=PackedStringArray("MoveState", "IdleState")]
script = ExtResource("4_4k4mb")
MoveState = NodePath("../Move")
IdleState = NodePath(".")
[node name="Move" type="Node" parent="StateMachine" node_paths=PackedStringArray("RollState", "IdleState")]
script = ExtResource("5_tx5rw")
RollState = NodePath("../Roll")
IdleState = NodePath("../Idle")
[node name="Roll" type="Node" parent="StateMachine" node_paths=PackedStringArray("IdleState")]
script = ExtResource("6_6bgrj")
IdleState = NodePath("../Idle")
[node name="Debug" type="Control" parent="."]
visible = false
layout_mode = 3
anchors_preset = 0
[node name="State" type="Label" parent="Debug"]
layout_mode = 0
offset_left = -20.0
offset_top = -60.0
offset_right = 20.0
offset_bottom = -34.0
text = "lol"
label_settings = SubResource("LabelSettings_q5h1n")
horizontal_alignment = 1
[node name="Node" type="Node" parent="."]
[node name="Inventory" type="Node2D" parent="."]
y_sort_enabled = true
position = Vector2(0, 2)
script = ExtResource("7_xyenu")
Items = Array[Resource]([SubResource("CSharpScript_rcje3")])
[node name="Hurtbox" parent="." instance=ExtResource("9_avyu4")]
Faction = 1
[node name="CollisionShape2D" parent="Hurtbox" index="0"]
shape = SubResource("RectangleShape2D_cjk6b")
[node name="FlashAnimation" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_xe5eq")
}
[node name="HurtSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("12_h0x0g")
max_distance = 64.0
[node name="AudioListener2D" type="AudioListener2D" parent="."]
current = true
[connection signal="ReceivedDamage" from="Hurtbox" to="." method="_on_hurtbox_received_damage"]
[editable path="Hurtbox"]