Add bottom area limits

This commit is contained in:
Mathilde Grapin 2023-07-02 17:23:23 +02:00
parent 40525022d7
commit 200ae7f262
22 changed files with 300 additions and 40 deletions

View file

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

View file

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://d265li1k63anm" uid="uid://d265li1k63anm"
path="res://.godot/imported/target_tile.png-8889c881dce8d973f9cccb76e30928fa.ctex" path="res://.godot/imported/ball_target.png-420e9ad20dd0b28420ac9e18f85c8839.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://art/tiles/target_tile.png" source_file="res://art/tiles/ball_target.png"
dest_files=["res://.godot/imported/target_tile.png-8889c881dce8d973f9cccb76e30928fa.ctex"] dest_files=["res://.godot/imported/ball_target.png-420e9ad20dd0b28420ac9e18f85c8839.ctex"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

View file

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://b7565sd31qorm" uid="uid://b7565sd31qorm"
path="res://.godot/imported/destination_tile.png-6f95af7bf74b60a839485c30677f4a21.ctex" path="res://.godot/imported/destination.png-6d8060cc8ba13cfb8eb5a86e36773f7a.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://art/tiles/destination_tile.png" source_file="res://art/tiles/destination.png"
dest_files=["res://.godot/imported/destination_tile.png-6f95af7bf74b60a839485c30677f4a21.ctex"] dest_files=["res://.godot/imported/destination.png-6d8060cc8ba13cfb8eb5a86e36773f7a.ctex"]
[params] [params]

View file

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

View file

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cm58s70te836m" uid="uid://cm58s70te836m"
path="res://.godot/imported/ground_tile.png-a0838c31e75c33807f6e9b010d97f31b.ctex" path="res://.godot/imported/ground.png-ce6ec90789aee5a940b6b4beb4661e80.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://art/tiles/ground_tile.png" source_file="res://art/tiles/ground.png"
dest_files=["res://.godot/imported/ground_tile.png-a0838c31e75c33807f6e9b010d97f31b.ctex"] dest_files=["res://.godot/imported/ground.png-ce6ec90789aee5a940b6b4beb4661e80.ctex"]
[params] [params]

BIN
art/tiles/ground_bottom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bpa4fpmkhv6ao"
path="res://.godot/imported/ground_bottom.png-d8a2059588952b722104cd772c3c3a06.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles/ground_bottom.png"
dest_files=["res://.godot/imported/ground_bottom.png-d8a2059588952b722104cd772c3c3a06.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
art/tiles/ground_left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bwv5d4umos2we"
path="res://.godot/imported/ground_left.png-f29085d700bb612e942e2167f26ccb98.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles/ground_left.png"
dest_files=["res://.godot/imported/ground_left.png-f29085d700bb612e942e2167f26ccb98.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cs7y54h6hd148"
path="res://.godot/imported/ground_left_bottom.png-ed5178aa269f950377859b107753d505.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles/ground_left_bottom.png"
dest_files=["res://.godot/imported/ground_left_bottom.png-ed5178aa269f950377859b107753d505.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
art/tiles/ground_right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cibnnq23akjqa"
path="res://.godot/imported/ground_right.png-5294f2bc13ed7d1f06582c289081850a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles/ground_right.png"
dest_files=["res://.godot/imported/ground_right.png-5294f2bc13ed7d1f06582c289081850a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://rc351wxc3821"
path="res://.godot/imported/ground_right_bottom.png-fd8508008a93bd4abfb6ce8b6ac148ec.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/tiles/ground_right_bottom.png"
dest_files=["res://.godot/imported/ground_right_bottom.png-fd8508008a93bd4abfb6ce8b6ac148ec.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 318 B

View file

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://lnt0clkwms52" uid="uid://lnt0clkwms52"
path="res://.godot/imported/wall_tile.png-943542e63eb98fa5c2f8ba381f7ef7b8.ctex" path="res://.godot/imported/wall.png-b444f5cdb367a6f2116effa1c0667bcc.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://art/tiles/wall_tile.png" source_file="res://art/tiles/wall.png"
dest_files=["res://.godot/imported/wall_tile.png-943542e63eb98fa5c2f8ba381f7ef7b8.ctex"] dest_files=["res://.godot/imported/wall.png-b444f5cdb367a6f2116effa1c0667bcc.ctex"]
[params] [params]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://ba1t35yyot4jl"] [gd_scene load_steps=18 format=3 uid="uid://ba1t35yyot4jl"]
[ext_resource type="Texture2D" uid="uid://bqkvmyqo86dtj" path="res://art/characters/Owlet_Monster_Walk_6.png" id="1_e23l4"] [ext_resource type="Texture2D" uid="uid://bqkvmyqo86dtj" path="res://art/characters/Owlet_Monster_Walk_6.png" id="1_e23l4"]
[ext_resource type="Script" path="res://scripts/player/player.gd" id="1_fmx2p"] [ext_resource type="Script" path="res://scripts/player/player.gd" id="1_fmx2p"]
@ -186,7 +186,10 @@ _data = {
} }
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hocsq"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_hocsq"]
size = Vector2(21, 10) size = Vector2(24, 7)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i54nm"]
size = Vector2(17, 10)
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_mask = 6 collision_mask = 6
@ -204,16 +207,15 @@ libraries = {
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-2.5, -5) position = Vector2(-3, -3.5)
shape = SubResource("RectangleShape2D_hocsq") shape = SubResource("RectangleShape2D_hocsq")
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
collision_mask = 8 collision_mask = 8
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
y_sort_enabled = true position = Vector2(-1.5, -5)
position = Vector2(-2.5, -5) shape = SubResource("RectangleShape2D_i54nm")
shape = SubResource("RectangleShape2D_hocsq")
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("state")] [node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("state")]
script = ExtResource("6_hl63m") script = ExtResource("6_hl63m")

View file

@ -1,52 +1,123 @@
[gd_scene load_steps=11 format=3 uid="uid://m8uyi35gr3qd"] [gd_scene load_steps=21 format=3 uid="uid://m8uyi35gr3qd"]
[ext_resource type="Texture2D" uid="uid://cm58s70te836m" path="res://art/tiles/ground_tile.png" id="1_set62"] [ext_resource type="Texture2D" uid="uid://cm58s70te836m" path="res://art/tiles/ground.png" id="1_kvtof"]
[ext_resource type="Texture2D" uid="uid://lnt0clkwms52" path="res://art/tiles/wall_tile.png" id="2_iitec"] [ext_resource type="Texture2D" uid="uid://lnt0clkwms52" path="res://art/tiles/wall.png" id="2_odoye"]
[ext_resource type="Texture2D" uid="uid://b7565sd31qorm" path="res://art/tiles/destination_tile.png" id="3_ca0hc"] [ext_resource type="Texture2D" uid="uid://b7565sd31qorm" path="res://art/tiles/destination.png" id="3_plcvy"]
[ext_resource type="Texture2D" uid="uid://d265li1k63anm" path="res://art/tiles/target_tile.png" id="4_w73lj"] [ext_resource type="Texture2D" uid="uid://d265li1k63anm" path="res://art/tiles/ball_target.png" id="4_k2ia8"]
[ext_resource type="Script" path="res://scripts/tile_map/tile_map.gd" id="5_hxvn0"] [ext_resource type="Script" path="res://scripts/tile_map/tile_map.gd" id="5_hxvn0"]
[ext_resource type="Texture2D" uid="uid://bwv5d4umos2we" path="res://art/tiles/ground_left.png" id="5_uwsf1"]
[ext_resource type="Texture2D" uid="uid://cibnnq23akjqa" path="res://art/tiles/ground_right.png" id="6_tgb06"]
[ext_resource type="Texture2D" uid="uid://bpa4fpmkhv6ao" path="res://art/tiles/ground_bottom.png" id="7_ffh6f"]
[ext_resource type="Texture2D" uid="uid://cs7y54h6hd148" path="res://art/tiles/ground_left_bottom.png" id="8_c76ky"]
[ext_resource type="Texture2D" uid="uid://rc351wxc3821" path="res://art/tiles/ground_right_bottom.png" id="9_mdsbd"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wq1n0"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wq1n0"]
texture = ExtResource("1_set62") texture = ExtResource("1_kvtof")
texture_region_size = Vector2i(32, 32) texture_region_size = Vector2i(32, 32)
0:0/0 = 0 0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) 0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0 0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u0t08"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u0t08"]
texture = ExtResource("2_iitec") texture = ExtResource("2_odoye")
texture_region_size = Vector2i(32, 32) texture_region_size = Vector2i(32, 32)
0:0/0 = 0 0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) 0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0 0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 8.5, 0, 1.5, 15.5, 9, 0, 16) 0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 9.5, -16, -7.5, 0, 0.5, 16.5, -7.5, 16.5, 9, -0.5, 17)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_x1mdb"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_x1mdb"]
texture = ExtResource("3_ca0hc") texture = ExtResource("3_plcvy")
texture_region_size = Vector2i(32, 32) texture_region_size = Vector2i(32, 32)
0:0/0 = 0 0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) 0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0 0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hm0kl"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hm0kl"]
texture = ExtResource("4_w73lj") texture = ExtResource("4_k2ia8")
texture_region_size = Vector2i(32, 32) texture_region_size = Vector2i(32, 32)
0:0/0 = 0 0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0) 0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0 0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8npvn"]
texture = ExtResource("5_uwsf1")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-3.5, -19.5, -19.5, -11, -22.5, -13, -7, -21.5)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_f47wg"]
texture = ExtResource("6_tgb06")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(1, 0.5, 16.5, -7, 21, -4.5, 6, 3)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_trdpm"]
texture = ExtResource("7_ffh6f")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-18, -6, -2.5, 2, -6.5, 4.5, -22, -4)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_aht32"]
texture = ExtResource("8_c76ky")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-2.5, -18.5, -21, -10, -1, 1.5, -7, 2, -29, -10, -5.5, -21)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_cx4es"]
texture = ExtResource("9_mdsbd")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(16.5, -7.5, -0.5, 2, -18, -6.5, -22.5, -5, 0, 8, 21, -5.5)
0:0/0/physics_layer_1/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_1/angular_velocity = 0.0
[sub_resource type="TileSet" id="TileSet_kwgeq"] [sub_resource type="TileSet" id="TileSet_kwgeq"]
tile_shape = 1 tile_shape = 1
tile_layout = 5 tile_layout = 5
tile_size = Vector2i(32, 16) tile_size = Vector2i(32, 16)
physics_layer_0/collision_layer = 1 physics_layer_0/collision_layer = 4
physics_layer_0/collision_mask = 3
physics_layer_1/collision_layer = 4
sources/0 = SubResource("TileSetAtlasSource_wq1n0") sources/0 = SubResource("TileSetAtlasSource_wq1n0")
sources/1 = SubResource("TileSetAtlasSource_u0t08") sources/1 = SubResource("TileSetAtlasSource_u0t08")
sources/2 = SubResource("TileSetAtlasSource_x1mdb") sources/2 = SubResource("TileSetAtlasSource_x1mdb")
sources/3 = SubResource("TileSetAtlasSource_hm0kl") sources/3 = SubResource("TileSetAtlasSource_hm0kl")
sources/4 = SubResource("TileSetAtlasSource_8npvn")
sources/5 = SubResource("TileSetAtlasSource_f47wg")
sources/6 = SubResource("TileSetAtlasSource_trdpm")
sources/7 = SubResource("TileSetAtlasSource_aht32")
sources/8 = SubResource("TileSetAtlasSource_cx4es")
[node name="TileMap" type="TileMap"] [node name="TileMap" type="TileMap"]
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-1, 1)
tile_set = SubResource("TileSet_kwgeq") tile_set = SubResource("TileSet_kwgeq")
format = 2 format = 2
layer_0/name = "ground" layer_0/name = "ground"

