game1: add player and tilemap

This commit is contained in:
Alice Gaudon 2020-08-17 17:27:28 +02:00
parent b2471a0592
commit ec7314eb91
9 changed files with 590 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/game1_animationRight.png-29e3e4828a3eddd264542fe8c76bb461.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://images/game1/game1_animationRight.png"
dest_files=[ "res://.import/game1_animationRight.png-29e3e4828a3eddd264542fe8c76bb461.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=false
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

View File

@ -0,0 +1,36 @@
[gd_resource type="SpriteFrames" load_steps=7 format=2]
[ext_resource path="res://images/game1/game1_animationRight.png" type="Texture" id=1]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 16 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 32, 0, 32, 16 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 64, 0, 32, 16 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 96, 0, 32, 16 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 1 )
region = Rect2( 128, 0, 32, 16 )
[resource]
animations = [ {
"frames": [ SubResource( 1 ) ],
"loop": false,
"name": "default",
"speed": 5.0
}, {
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": false,
"name": "moving",
"speed": 10.0
} ]

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/game1_tileset.png-6bff9e80c12445fcb52c690a5902efcf.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://images/game1/game1_tileset.png"
dest_files=[ "res://.import/game1_tileset.png-6bff9e80c12445fcb52c690a5902efcf.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=false
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

383
images/game1/tileset.tres Normal file
View File

@ -0,0 +1,383 @@
[gd_resource type="TileSet" load_steps=2 format=2]
[ext_resource path="res://images/game1/game1_tileset.png" type="Texture" id=1]
[resource]
2/name = "game1_tileset.png 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 48, 16, 48, 16 )
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 = "game1_tileset.png 3"
3/texture = ExtResource( 1 )
3/tex_offset = Vector2( 0, 0 )
3/modulate = Color( 1, 1, 1, 1 )
3/region = Rect2( 112, 16, 64, 32 )
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
4/name = "game1_tileset.png 4"
4/texture = ExtResource( 1 )
4/tex_offset = Vector2( 0, 0 )
4/modulate = Color( 1, 1, 1, 1 )
4/region = Rect2( 48, 32, 16, 16 )
4/tile_mode = 0
4/occluder_offset = Vector2( 0, 0 )
4/navigation_offset = Vector2( 0, 0 )
4/shape_offset = Vector2( 0, 0 )
4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
4/shape_one_way = false
4/shape_one_way_margin = 0.0
4/shapes = [ ]
4/z_index = 0
5/name = "game1_tileset.png 5"
5/texture = ExtResource( 1 )
5/tex_offset = Vector2( 0, 0 )
5/modulate = Color( 1, 1, 1, 1 )
5/region = Rect2( 64, 32, 16, 16 )
5/tile_mode = 0
5/occluder_offset = Vector2( 0, 0 )
5/navigation_offset = Vector2( 0, 0 )
5/shape_offset = Vector2( 0, 0 )
5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
5/shape_one_way = false
5/shape_one_way_margin = 0.0
5/shapes = [ ]
5/z_index = 0
6/name = "game1_tileset.png 6"
6/texture = ExtResource( 1 )
6/tex_offset = Vector2( 0, 0 )
6/modulate = Color( 1, 1, 1, 1 )
6/region = Rect2( 48, 48, 16, 32 )
6/tile_mode = 0
6/occluder_offset = Vector2( 0, 0 )
6/navigation_offset = Vector2( 0, 0 )
6/shape_offset = Vector2( 0, 0 )
6/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
6/shape_one_way = false
6/shape_one_way_margin = 0.0
6/shapes = [ ]
6/z_index = 0
7/name = "game1_tileset.png 7"
7/texture = ExtResource( 1 )
7/tex_offset = Vector2( 0, 0 )
7/modulate = Color( 1, 1, 1, 1 )
7/region = Rect2( 64, 48, 16, 16 )
7/tile_mode = 0
7/occluder_offset = Vector2( 0, 0 )
7/navigation_offset = Vector2( 0, 0 )
7/shape_offset = Vector2( 0, 0 )
7/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
7/shape_one_way = false
7/shape_one_way_margin = 0.0
7/shapes = [ ]
7/z_index = 0
8/name = "game1_tileset.png 8"
8/texture = ExtResource( 1 )
8/tex_offset = Vector2( 0, 0 )
8/modulate = Color( 1, 1, 1, 1 )
8/region = Rect2( 16, 48, 32, 16 )
8/tile_mode = 0
8/occluder_offset = Vector2( 0, 0 )
8/navigation_offset = Vector2( 0, 0 )
8/shape_offset = Vector2( 0, 0 )
8/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
8/shape_one_way = false
8/shape_one_way_margin = 0.0
8/shapes = [ ]
8/z_index = 0
9/name = "game1_tileset.png 9"
9/texture = ExtResource( 1 )
9/tex_offset = Vector2( 0, 0 )
9/modulate = Color( 1, 1, 1, 1 )
9/region = Rect2( 16, 64, 32, 16 )
9/tile_mode = 0
9/occluder_offset = Vector2( 0, 0 )
9/navigation_offset = Vector2( 0, 0 )
9/shape_offset = Vector2( 0, 0 )
9/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
9/shape_one_way = false
9/shape_one_way_margin = 0.0
9/shapes = [ ]
9/z_index = 0
10/name = "game1_tileset.png 10"
10/texture = ExtResource( 1 )
10/tex_offset = Vector2( 0, 0 )
10/modulate = Color( 1, 1, 1, 1 )
10/region = Rect2( 64, 64, 16, 16 )
10/tile_mode = 0
10/occluder_offset = Vector2( 0, 0 )
10/navigation_offset = Vector2( 0, 0 )
10/shape_offset = Vector2( 0, 0 )
10/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
10/shape_one_way = false
10/shape_one_way_margin = 0.0
10/shapes = [ ]
10/z_index = 0
11/name = "game1_tileset.png 11"
11/texture = ExtResource( 1 )
11/tex_offset = Vector2( 0, 0 )
11/modulate = Color( 1, 1, 1, 1 )
11/region = Rect2( 64, 80, 16, 16 )
11/tile_mode = 0
11/occluder_offset = Vector2( 0, 0 )
11/navigation_offset = Vector2( 0, 0 )
11/shape_offset = Vector2( 0, 0 )
11/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
11/shape_one_way = false
11/shape_one_way_margin = 0.0
11/shapes = [ ]
11/z_index = 0
12/name = "game1_tileset.png 12"
12/texture = ExtResource( 1 )
12/tex_offset = Vector2( 0, 0 )
12/modulate = Color( 1, 1, 1, 1 )
12/region = Rect2( 80, 64, 16, 16 )
12/tile_mode = 0
12/occluder_offset = Vector2( 0, 0 )
12/navigation_offset = Vector2( 0, 0 )
12/shape_offset = Vector2( 0, 0 )
12/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
12/shape_one_way = false
12/shape_one_way_margin = 0.0
12/shapes = [ ]
12/z_index = 0
13/name = "game1_tileset.png 13"
13/texture = ExtResource( 1 )
13/tex_offset = Vector2( 0, 0 )
13/modulate = Color( 1, 1, 1, 1 )
13/region = Rect2( 80, 80, 16, 16 )
13/tile_mode = 0
13/occluder_offset = Vector2( 0, 0 )
13/navigation_offset = Vector2( 0, 0 )
13/shape_offset = Vector2( 0, 0 )
13/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
13/shape_one_way = false
13/shape_one_way_margin = 0.0
13/shapes = [ ]
13/z_index = 0
14/name = "game1_tileset.png 14"
14/texture = ExtResource( 1 )
14/tex_offset = Vector2( 0, 0 )
14/modulate = Color( 1, 1, 1, 1 )
14/region = Rect2( 96, 80, 16, 16 )
14/tile_mode = 0
14/occluder_offset = Vector2( 0, 0 )
14/navigation_offset = Vector2( 0, 0 )
14/shape_offset = Vector2( 0, 0 )
14/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
14/shape_one_way = false
14/shape_one_way_margin = 0.0
14/shapes = [ ]
14/z_index = 0
15/name = "game1_tileset.png 15"
15/texture = ExtResource( 1 )
15/tex_offset = Vector2( 0, 0 )
15/modulate = Color( 1, 1, 1, 1 )
15/region = Rect2( 96, 64, 16, 16 )
15/tile_mode = 0
15/occluder_offset = Vector2( 0, 0 )
15/navigation_offset = Vector2( 0, 0 )
15/shape_offset = Vector2( 0, 0 )
15/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
15/shape_one_way = false
15/shape_one_way_margin = 0.0
15/shapes = [ ]
15/z_index = 0
17/name = "game1_tileset.png 17"
17/texture = ExtResource( 1 )
17/tex_offset = Vector2( 0, 0 )
17/modulate = Color( 1, 1, 1, 1 )
17/region = Rect2( 112, 48, 16, 16 )
17/tile_mode = 0
17/occluder_offset = Vector2( 0, 0 )
17/navigation_offset = Vector2( 0, 0 )
17/shape_offset = Vector2( 0, 0 )
17/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
17/shape_one_way = false
17/shape_one_way_margin = 0.0
17/shapes = [ ]
17/z_index = 0
18/name = "game1_tileset.png 18"
18/texture = ExtResource( 1 )
18/tex_offset = Vector2( 0, 0 )
18/modulate = Color( 1, 1, 1, 1 )
18/region = Rect2( 128, 48, 16, 16 )
18/tile_mode = 0
18/occluder_offset = Vector2( 0, 0 )
18/navigation_offset = Vector2( 0, 0 )
18/shape_offset = Vector2( 0, 0 )
18/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
18/shape_one_way = false
18/shape_one_way_margin = 0.0
18/shapes = [ ]
18/z_index = 0
19/name = "game1_tileset.png 19"
19/texture = ExtResource( 1 )
19/tex_offset = Vector2( 0, 0 )
19/modulate = Color( 1, 1, 1, 1 )
19/region = Rect2( 144, 48, 16, 16 )
19/tile_mode = 0
19/occluder_offset = Vector2( 0, 0 )
19/navigation_offset = Vector2( 0, 0 )
19/shape_offset = Vector2( 0, 0 )
19/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
19/shape_one_way = false
19/shape_one_way_margin = 0.0
19/shapes = [ ]
19/z_index = 0
20/name = "game1_tileset.png 20"
20/texture = ExtResource( 1 )
20/tex_offset = Vector2( 0, 0 )
20/modulate = Color( 1, 1, 1, 1 )
20/region = Rect2( 160, 48, 16, 16 )
20/tile_mode = 0
20/occluder_offset = Vector2( 0, 0 )
20/navigation_offset = Vector2( 0, 0 )
20/shape_offset = Vector2( 0, 0 )
20/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
20/shape_one_way = false
20/shape_one_way_margin = 0.0
20/shapes = [ ]
20/z_index = 0
29/name = "game1_tileset.png 29"
29/texture = ExtResource( 1 )
29/tex_offset = Vector2( 0, 0 )
29/modulate = Color( 1, 1, 1, 1 )
29/region = Rect2( 80, 32, 32, 32 )
29/tile_mode = 0
29/occluder_offset = Vector2( 0, 0 )
29/navigation_offset = Vector2( 0, 0 )
29/shape_offset = Vector2( 0, 0 )
29/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
29/shape_one_way = false
29/shape_one_way_margin = 0.0
29/shapes = [ ]
29/z_index = 0
30/name = "big_rock"
30/texture = ExtResource( 1 )
30/tex_offset = Vector2( 0, 0 )
30/modulate = Color( 1, 1, 1, 1 )
30/region = Rect2( 16, 16, 32, 32 )
30/tile_mode = 0
30/occluder_offset = Vector2( 0, 0 )
30/navigation_offset = Vector2( 0, 0 )
30/shape_offset = Vector2( 0, 0 )
30/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
30/shape_one_way = false
30/shape_one_way_margin = 0.0
30/shapes = [ ]
30/z_index = 0
39/name = "rocks_h_1"
39/texture = ExtResource( 1 )
39/tex_offset = Vector2( 0, 0 )
39/modulate = Color( 1, 1, 1, 1 )
39/region = Rect2( 16, 0, 48, 16 )
39/tile_mode = 0
39/occluder_offset = Vector2( 0, 0 )
39/navigation_offset = Vector2( 0, 0 )
39/shape_offset = Vector2( 0, 0 )
39/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
39/shape_one_way = false
39/shape_one_way_margin = 0.0
39/shapes = [ ]
39/z_index = 0
40/name = "rock_v"
40/texture = ExtResource( 1 )
40/tex_offset = Vector2( 0, 0 )
40/modulate = Color( 1, 1, 1, 1 )
40/region = Rect2( 0, 16, 16, 32 )
40/tile_mode = 0
40/occluder_offset = Vector2( 0, 0 )
40/navigation_offset = Vector2( 0, 0 )
40/shape_offset = Vector2( 0, 0 )
40/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
40/shape_one_way = false
40/shape_one_way_margin = 0.0
40/shapes = [ ]
40/z_index = 0
41/name = "small_rocks_1"
41/texture = ExtResource( 1 )
41/tex_offset = Vector2( 0, 0 )
41/modulate = Color( 1, 1, 1, 1 )
41/region = Rect2( 32, 80, 32, 16 )
41/tile_mode = 0
41/occluder_offset = Vector2( 0, 0 )
41/navigation_offset = Vector2( 0, 0 )
41/shape_offset = Vector2( 0, 0 )
41/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
41/shape_one_way = false
41/shape_one_way_margin = 0.0
41/shapes = [ ]
41/z_index = 0
42/name = "tiny_rock_1"
42/texture = ExtResource( 1 )
42/tex_offset = Vector2( 0, 0 )
42/modulate = Color( 1, 1, 1, 1 )
42/region = Rect2( 112, 0, 16, 16 )
42/tile_mode = 0
42/occluder_offset = Vector2( 0, 0 )
42/navigation_offset = Vector2( 0, 0 )
42/shape_offset = Vector2( 0, 0 )
42/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
42/shape_one_way = false
42/shape_one_way_margin = 0.0
42/shapes = [ ]
42/z_index = 0
43/name = "tiny_rock_2"
43/texture = ExtResource( 1 )
43/tex_offset = Vector2( 0, 0 )
43/modulate = Color( 1, 1, 1, 1 )
43/region = Rect2( 128, 0, 16, 16 )
43/tile_mode = 0
43/occluder_offset = Vector2( 0, 0 )
43/navigation_offset = Vector2( 0, 0 )
43/shape_offset = Vector2( 0, 0 )
43/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
43/shape_one_way = false
43/shape_one_way_margin = 0.0
43/shapes = [ ]
43/z_index = 0
44/name = "tiny_rock_3"
44/texture = ExtResource( 1 )
44/tex_offset = Vector2( 0, 0 )
44/modulate = Color( 1, 1, 1, 1 )
44/region = Rect2( 144, 0, 16, 16 )
44/tile_mode = 0
44/occluder_offset = Vector2( 0, 0 )
44/navigation_offset = Vector2( 0, 0 )
44/shape_offset = Vector2( 0, 0 )
44/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
44/shape_one_way = false
44/shape_one_way_margin = 0.0
44/shapes = [ ]
44/z_index = 0
45/name = "rock_h_2"
45/texture = ExtResource( 1 )
45/tex_offset = Vector2( 0, 0 )
45/modulate = Color( 1, 1, 1, 1 )
45/region = Rect2( 160, 0, 32, 16 )
45/tile_mode = 0
45/occluder_offset = Vector2( 0, 0 )
45/navigation_offset = Vector2( 0, 0 )
45/shape_offset = Vector2( 0, 0 )
45/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
45/shape_one_way = false
45/shape_one_way_margin = 0.0
45/shapes = [ ]
45/z_index = 0

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=12 format=2]
[ext_resource path="res://images/game1/opening.tres" type="SpriteFrames" id=1]
[ext_resource path="res://images/game1/opening2bg.tres" type="SpriteFrames" id=2]
[ext_resource path="res://scripts/game1/Game1Script.gd" type="Script" id=3]
[ext_resource path="res://scenes/player.tscn" type="PackedScene" id=4]
[ext_resource path="res://scenes/game1/opening2_player.tscn" type="PackedScene" id=4]
[ext_resource path="res://scripts/game1/opening2_next_step_trigger.gd" type="Script" id=5]
[ext_resource path="res://images/game1/tileset.tres" type="TileSet" id=6]
[ext_resource path="res://images/game1/game1_player.tres" type="SpriteFrames" id=7]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 114.063, 10 )
@ -21,55 +23,77 @@ extents = Vector2( 6.44203, 23.0973 )
[node name="Node2D" type="Node2D"]
script = ExtResource( 3 )
[node name="Opening" type="AnimatedSprite" parent="."]
[node name="Game" type="Node2D" parent="."]
[node name="Ground" type="TileMap" parent="Game"]
tile_set = ExtResource( 6 )
cell_size = Vector2( 16, 16 )
cell_quadrant_size = 8
cell_custom_transform = Transform2D( 0, 0, 0, 0, 0, 0 )
format = 1
[node name="Props" type="TileMap" parent="Game"]
tile_set = ExtResource( 6 )
cell_size = Vector2( 16, 16 )
cell_quadrant_size = 8
cell_custom_transform = Transform2D( 0, 0, 0, 0, 0, 0 )
format = 1
[node name="Player" type="AnimatedSprite" parent="Game"]
frames = ExtResource( 7 )
[node name="Camera2D" type="Camera2D" parent="Game/Player"]
[node name="Opening2" type="Node2D" parent="."]
visible = false
frames = ExtResource( 1 )
centered = false
[node name="Open2" type="Node2D" parent="."]
[node name="Opening2Bg" type="AnimatedSprite" parent="Open2"]
[node name="Opening2Bg" type="AnimatedSprite" parent="Opening2"]
frames = ExtResource( 2 )
centered = false
[node name="Player" parent="Open2" instance=ExtResource( 4 )]
[node name="Player" parent="Opening2" instance=ExtResource( 4 )]
position = Vector2( -6.22136, 83.6906 )
[node name="walls" type="Node2D" parent="Open2"]
[node name="walls" type="Node2D" parent="Opening2"]
[node name="StaticBody2D" type="StaticBody2D" parent="Open2/walls"]
[node name="StaticBody2D" type="StaticBody2D" parent="Opening2/walls"]
position = Vector2( -6.22136, 83.6906 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Open2/walls/StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Opening2/walls/StaticBody2D"]
position = Vector2( 99.7793, 36.875 )
shape = SubResource( 1 )
[node name="StaticBody2D2" type="StaticBody2D" parent="Open2/walls"]
[node name="StaticBody2D2" type="StaticBody2D" parent="Opening2/walls"]
position = Vector2( -6.22136, 83.6906 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Open2/walls/StaticBody2D2"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Opening2/walls/StaticBody2D2"]
position = Vector2( 101.948, -20.3563 )
shape = SubResource( 2 )
[node name="StaticBody2D3" type="StaticBody2D" parent="Open2/walls"]
[node name="StaticBody2D3" type="StaticBody2D" parent="Opening2/walls"]
position = Vector2( -6.22136, 83.6906 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Open2/walls/StaticBody2D3"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Opening2/walls/StaticBody2D3"]
position = Vector2( -25.6957, 6 )
shape = SubResource( 3 )
[node name="StaticBody2D4" type="StaticBody2D" parent="Open2/walls"]
[node name="StaticBody2D4" type="StaticBody2D" parent="Opening2/walls"]
position = Vector2( -6.22136, 83.6906 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Open2/walls/StaticBody2D4"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Opening2/walls/StaticBody2D4"]
position = Vector2( 224.921, 6 )
shape = SubResource( 3 )
[node name="next_step_trigger" type="Area2D" parent="Open2"]
[node name="next_step_trigger" type="Area2D" parent="Opening2"]
position = Vector2( -6.22136, 83.6906 )
script = ExtResource( 5 )
root_path = NodePath("../..")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Open2/next_step_trigger"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Opening2/next_step_trigger"]
position = Vector2( 210.738, 5 )
shape = SubResource( 4 )
[node name="Opening1" type="AnimatedSprite" parent="."]
visible = false
frames = ExtResource( 1 )
centered = false

