Mathilde Grapin
7038d29d87
Add simple player movement with a finite state machine. Add enemy that can move to target point. Add ground through a tilemap and wall that player and enemy cannot cross.
218 lines
6 KiB
Plaintext
218 lines
6 KiB
Plaintext
[gd_scene load_steps=16 format=3 uid="uid://ba1t35yyot4jl"]
|
|
|
|
[ext_resource type="Texture2D" uid="uid://bqkvmyqo86dtj" path="res://art/Owlet_Monster_Walk_6.png" id="1_e23l4"]
|
|
[ext_resource type="Script" path="res://scripts/player.gd" id="1_fmx2p"]
|
|
[ext_resource type="Texture2D" uid="uid://cjxkidkeka7yp" path="res://art/Owlet_Monster_Run_6.png" id="2_qq5i7"]
|
|
[ext_resource type="Texture2D" uid="uid://bi7ceeuwhg5mp" path="res://art/Owlet_Monster_Idle_4.png" id="4_orj3a"]
|
|
[ext_resource type="Texture2D" uid="uid://dbrr63tv6i2ek" path="res://art/Owlet_Monster_Throw_4.png" id="5_2s1mg"]
|
|
[ext_resource type="Script" path="res://scripts/state_machine.gd" id="6_hl63m"]
|
|
[ext_resource type="Script" path="res://scripts/player_idle_state.gd" id="7_0nfrc"]
|
|
[ext_resource type="Script" path="res://scripts/player_walk_state.gd" id="7_gcd3q"]
|
|
|
|
[sub_resource type="Animation" id="Animation_rh7n7"]
|
|
length = 0.001
|
|
|
|
[sub_resource type="Animation" id="Animation_7igie"]
|
|
resource_name = "idle"
|
|
length = 0.4
|
|
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("4_orj3a")]
|
|
}
|
|
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="Animation" id="Animation_xfiuh"]
|
|
resource_name = "run"
|
|
length = 0.6
|
|
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("2_qq5i7")]
|
|
}
|
|
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": [6]
|
|
}
|
|
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),
|
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
|
"update": 1,
|
|
"values": [0, 1, 2, 3, 4, 5]
|
|
}
|
|
|
|
[sub_resource type="Animation" id="Animation_gswgu"]
|
|
resource_name = "throw"
|
|
length = 0.4
|
|
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("5_2s1mg")]
|
|
}
|
|
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="Animation" id="Animation_pjkea"]
|
|
resource_name = "walk"
|
|
length = 0.6
|
|
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_e23l4")]
|
|
}
|
|
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": [6]
|
|
}
|
|
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),
|
|
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
|
|
"update": 1,
|
|
"values": [0, 1, 2, 3, 4, 5]
|
|
}
|
|
|
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ldfyt"]
|
|
_data = {
|
|
"RESET": SubResource("Animation_rh7n7"),
|
|
"idle": SubResource("Animation_7igie"),
|
|
"run": SubResource("Animation_xfiuh"),
|
|
"throw": SubResource("Animation_gswgu"),
|
|
"walk": SubResource("Animation_pjkea")
|
|
}
|
|
|
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hocsq"]
|
|
size = Vector2(21, 7.5)
|
|
|
|
[node name="Player" type="CharacterBody2D"]
|
|
script = ExtResource("1_fmx2p")
|
|
|
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
|
position = Vector2(0, -16)
|
|
texture = ExtResource("4_orj3a")
|
|
hframes = 4
|
|
|
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
|
libraries = {
|
|
"": SubResource("AnimationLibrary_ldfyt")
|
|
}
|
|
|
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
|
y_sort_enabled = true
|
|
position = Vector2(-2.5, -3.75)
|
|
shape = SubResource("RectangleShape2D_hocsq")
|
|
|
|
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("state")]
|
|
script = ExtResource("6_hl63m")
|
|
state = NodePath("Idle")
|
|
|
|
[node name="Idle" type="Node" parent="StateMachine"]
|
|
script = ExtResource("7_0nfrc")
|
|
|
|
[node name="Walk" type="Node" parent="StateMachine"]
|
|
script = ExtResource("7_gcd3q")
|