View file

@ -6,8 +6,6 @@ signal hit_ball
signal ball_starts_colliding signal ball_starts_colliding
signal ball_stops_colliding signal ball_stops_colliding
@export var speed = 120 @export var speed = 120
@onready var animation_player = $AnimationPlayer
@onready var sprite = $Sprite2D
@onready var tile_map: TileMap = get_parent() @onready var tile_map: TileMap = get_parent()
func _ready(): func _ready():
@ -19,21 +17,21 @@ func get_input_direction():
func flip_sprite(): func flip_sprite():
if Input.is_action_pressed("move_left"): if Input.is_action_pressed("move_left"):
sprite.flip_h = true $Sprite2D.flip_h = true
elif Input.is_action_pressed("move_right"): elif Input.is_action_pressed("move_right"):
sprite.flip_h = false $Sprite2D.flip_h = false
func play_idle_animation(): func play_idle_animation():
animation_player.play("idle") $AnimationPlayer.play("idle")
func play_walk_animation(): func play_walk_animation():
animation_player.play("walk") $AnimationPlayer.play("walk")
func play_hit_ball_animation(): func play_hit_ball_animation():
animation_player.speed_scale = 0.8 $AnimationPlayer.speed_scale = 0.8
animation_player.play("hit_ball") $AnimationPlayer.play("hit_ball")
await animation_player.animation_finished await $AnimationPlayer.animation_finished
animation_player.speed_scale = 1 $AnimationPlayer.speed_scale = 1
func _on_area_2d_body_entered(_body): func _on_area_2d_body_entered(_body):
# As players Area2D only collide with balls # As players Area2D only collide with balls