View File

@ -1,10 +1,65 @@
extends Node
var playing = false
onready var player = $Game/Player
onready var player_camera = $Game/Player/Camera2D
func _ready():
$Opening.play('default')
yield($Opening, 'animation_finished')
$Opening.hide()
launch_game()
$Opening1.play('default')
yield($Opening1, 'animation_finished')
$Opening1.hide()
func launch_game():
$Open2.hide()
$Opening2.hide()
playing = true
player_camera.make_current()
player.connect('frame_changed', self, 'update_camera')
func _input(event):
if playing && !is_camera_moving:
if event.is_action_pressed('right'):
move_right()
if event.is_action_pressed('left'):
move_left()
func move_right():
is_camera_moving = true
player.play('moving')
update_camera()
yield(player, 'animation_finished')
is_camera_moving = false
player.play('default')
player.frame = 0
player.position.x += 16
func move_left():
player.position.x -= 16
is_camera_moving = true
player.play('moving', true)
update_camera()
yield(player, 'animation_finished')
is_camera_moving = false
player.play('default')
player.frame = 0
const animation_steps = [3, 6, 10, 13]
var is_camera_moving = false
func update_camera():
if is_camera_moving:
player_camera.position = Vector2(animation_steps[player.frame], 0)
print('---')
print(player.frame)
print(animation_steps[player.frame])
else:
player_camera.position = Vector2()