/ youtube_game / scenes / player.tscn
player.tscn
  1  [gd_scene load_steps=35 format=3 uid="uid://byjr2swuirohs"]
  2  
  3  [ext_resource type="Texture2D" uid="uid://81do1n4rcjwd" path="res://assets/sprites/knight.png" id="1_3vyb7"]
  4  [ext_resource type="Script" uid="uid://bqnpk5ct4s5y" path="res://script/player.gd" id="1_g2els"]
  5  [ext_resource type="Script" uid="uid://bjp3nyb2whlos" path="res://script/animated_sprite_2d.gd" id="3_qhqgy"]
  6  
  7  [sub_resource type="AtlasTexture" id="AtlasTexture_g2els"]
  8  atlas = ExtResource("1_3vyb7")
  9  region = Rect2(0, 0, 32, 32)
 10  
 11  [sub_resource type="AtlasTexture" id="AtlasTexture_qhqgy"]
 12  atlas = ExtResource("1_3vyb7")
 13  region = Rect2(32, 0, 32, 32)
 14  
 15  [sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
 16  atlas = ExtResource("1_3vyb7")
 17  region = Rect2(64, 0, 32, 32)
 18  
 19  [sub_resource type="AtlasTexture" id="AtlasTexture_qlg0r"]
 20  atlas = ExtResource("1_3vyb7")
 21  region = Rect2(96, 0, 32, 32)
 22  
 23  [sub_resource type="AtlasTexture" id="AtlasTexture_tuyoq"]
 24  atlas = ExtResource("1_3vyb7")
 25  region = Rect2(224, 64, 32, 32)
 26  
 27  [sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
 28  atlas = ExtResource("1_3vyb7")
 29  region = Rect2(0, 160, 32, 32)
 30  
 31  [sub_resource type="AtlasTexture" id="AtlasTexture_l71n6"]
 32  atlas = ExtResource("1_3vyb7")
 33  region = Rect2(32, 160, 32, 32)
 34  
 35  [sub_resource type="AtlasTexture" id="AtlasTexture_ke2ow"]
 36  atlas = ExtResource("1_3vyb7")
 37  region = Rect2(64, 160, 32, 32)
 38  
 39  [sub_resource type="AtlasTexture" id="AtlasTexture_ujl30"]
 40  atlas = ExtResource("1_3vyb7")
 41  region = Rect2(96, 160, 32, 32)
 42  
 43  [sub_resource type="AtlasTexture" id="AtlasTexture_31cv2"]
 44  atlas = ExtResource("1_3vyb7")
 45  region = Rect2(128, 160, 32, 32)
 46  
 47  [sub_resource type="AtlasTexture" id="AtlasTexture_pf23h"]
 48  atlas = ExtResource("1_3vyb7")
 49  region = Rect2(160, 160, 32, 32)
 50  
 51  [sub_resource type="AtlasTexture" id="AtlasTexture_dt7fs"]
 52  atlas = ExtResource("1_3vyb7")
 53  region = Rect2(192, 160, 32, 32)
 54  
 55  [sub_resource type="AtlasTexture" id="AtlasTexture_wqfne"]
 56  atlas = ExtResource("1_3vyb7")
 57  region = Rect2(224, 160, 32, 32)
 58  
 59  [sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
 60  atlas = ExtResource("1_3vyb7")
 61  region = Rect2(0, 64, 32, 32)
 62  
 63  [sub_resource type="AtlasTexture" id="AtlasTexture_smehm"]
 64  atlas = ExtResource("1_3vyb7")
 65  region = Rect2(32, 64, 32, 32)
 66  
 67  [sub_resource type="AtlasTexture" id="AtlasTexture_ur7pv"]
 68  atlas = ExtResource("1_3vyb7")
 69  region = Rect2(64, 64, 32, 32)
 70  
 71  [sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
 72  atlas = ExtResource("1_3vyb7")
 73  region = Rect2(96, 64, 32, 32)
 74  
 75  [sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
 76  atlas = ExtResource("1_3vyb7")
 77  region = Rect2(128, 64, 32, 32)
 78  
 79  [sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
 80  atlas = ExtResource("1_3vyb7")
 81  region = Rect2(160, 64, 32, 32)
 82  
 83  [sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
 84  atlas = ExtResource("1_3vyb7")
 85  region = Rect2(192, 64, 32, 32)
 86  
 87  [sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
 88  atlas = ExtResource("1_3vyb7")
 89  region = Rect2(224, 64, 32, 32)
 90  
 91  [sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
 92  atlas = ExtResource("1_3vyb7")
 93  region = Rect2(0, 96, 32, 32)
 94  
 95  [sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
 96  atlas = ExtResource("1_3vyb7")
 97  region = Rect2(32, 96, 32, 32)
 98  
 99  [sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
100  atlas = ExtResource("1_3vyb7")
101  region = Rect2(64, 96, 32, 32)
102  
103  [sub_resource type="AtlasTexture" id="AtlasTexture_fulsm"]
104  atlas = ExtResource("1_3vyb7")
105  region = Rect2(96, 96, 32, 32)
106  
107  [sub_resource type="AtlasTexture" id="AtlasTexture_4r5pv"]
108  atlas = ExtResource("1_3vyb7")
109  region = Rect2(128, 96, 32, 32)
110  
111  [sub_resource type="AtlasTexture" id="AtlasTexture_60mlk"]
112  atlas = ExtResource("1_3vyb7")
113  region = Rect2(160, 96, 32, 32)
114  
115  [sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
116  atlas = ExtResource("1_3vyb7")
117  region = Rect2(192, 96, 32, 32)
118  
119  [sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
120  atlas = ExtResource("1_3vyb7")
121  region = Rect2(224, 96, 32, 32)
122  
123  [sub_resource type="SpriteFrames" id="SpriteFrames_tuyoq"]
124  animations = [{
125  "frames": [{
126  "duration": 1.0,
127  "texture": SubResource("AtlasTexture_g2els")
128  }, {
129  "duration": 1.0,
130  "texture": SubResource("AtlasTexture_qhqgy")
131  }, {
132  "duration": 1.0,
133  "texture": SubResource("AtlasTexture_dqkch")
134  }, {
135  "duration": 1.0,
136  "texture": SubResource("AtlasTexture_qlg0r")
137  }],
138  "loop": true,
139  "name": &"idle",
140  "speed": 10.0
141  }, {
142  "frames": [{
143  "duration": 1.0,
144  "texture": SubResource("AtlasTexture_tuyoq")
145  }],
146  "loop": true,
147  "name": &"jump",
148  "speed": 20.0
149  }, {
150  "frames": [{
151  "duration": 1.0,
152  "texture": SubResource("AtlasTexture_4ni07")
153  }, {
154  "duration": 1.0,
155  "texture": SubResource("AtlasTexture_l71n6")
156  }, {
157  "duration": 1.0,
158  "texture": SubResource("AtlasTexture_ke2ow")
159  }, {
160  "duration": 1.0,
161  "texture": SubResource("AtlasTexture_ujl30")
162  }, {
163  "duration": 1.0,
164  "texture": SubResource("AtlasTexture_31cv2")
165  }, {
166  "duration": 1.0,
167  "texture": SubResource("AtlasTexture_pf23h")
168  }, {
169  "duration": 1.0,
170  "texture": SubResource("AtlasTexture_dt7fs")
171  }, {
172  "duration": 1.0,
173  "texture": SubResource("AtlasTexture_wqfne")
174  }],
175  "loop": false,
176  "name": &"rolle",
177  "speed": 5.0
178  }, {
179  "frames": [{
180  "duration": 1.0,
181  "texture": SubResource("AtlasTexture_fjrip")
182  }, {
183  "duration": 1.0,
184  "texture": SubResource("AtlasTexture_smehm")
185  }, {
186  "duration": 1.0,
187  "texture": SubResource("AtlasTexture_ur7pv")
188  }, {
189  "duration": 1.0,
190  "texture": SubResource("AtlasTexture_y4r1p")
191  }, {
192  "duration": 1.0,
193  "texture": SubResource("AtlasTexture_d2wvv")
194  }, {
195  "duration": 1.0,
196  "texture": SubResource("AtlasTexture_3v2ag")
197  }, {
198  "duration": 1.0,
199  "texture": SubResource("AtlasTexture_jej6c")
200  }, {
201  "duration": 1.0,
202  "texture": SubResource("AtlasTexture_f1ej7")
203  }, {
204  "duration": 1.0,
205  "texture": SubResource("AtlasTexture_oprun")
206  }, {
207  "duration": 1.0,
208  "texture": SubResource("AtlasTexture_a8ls1")
209  }, {
210  "duration": 1.0,
211  "texture": SubResource("AtlasTexture_qfm1y")
212  }, {
213  "duration": 1.0,
214  "texture": SubResource("AtlasTexture_fulsm")
215  }, {
216  "duration": 1.0,
217  "texture": SubResource("AtlasTexture_4r5pv")
218  }, {
219  "duration": 1.0,
220  "texture": SubResource("AtlasTexture_60mlk")
221  }, {
222  "duration": 1.0,
223  "texture": SubResource("AtlasTexture_i4ail")
224  }, {
225  "duration": 1.0,
226  "texture": SubResource("AtlasTexture_a38lo")
227  }],
228  "loop": true,
229  "name": &"run",
230  "speed": 10.0
231  }]
232  
233  [sub_resource type="CircleShape2D" id="CircleShape2D_fjrip"]
234  radius = 4.0
235  
236  [node name="Player" type="CharacterBody2D"]
237  z_index = 5
238  collision_layer = 2
239  script = ExtResource("1_g2els")
240  
241  [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
242  sprite_frames = SubResource("SpriteFrames_tuyoq")
243  animation = &"rolle"
244  autoplay = "idle"
245  speed_scale = 0.5
246  script = ExtResource("3_qhqgy")
247  
248  [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
249  position = Vector2(0, 7)
250  shape = SubResource("CircleShape2D_fjrip")
251  
252  [node name="Timer" type="Timer" parent="."]
253  
254  [connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]