From e7889a7a65b95d9e5de08a5569029b87aaff50a2 Mon Sep 17 00:00:00 2001 From: NaiJi Date: Sat, 13 Feb 2021 17:03:37 +0300 Subject: [PATCH] Init --- .gitignore | 2 + Ground.tscn | 67 +++++++++++++++++++++++++++++ Main.gd | 7 ++++ Main.tscn | 20 +++++++++ Mob.gd | 12 ++++++ Mob.tscn | 51 ++++++++++++++++++++++ Timer.gd | 4 ++ default_env.tres | 7 ++++ icon.png | Bin 0 -> 3305 bytes icon.png.import | 34 +++++++++++++++ player.gd | 94 +++++++++++++++++++++++++++++++++++++++++ project.godot | 24 +++++++++++ test-scene.gd | 15 +++++++ test-scene.tscn | 107 +++++++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 444 insertions(+) create mode 100644 .gitignore create mode 100644 Ground.tscn create mode 100644 Main.gd create mode 100644 Main.tscn create mode 100644 Mob.gd create mode 100644 Mob.tscn create mode 100644 Timer.gd create mode 100644 default_env.tres create mode 100644 icon.png create mode 100644 icon.png.import create mode 100644 player.gd create mode 100644 project.godot create mode 100644 test-scene.gd create mode 100644 test-scene.tscn diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0546ec3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.import/ +assets/ diff --git a/Ground.tscn b/Ground.tscn new file mode 100644 index 0000000..3527b54 --- /dev/null +++ b/Ground.tscn @@ -0,0 +1,67 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/art/ground-sheet.png" type="Texture" id=1] + +[sub_resource type="TileSet" id=1] +0/name = "ground-sheet.png 0" +0/texture = ExtResource( 1 ) +0/tex_offset = Vector2( 0, 0 ) +0/modulate = Color( 1, 1, 1, 1 ) +0/region = Rect2( 0, 0, 64, 64 ) +0/tile_mode = 0 +0/occluder_offset = Vector2( 0, 0 ) +0/navigation_offset = Vector2( 0, 0 ) +0/shape_offset = Vector2( 0, 0 ) +0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +0/shape_one_way = false +0/shape_one_way_margin = 0.0 +0/shapes = [ ] +0/z_index = 0 +1/name = "ground-sheet.png 1" +1/texture = ExtResource( 1 ) +1/tex_offset = Vector2( 0, 0 ) +1/modulate = Color( 1, 1, 1, 1 ) +1/region = Rect2( 0, 64, 64, 64 ) +1/tile_mode = 0 +1/occluder_offset = Vector2( 0, 0 ) +1/navigation_offset = Vector2( 0, 0 ) +1/shape_offset = Vector2( 0, 0 ) +1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +1/shape_one_way = false +1/shape_one_way_margin = 0.0 +1/shapes = [ ] +1/z_index = 0 +2/name = "ground-sheet.png 2" +2/texture = ExtResource( 1 ) +2/tex_offset = Vector2( 0, 0 ) +2/modulate = Color( 1, 1, 1, 1 ) +2/region = Rect2( 64, 64, 64, 64 ) +2/tile_mode = 0 +2/occluder_offset = Vector2( 0, 0 ) +2/navigation_offset = Vector2( 0, 0 ) +2/shape_offset = Vector2( 0, 0 ) +2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +2/shape_one_way = false +2/shape_one_way_margin = 0.0 +2/shapes = [ ] +2/z_index = 0 +3/name = "ground-sheet.png 3" +3/texture = ExtResource( 1 ) +3/tex_offset = Vector2( 0, 0 ) +3/modulate = Color( 1, 1, 1, 1 ) +3/region = Rect2( 64, 0, 64, 64 ) +3/tile_mode = 0 +3/occluder_offset = Vector2( 0, 0 ) +3/navigation_offset = Vector2( 0, 0 ) +3/shape_offset = Vector2( 0, 0 ) +3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) +3/shape_one_way = false +3/shape_one_way_margin = 0.0 +3/shapes = [ ] +3/z_index = 0 + +[node name="TileMap" type="TileMap"] +show_behind_parent = true +tile_set = SubResource( 1 ) +format = 1 +tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 2, 0, 3, 2, 0, 4, 2, 0, 5, 2, 0, 6, 2, 0, 7, 2, 0, 8, 2, 0, 9, 2, 0, 10, 2, 0, 11, 2, 0, 12, 3, 0, 13, 3, 0, 14, 2, 0, 15, 2, 0, 65536, 2, 0, 65537, 2, 0, 65538, 0, 0, 65539, 1, 0, 65540, 1, 0, 65541, 1, 0, 65542, 2, 0, 65543, 2, 0, 65544, 2, 0, 65545, 2, 0, 65546, 2, 0, 65547, 2, 0, 65548, 3, 0, 65549, 3, 0, 65550, 3, 0, 65551, 2, 0, 131072, 3, 0, 131073, 3, 0, 131074, 1, 0, 131075, 1, 0, 131076, 1, 0, 131077, 2, 0, 131078, 2, 0, 131079, 2, 0, 131080, 2, 0, 131081, 2, 0, 131082, 2, 0, 131083, 0, 0, 131084, 0, 0, 131085, 3, 0, 131086, 3, 0, 131087, 3, 0, 196608, 3, 0, 196609, 2, 0, 196610, 3, 0, 196611, 3, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 3, 0, 196618, 0, 0, 196619, 0, 0, 196620, 1, 0, 196621, 1, 0, 196622, 2, 0, 196623, 2, 0, 262144, 2, 0, 262145, 2, 0, 262146, 3, 0, 262147, 3, 0, 262148, 3, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 0, 0, 262153, 0, 0, 262154, 3, 0, 262155, 3, 0, 262156, 3, 0, 262157, 1, 0, 262158, 2, 0, 262159, 2, 0, 327680, 2, 0, 327681, 3, 0, 327682, 2, 0, 327683, 2, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 3, 0, 327689, 0, 0, 327690, 2, 0, 327691, 3, 0, 327692, 3, 0, 327693, 3, 0, 327694, 2, 0, 327695, 2, 0, 393216, 2, 0, 393217, 2, 0, 393218, 2, 0, 393219, 2, 0, 393220, 2, 0, 393221, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 393225, 0, 0, 393226, 3, 0, 393227, 3, 0, 393228, 3, 0, 393229, 3, 0, 393230, 1, 0, 393231, 2, 0, 458752, 2, 0, 458753, 2, 0, 458754, 2, 0, 458755, 3, 0, 458756, 3, 0, 458757, 3, 0, 458758, 3, 0, 458759, 3, 0, 458760, 3, 0, 458761, 2, 0, 458762, 2, 0, 458763, 2, 0, 458764, 2, 0, 458765, 2, 0, 458766, 2, 0, 458767, 2, 0, 524288, 2, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 2, 0, 524293, 2, 0, 524294, 2, 0, 524295, 2, 0, 524296, 2, 0, 524297, 0, 0, 524298, 0, 0, 524299, 2, 0, 524300, 2, 0, 524301, 2, 0, 524302, 2, 0, 524303, 2, 0, 589824, 2, 0, 589825, 0, 0, 589826, 2, 0, 589827, 2, 0, 589828, 2, 0, 589829, 2, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 2, 0, 589834, 2, 0, 589835, 2, 0, 589836, 2, 0, 589837, 2, 0, 589838, 2, 0, 589839, 2, 0, 655361, 0, 0, 655362, 0, 0, 655363, 0, 0, 655364, 0, 0, 655365, 0, 0 ) diff --git a/Main.gd b/Main.gd new file mode 100644 index 0000000..aa831c2 --- /dev/null +++ b/Main.gd @@ -0,0 +1,7 @@ +extends Node + +func _ready(): + newGame() + +func newGame(): + $Player.start($StartPosition.position) diff --git a/Main.tscn b/Main.tscn new file mode 100644 index 0000000..fbcbb3a --- /dev/null +++ b/Main.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://test-scene.tscn" type="PackedScene" id=1] +[ext_resource path="res://Main.gd" type="Script" id=2] +[ext_resource path="res://Ground.tscn" type="PackedScene" id=4] + +[node name="Main" type="Node"] +script = ExtResource( 2 ) + +[node name="TileMap" parent="." instance=ExtResource( 4 )] +collision_layer = 2 +collision_mask = 0 + +[node name="Player" parent="." instance=ExtResource( 1 )] +position = Vector2( 65.481, 38.7541 ) +scale = Vector2( 1.5, 1.5 ) +collision_mask = 0 + +[node name="StartPosition" type="Position2D" parent="."] +position = Vector2( 240, 450 ) diff --git a/Mob.gd b/Mob.gd new file mode 100644 index 0000000..b91e3d2 --- /dev/null +++ b/Mob.gd @@ -0,0 +1,12 @@ +extends RigidBody2D + +export var min_speed = 150 # Minimum speed range. +export var max_speed = 250 # Maximum speed range. + +func _ready(): + var mob_types = $AnimatedSprite.frames.get_animation_names() + $AnimatedSprite.animation = mob_types[randi() % mob_types.size()] + +func _on_VisibilityNotifier2D_screen_exited(): + #queue_free() + pass diff --git a/Mob.tscn b/Mob.tscn new file mode 100644 index 0000000..7a09032 --- /dev/null +++ b/Mob.tscn @@ -0,0 +1,51 @@ +[gd_scene load_steps=10 format=2] + +[ext_resource path="res://dodge_assets/art/enemySwimming_1.png" type="Texture" id=1] +[ext_resource path="res://dodge_assets/art/enemyWalking_1.png" type="Texture" id=2] +[ext_resource path="res://dodge_assets/art/enemySwimming_2.png" type="Texture" id=3] +[ext_resource path="res://dodge_assets/art/enemyFlyingAlt_2.png" type="Texture" id=4] +[ext_resource path="res://dodge_assets/art/enemyFlyingAlt_1.png" type="Texture" id=5] +[ext_resource path="res://dodge_assets/art/enemyWalking_2.png" type="Texture" id=6] +[ext_resource path="res://Mob.gd" type="Script" id=7] + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ ExtResource( 5 ), ExtResource( 4 ) ], +"loop": true, +"name": "fly", +"speed": 5.0 +}, { +"frames": [ ExtResource( 2 ), ExtResource( 6 ) ], +"loop": true, +"name": "walk", +"speed": 3.0 +}, { +"frames": [ ExtResource( 1 ), ExtResource( 3 ) ], +"loop": true, +"name": "swim", +"speed": 5.0 +} ] + +[sub_resource type="CapsuleShape2D" id=2] +radius = 34.9916 +height = 29.2442 + +[node name="Mob" type="RigidBody2D"] +collision_mask = 0 +gravity_scale = 0.0 +script = ExtResource( 7 ) +__meta__ = { +"_edit_group_": true +} + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +scale = Vector2( 0.75, 0.75 ) +frames = SubResource( 1 ) +animation = "walk" +playing = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 2 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] diff --git a/Timer.gd b/Timer.gd new file mode 100644 index 0000000..56aaee5 --- /dev/null +++ b/Timer.gd @@ -0,0 +1,4 @@ +extends Timer + +func _ready(): + Timer.wait_time(2.0) diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c98fbb601c83c81ec8c22b1dba7d1d57c62b323c GIT binary patch literal 3305 zcmVNc=P)Px>qe(&U$es`gSqKCHF-lq>v1vga#%UF>TTrLR zW%{UNJKZi|Pj@Rc9GyPBD1CamMMf6SL~V^ag9~Vzut^L^0!Tv0LK0FTdnJ`x->EF(MZIP5kY*1-@^egP~7mH>({qi7{6 zQF;bN-XMq~+RzA8lI9AtJuz@PY*+{SP-Gbd@mZ(r*eE&`XO5!C>w#-pcmS28K^qzY zfTGCjor*I@ltgKb03nh#Fh$KpDL=o}gj-g4v6{}ZR1*mvXv?|gEA&Yr#r;Zw*d zUabIx8iHf+WoIO_c11Ba&!34XihSMF&C#YFDjU0)mmbXz3ex!D&t9UYp>;&R%(O(_ z*z^;&A84SWzKiQpqsdQ+Vs?rFS(f?R;c8xg_ft;Roec_~1KsVww}wzq5D}*5x6k|& zf~2A3@L4|ix|Q=L>rnmKE;B3UB=OMQxAK$Ce;LvDp?hwn-{Rn}Uo~U4IXTs4V%MQY zCWULcZFU0R%gbU;_Ef(A#76r1%|YWis0t`9$R{cyjFnsV(POrI)SGQi-l{mu{e?5R zepcp?AQ54D3g_mswd@RLn{z~;^Cl}>%j@}TWixL+audY``MmSV{-E(3R0Ws^U9%mk zmAond;N8k*{(f!}e^~d(i1Hq@jdv@XN2MLAl}3yaECf{nz5N3KM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9R*{<+L2hCsOJ~Lt6Q-rRub*8X{*4{)e}>%=_&DxOFeq1LRia4Yyj*Tyynw>F zxkKf(MiaG0*L|V-^Zhtvg-(-|F0&1rU8bqab*n5TT8~C860O$|6Rt%P1=1(EjIQZ% z;Y^PU2VC*~^2!sG?mbBPS0~0yd-+086)+rHjhfk6>CB$t`o%;=kdYF9NwiKkwbIpN z;_FlOuHQHHSZ&@fUuSI-S*t`DjsiIB z{=1M@JKVC$a8z{2;xCPfRb{~T>uo#5rL4L+z9n`rSUt3Tt nAZ`TZm+q1gPVN84&*%Ra7her>#-hHS00000NkvXXu0mjf|6N@O literal 0 HcmV?d00001 diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..f31cf08 --- /dev/null +++ b/player.gd @@ -0,0 +1,94 @@ +extends Area2D + +enum PlayerState { NORMAL, DASHING, STANDING }; +enum PlayerDirection { RIGHT, LEFT, DOWN, UP }; + +export var speed = 200 # How fast the player will move (pixels/sec). +var screen_size # Size of the game window. +var state = PlayerState.NORMAL; +var direction = PlayerDirection.RIGHT; +var last_process_velocity = Vector2() + +func start(pos): + position = pos + show() + +func _ready(): + screen_size = get_viewport_rect().size + +func processNormal(delta): + var velocity = Vector2() # The player's movement vector. + if Input.is_key_pressed(KEY_SHIFT): + state = PlayerState.DASHING + return + + if Input.is_action_pressed("ui_right"): + velocity.x += 1 + direction = PlayerDirection.RIGHT; + if Input.is_action_pressed("ui_left"): + velocity.x -= 1 + direction = PlayerDirection.LEFT; + if Input.is_action_pressed("ui_down"): + velocity.y += 1 + direction = PlayerDirection.DOWN; + if Input.is_action_pressed("ui_up"): + velocity.y -= 1 + direction = PlayerDirection.UP; + if velocity.length() > 0: + velocity = velocity.normalized() * speed + $AnimatedSprite.play() + + position += velocity * delta + position.x = clamp(position.x, 0, screen_size.x) + position.y = clamp(position.y, 0, screen_size.y) + + if velocity.x > 0 or velocity.y != 0: + $AnimatedSprite.animation = "forward" + direction = PlayerDirection.RIGHT; + elif velocity.x < 0: + $AnimatedSprite.animation = "backward" + direction = PlayerDirection.LEFT; + else: + $AnimatedSprite.animation = "idle" + + last_process_velocity = velocity + +func processDash(delta): + $AnimatedSprite.animation = "dash" + $AnimatedSprite.speed_scale = 2.5 + var velocity = last_process_velocity + velocity = velocity.normalized() * speed + if velocity.length() > 0: + velocity = velocity.normalized() * speed + $AnimatedSprite.play() + position += velocity * delta * 1.8 + position.x = clamp(position.x, 0, screen_size.x) + position.y = clamp(position.y, 0, screen_size.y) + $AnimatedSprite.flip_h = velocity.x < 0 + +func processStanding(delta): + $AnimatedSprite.animation = "standing up" + $AnimatedSprite.speed_scale = 1 + var velocity = Vector2(0.0, 0.0) + position += velocity.normalized() * delta + position.x = clamp(position.x, 0, screen_size.x) + position.y = clamp(position.y, 0, screen_size.y) + $AnimatedSprite.flip_h = last_process_velocity.x < 0 + +func _process(delta): + if state == PlayerState.NORMAL: + processNormal(delta) + elif state == PlayerState.DASHING: + processDash(delta) + else: + processStanding(delta) + + + +func _on_AnimatedSprite_animation_finished(): + if $AnimatedSprite.animation == "dash": # Replace with function body. + state = PlayerState.STANDING + $AnimatedSprite.speed_scale = 1 + elif $AnimatedSprite.animation == "standing up": + state = PlayerState.NORMAL + $AnimatedSprite.flip_h = false diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..28bf348 --- /dev/null +++ b/project.godot @@ -0,0 +1,24 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="core-game" +run/main_scene="res://Main.tscn" +config/icon="res://icon.png" + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/test-scene.gd b/test-scene.gd new file mode 100644 index 0000000..3dff8b4 --- /dev/null +++ b/test-scene.gd @@ -0,0 +1,15 @@ +extends Control + +# Called when the node enters the scene tree for the first time. +func _ready(): + $Label.text = "Press me, senpai!" + + +func _on_Button_pressed(): + $Label.text = "HELLO!" + $Timer.stop() + $Timer.start() + + +func _on_Timer_timeout(): + $Label.text = "Press me, senpai!" diff --git a/test-scene.tscn b/test-scene.tscn new file mode 100644 index 0000000..1862005 --- /dev/null +++ b/test-scene.tscn @@ -0,0 +1,107 @@ +[gd_scene load_steps=25 format=2] + +[ext_resource path="res://assets/art/forward-sheet.png" type="Texture" id=1] +[ext_resource path="res://assets/art/backwards-sheet.png" type="Texture" id=2] +[ext_resource path="res://assets/art/idle-sheet.png" type="Texture" id=3] +[ext_resource path="res://assets/art/dash/dash-04.png" type="Texture" id=4] +[ext_resource path="res://player.gd" type="Script" id=5] +[ext_resource path="res://assets/art/dash/dash-02.png" type="Texture" id=6] +[ext_resource path="res://assets/art/dash/dash-06.png" type="Texture" id=7] +[ext_resource path="res://assets/art/dash/dash-09.png" type="Texture" id=8] +[ext_resource path="res://assets/art/dash/dash-01.png" type="Texture" id=9] +[ext_resource path="res://assets/art/dash/dash-05.png" type="Texture" id=10] +[ext_resource path="res://assets/art/dash/dash-07.png" type="Texture" id=11] +[ext_resource path="res://assets/art/dash/dash-03.png" type="Texture" id=12] +[ext_resource path="res://assets/art/dash/dash-08.png" type="Texture" id=13] + +[sub_resource type="AtlasTexture" id=9] +flags = 4 +atlas = ExtResource( 3 ) +region = Rect2( 0, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=10] +flags = 4 +atlas = ExtResource( 3 ) +region = Rect2( 45, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=11] +flags = 4 +atlas = ExtResource( 3 ) +region = Rect2( 90, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=12] +flags = 4 +atlas = ExtResource( 3 ) +region = Rect2( 135, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=13] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=14] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 45, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=15] +flags = 4 +atlas = ExtResource( 1 ) +region = Rect2( 90, 0, 45, 47 ) + +[sub_resource type="AtlasTexture" id=5] +flags = 4 +atlas = ExtResource( 2 ) +region = Rect2( 0, 0, 44, 47 ) + +[sub_resource type="AtlasTexture" id=6] +flags = 4 +atlas = ExtResource( 2 ) +region = Rect2( 44, 0, 44, 47 ) + +[sub_resource type="AtlasTexture" id=7] +flags = 4 +atlas = ExtResource( 2 ) +region = Rect2( 88, 0, 44, 47 ) + +[sub_resource type="SpriteFrames" id=8] +animations = [ { +"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": true, +"name": "idle", +"speed": 5.0 +}, { +"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ], +"loop": true, +"name": "forward", +"speed": 5.0 +}, { +"frames": [ ExtResource( 9 ), ExtResource( 6 ), ExtResource( 12 ), ExtResource( 4 ), ExtResource( 4 ), ExtResource( 10 ), ExtResource( 7 ), ExtResource( 7 ), ExtResource( 11 ) ], +"loop": true, +"name": "dash", +"speed": 5.0 +}, { +"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ], +"loop": true, +"name": "backward", +"speed": 5.0 +}, { +"frames": [ ExtResource( 13 ), ExtResource( 13 ), ExtResource( 8 ) ], +"loop": true, +"name": "standing up", +"speed": 5.0 +} ] + +[node name="Player" type="Area2D"] +script = ExtResource( 5 ) +__meta__ = { +"_edit_group_": true +} + +[node name="AnimatedSprite" type="AnimatedSprite" parent="."] +frames = SubResource( 8 ) +animation = "standing up" +frame = 1 +playing = true +[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"] +[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"]