4.3 Animated Sprites
This commit is contained in:
parent
295e5c12cd
commit
8f286384b7
3 changed files with 226 additions and 0 deletions
6
scenes/level.tscn
Normal file
6
scenes/level.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cchf5vmjp6ahj"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/level.gd" id="1_84g5v"]
|
||||
|
||||
[node name="Level" type="Node2D"]
|
||||
script = ExtResource("1_84g5v")
|
||||
211
scenes/player.tscn
Normal file
211
scenes/player.tscn
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
[gd_scene load_steps=30 format=3 uid="uid://c7y3ileam1twx"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://g6dy0j2lbcso" path="res://assets/textures/player/Fall (32x32).png" id="1_ujg18"]
|
||||
[ext_resource type="Texture2D" uid="uid://bckhu0vpmij88" path="res://assets/textures/player/Idle (32x32).png" id="2_enuvh"]
|
||||
[ext_resource type="Texture2D" uid="uid://dehumidunwvt6" path="res://assets/textures/player/Jump (32x32).png" id="3_7ohnv"]
|
||||
[ext_resource type="Texture2D" uid="uid://cegxtc4pnrag" path="res://assets/textures/player/Run (32x32).png" id="4_6bkcf"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_04k4r"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_m06cu"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_txnbe"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2ea77"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(96, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_iw7nd"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(128, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_4uehh"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(160, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jkjyw"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(192, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0osv1"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(224, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cb23a"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(256, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_d0kkv"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(288, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3vyoj"]
|
||||
atlas = ExtResource("2_enuvh")
|
||||
region = Rect2(320, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_btd0u"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2kgjh"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_n0tjn"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ht65b"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(96, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_f76re"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(128, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hx43e"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(160, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7l8y8"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(192, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_hrp1e"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(224, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2js5k"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(256, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6dqs8"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(288, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_p8d6d"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(320, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_32qs7"]
|
||||
atlas = ExtResource("4_6bkcf")
|
||||
region = Rect2(352, 0, 32, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_ncycm"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("1_ujg18")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"fall",
|
||||
"speed": 20.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_04k4r")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_m06cu")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_txnbe")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2ea77")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_iw7nd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_4uehh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jkjyw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0osv1")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cb23a")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_d0kkv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3vyoj")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 20.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_7ohnv")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"jump",
|
||||
"speed": 20.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_btd0u")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2kgjh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_n0tjn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ht65b")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_f76re")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hx43e")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_7l8y8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_hrp1e")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_2js5k")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6dqs8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_p8d6d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_32qs7")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"run",
|
||||
"speed": 20.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ereyp"]
|
||||
size = Vector2(14, 20)
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(0, -16)
|
||||
sprite_frames = SubResource("SpriteFrames_ncycm")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -10)
|
||||
shape = SubResource("RectangleShape2D_ereyp")
|
||||
9
scripts/level.gd
Normal file
9
scripts/level.gd
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("quit"):
|
||||
get_tree().quit()
|
||||
elif Input.is_action_just_pressed("reset"):
|
||||
get_tree().reload_current_scene()
|
||||
Loading…
Reference in a new issue