View file

@ -4,6 +4,11 @@ extends TileMap
@export var wall_tile_source_id = 1 @export var wall_tile_source_id = 1
@export var destination_tile_source_id = 2 @export var destination_tile_source_id = 2
@export var target_tile_source_id = 3 @export var target_tile_source_id = 3
@export var ground_left_tile_source_id = 4
@export var ground_right_tile_source_id = 5
@export var ground_bottom_tile_source_id = 6
@export var ground_left_bottom_tile_source_id = 7
@export var ground_right_bottom_tile_source_id = 8
@export var map_width = 13 # keep to a odd value @export var map_width = 13 # keep to a odd value
@export var map_height = 19 # keep to a odd value @export var map_height = 19 # keep to a odd value
# Debug variables # Debug variables
@ -22,9 +27,23 @@ func draw_map():
draw_wall() draw_wall()
func draw_ground(): func draw_ground():
var tile_source_id = ground_tile_source_id
var height = get_bottom_area_height()
for x in range(map_width): for x in range(map_width):
for y in range(map_height): for y in range(map_height):
set_cell(0, Vector2i(x, y), ground_tile_source_id, Vector2i(0, 0), 0) if x == 0 && y == map_height - 1:
tile_source_id = ground_left_bottom_tile_source_id
elif x == map_width - 1 && y == map_height - 1:
tile_source_id = ground_right_bottom_tile_source_id
elif x == 0 && y >= height.x:
tile_source_id = ground_left_tile_source_id
elif x == map_width - 1 && y >= height.x:
tile_source_id = ground_right_tile_source_id
elif y == height.y:
tile_source_id = ground_bottom_tile_source_id
else:
tile_source_id = ground_tile_source_id
set_cell(0, Vector2i(x, y), tile_source_id, Vector2i(0, 0), 0)
func draw_wall(): func draw_wall():
var middle_height = floor(map_height / 2.0) var middle_height = floor(map_height / 2.0)