buggy implementation of shoreline drawing

This commit is contained in:
Antti Hakkarainen 2023-02-09 13:33:07 +02:00
parent 9f2dbb2a1d
commit 5cb839d8e2
8 changed files with 1112 additions and 25 deletions

BIN
art/terrain/terrain.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djy5ne2grdc03"
path="res://.godot/imported/terrain.png-06c63c2b87b3131a2067f668f87a9d67.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/terrain/terrain.png"
dest_files=["res://.godot/imported/terrain.png-06c63c2b87b3131a2067f668f87a9d67.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
maps/tampere_200px_crop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -0,0 +1,14 @@
[remap]
importer="image"
type="Image"
uid="uid://0a1cbgacbam1"
path="res://.godot/imported/tampere_200px_crop.png-6feaed79770d61a67e37097ebb13d691.image"
[deps]
source_file="res://maps/tampere_200px_crop.png"
dest_files=["res://.godot/imported/tampere_200px_crop.png-6feaed79770d61a67e37097ebb13d691.image"]
[params]

View file

@ -5,8 +5,8 @@
[ext_resource type="Script" path="res://scripts/Control.gd" id="3_1t1c8"] [ext_resource type="Script" path="res://scripts/Control.gd" id="3_1t1c8"]
[ext_resource type="Script" path="res://scripts/World.gd" id="3_6q5ju"] [ext_resource type="Script" path="res://scripts/World.gd" id="3_6q5ju"]
[ext_resource type="Texture2D" uid="uid://dakvtfpnjuwwl" path="res://art/placeholder/outdoors.png" id="3_yddbk"] [ext_resource type="Texture2D" uid="uid://dakvtfpnjuwwl" path="res://art/placeholder/outdoors.png" id="3_yddbk"]
[ext_resource type="Texture2D" uid="uid://bor3gkli3s8eg" path="res://art/terrain/water.png" id="4_i5fj4"]
[ext_resource type="PackedScene" uid="uid://2we3txfr812u" path="res://scenes/Camera_zoom_2d.tscn" id="4_rx82t"] [ext_resource type="PackedScene" uid="uid://2we3txfr812u" path="res://scenes/Camera_zoom_2d.tscn" id="4_rx82t"]
[ext_resource type="Texture2D" uid="uid://djy5ne2grdc03" path="res://art/terrain/terrain.png" id="5_bqev6"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_3q7ue"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_3q7ue"]
texture = ExtResource("2_sfv1p") texture = ExtResource("2_sfv1p")
@ -460,15 +460,974 @@ texture = ExtResource("3_yddbk")
14:2/size_in_atlas = Vector2i(4, 4) 14:2/size_in_atlas = Vector2i(4, 4)
14:2/0 = 0 14:2/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_bcy6h"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hwjm3"]
texture = ExtResource("4_i5fj4") texture = ExtResource("5_bqev6")
0:0/0 = 0 0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
8:0/0 = 0
9:0/0 = 0
10:0/0 = 0
11:0/0 = 0
12:0/0 = 0
13:0/0 = 0
14:0/0 = 0
15:0/0 = 0
16:0/0 = 0
17:0/0 = 0
18:0/0 = 0
19:0/0 = 0
20:0/0 = 0
21:0/0 = 0
22:0/0 = 0
23:0/0 = 0
24:0/0 = 0
25:0/0 = 0
26:0/0 = 0
27:0/0 = 0
28:0/0 = 0
29:0/0 = 0
30:0/0 = 0
31:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 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27:10/0 = 0
28:10/0 = 0
29:10/0 = 0
30:10/0 = 0
31:10/0 = 0
0:11/0 = 0
1:11/0 = 0
2:11/0 = 0
3:11/0 = 0
4:11/0 = 0
5:11/0 = 0
6:11/0 = 0
7:11/0 = 0
8:11/0 = 0
9:11/0 = 0
10:11/0 = 0
11:11/0 = 0
12:11/0 = 0
13:11/0 = 0
14:11/0 = 0
15:11/0 = 0
16:11/0 = 0
17:11/0 = 0
18:11/0 = 0
19:11/0 = 0
20:11/0 = 0
21:11/0 = 0
22:11/0 = 0
23:11/0 = 0
24:11/0 = 0
25:11/0 = 0
26:11/0 = 0
27:11/0 = 0
28:11/0 = 0
29:11/0 = 0
30:11/0 = 0
31:11/0 = 0
0:12/0 = 0
1:12/0 = 0
2:12/0 = 0
3:12/0 = 0
4:12/0 = 0
5:12/0 = 0
6:12/0 = 0
7:12/0 = 0
8:12/0 = 0
9:12/0 = 0
10:12/0 = 0
11:12/0 = 0
12:12/0 = 0
13:12/0 = 0
14:12/0 = 0
15:12/0 = 0
16:12/0 = 0
17:12/0 = 0
18:12/0 = 0
19:12/0 = 0
20:12/0 = 0
21:12/0 = 0
22:12/0 = 0
23:12/0 = 0
24:12/0 = 0
25:12/0 = 0
26:12/0 = 0
27:12/0 = 0
28:12/0 = 0
29:12/0 = 0
30:12/0 = 0
31:12/0 = 0
0:13/0 = 0
1:13/0 = 0
2:13/0 = 0
3:13/0 = 0
4:13/0 = 0
5:13/0 = 0
6:13/0 = 0
7:13/0 = 0
8:13/0 = 0
9:13/0 = 0
10:13/0 = 0
11:13/0 = 0
12:13/0 = 0
13:13/0 = 0
14:13/0 = 0
15:13/0 = 0
16:13/0 = 0
17:13/0 = 0
18:13/0 = 0
19:13/0 = 0
20:13/0 = 0
21:13/0 = 0
22:13/0 = 0
23:13/0 = 0
24:13/0 = 0
25:13/0 = 0
26:13/0 = 0
27:13/0 = 0
28:13/0 = 0
29:13/0 = 0
30:13/0 = 0
31:13/0 = 0
0:14/0 = 0
1:14/0 = 0
2:14/0 = 0
3:14/0 = 0
4:14/0 = 0
5:14/0 = 0
6:14/0 = 0
7:14/0 = 0
8:14/0 = 0
9:14/0 = 0
10:14/0 = 0
11:14/0 = 0
12:14/0 = 0
13:14/0 = 0
14:14/0 = 0
15:14/0 = 0
16:14/0 = 0
17:14/0 = 0
18:14/0 = 0
19:14/0 = 0
20:14/0 = 0
21:14/0 = 0
22:14/0 = 0
23:14/0 = 0
24:14/0 = 0
25:14/0 = 0
26:14/0 = 0
27:14/0 = 0
28:14/0 = 0
29:14/0 = 0
30:14/0 = 0
31:14/0 = 0
0:15/0 = 0
1:15/0 = 0
2:15/0 = 0
3:15/0 = 0
4:15/0 = 0
5:15/0 = 0
6:15/0 = 0
7:15/0 = 0
8:15/0 = 0
9:15/0 = 0
10:15/0 = 0
11:15/0 = 0
12:15/0 = 0
13:15/0 = 0
14:15/0 = 0
15:15/0 = 0
16:15/0 = 0
17:15/0 = 0
18:15/0 = 0
19:15/0 = 0
20:15/0 = 0
21:15/0 = 0
22:15/0 = 0
23:15/0 = 0
24:15/0 = 0
25:15/0 = 0
26:15/0 = 0
27:15/0 = 0
28:15/0 = 0
29:15/0 = 0
30:15/0 = 0
31:15/0 = 0
0:16/0 = 0
1:16/0 = 0
2:16/0 = 0
3:16/0 = 0
4:16/0 = 0
5:16/0 = 0
6:16/0 = 0
7:16/0 = 0
8:16/0 = 0
9:16/0 = 0
10:16/0 = 0
11:16/0 = 0
12:16/0 = 0
13:16/0 = 0
14:16/0 = 0
15:16/0 = 0
16:16/0 = 0
17:16/0 = 0
18:16/0 = 0
19:16/0 = 0
20:16/0 = 0
21:16/0 = 0
22:16/0 = 0
23:16/0 = 0
24:16/0 = 0
25:16/0 = 0
26:16/0 = 0
27:16/0 = 0
28:16/0 = 0
29:16/0 = 0
30:16/0 = 0
31:16/0 = 0
0:17/0 = 0
1:17/0 = 0
2:17/0 = 0
3:17/0 = 0
4:17/0 = 0
5:17/0 = 0
6:17/0 = 0
7:17/0 = 0
8:17/0 = 0
9:17/0 = 0
10:17/0 = 0
11:17/0 = 0
12:17/0 = 0
13:17/0 = 0
14:17/0 = 0
15:17/0 = 0
16:17/0 = 0
17:17/0 = 0
18:17/0 = 0
19:17/0 = 0
20:17/0 = 0
21:17/0 = 0
22:17/0 = 0
23:17/0 = 0
24:17/0 = 0
25:17/0 = 0
26:17/0 = 0
27:17/0 = 0
28:17/0 = 0
29:17/0 = 0
30:17/0 = 0
31:17/0 = 0
0:18/0 = 0
1:18/0 = 0
2:18/0 = 0
3:18/0 = 0
4:18/0 = 0
5:18/0 = 0
6:18/0 = 0
7:18/0 = 0
8:18/0 = 0
9:18/0 = 0
10:18/0 = 0
11:18/0 = 0
12:18/0 = 0
13:18/0 = 0
14:18/0 = 0
15:18/0 = 0
16:18/0 = 0
17:18/0 = 0
18:18/0 = 0
19:18/0 = 0
20:18/0 = 0
21:18/0 = 0
22:18/0 = 0
23:18/0 = 0
24:18/0 = 0
25:18/0 = 0
26:18/0 = 0
27:18/0 = 0
28:18/0 = 0
29:18/0 = 0
30:18/0 = 0
31:18/0 = 0
0:19/0 = 0
1:19/0 = 0
2:19/0 = 0
3:19/0 = 0
4:19/0 = 0
5:19/0 = 0
6:19/0 = 0
7:19/0 = 0
8:19/0 = 0
9:19/0 = 0
10:19/0 = 0
11:19/0 = 0
12:19/0 = 0
13:19/0 = 0
14:19/0 = 0
15:19/0 = 0
16:19/0 = 0
17:19/0 = 0
18:19/0 = 0
19:19/0 = 0
20:19/0 = 0
21:19/0 = 0
22:19/0 = 0
23:19/0 = 0
24:19/0 = 0
25:19/0 = 0
26:19/0 = 0
27:19/0 = 0
28:19/0 = 0
29:19/0 = 0
30:19/0 = 0
31:19/0 = 0
0:20/0 = 0
1:20/0 = 0
2:20/0 = 0
3:20/0 = 0
4:20/0 = 0
5:20/0 = 0
6:20/0 = 0
7:20/0 = 0
8:20/0 = 0
9:20/0 = 0
10:20/0 = 0
11:20/0 = 0
12:20/0 = 0
13:20/0 = 0
14:20/0 = 0
15:20/0 = 0
16:20/0 = 0
17:20/0 = 0
18:20/0 = 0
19:20/0 = 0
20:20/0 = 0
21:20/0 = 0
22:20/0 = 0
23:20/0 = 0
24:20/0 = 0
25:20/0 = 0
26:20/0 = 0
27:20/0 = 0
28:20/0 = 0
29:20/0 = 0
30:20/0 = 0
31:20/0 = 0
0:21/0 = 0
1:21/0 = 0
2:21/0 = 0
3:21/0 = 0
4:21/0 = 0
5:21/0 = 0
6:21/0 = 0
7:21/0 = 0
8:21/0 = 0
9:21/0 = 0
10:21/0 = 0
11:21/0 = 0
12:21/0 = 0
13:21/0 = 0
14:21/0 = 0
15:21/0 = 0
16:21/0 = 0
17:21/0 = 0
18:21/0 = 0
19:21/0 = 0
20:21/0 = 0
21:21/0 = 0
22:21/0 = 0
23:21/0 = 0
24:21/0 = 0
25:21/0 = 0
26:21/0 = 0
27:21/0 = 0
28:21/0 = 0
29:21/0 = 0
30:21/0 = 0
31:21/0 = 0
0:22/0 = 0
1:22/0 = 0
2:22/0 = 0
3:22/0 = 0
4:22/0 = 0
5:22/0 = 0
6:22/0 = 0
7:22/0 = 0
8:22/0 = 0
9:22/0 = 0
10:22/0 = 0
11:22/0 = 0
12:22/0 = 0
13:22/0 = 0
14:22/0 = 0
15:22/0 = 0
16:22/0 = 0
17:22/0 = 0
18:22/0 = 0
19:22/0 = 0
20:22/0 = 0
21:22/0 = 0
22:22/0 = 0
23:22/0 = 0
24:22/0 = 0
25:22/0 = 0
26:22/0 = 0
27:22/0 = 0
28:22/0 = 0
29:22/0 = 0
30:22/0 = 0
31:22/0 = 0
0:23/0 = 0
1:23/0 = 0
2:23/0 = 0
3:23/0 = 0
4:23/0 = 0
5:23/0 = 0
6:23/0 = 0
7:23/0 = 0
8:23/0 = 0
9:23/0 = 0
10:23/0 = 0
11:23/0 = 0
12:23/0 = 0
13:23/0 = 0
14:23/0 = 0
15:23/0 = 0
16:23/0 = 0
17:23/0 = 0
18:23/0 = 0
19:23/0 = 0
20:23/0 = 0
21:23/0 = 0
22:23/0 = 0
23:23/0 = 0
24:23/0 = 0
25:23/0 = 0
26:23/0 = 0
27:23/0 = 0
28:23/0 = 0
29:23/0 = 0
30:23/0 = 0
31:23/0 = 0
0:24/0 = 0
1:24/0 = 0
2:24/0 = 0
3:24/0 = 0
4:24/0 = 0
5:24/0 = 0
6:24/0 = 0
7:24/0 = 0
8:24/0 = 0
9:24/0 = 0
10:24/0 = 0
11:24/0 = 0
12:24/0 = 0
13:24/0 = 0
14:24/0 = 0
15:24/0 = 0
16:24/0 = 0
17:24/0 = 0
18:24/0 = 0
19:24/0 = 0
20:24/0 = 0
21:24/0 = 0
22:24/0 = 0
23:24/0 = 0
24:24/0 = 0
25:24/0 = 0
26:24/0 = 0
27:24/0 = 0
28:24/0 = 0
29:24/0 = 0
30:24/0 = 0
31:24/0 = 0
0:25/0 = 0
1:25/0 = 0
2:25/0 = 0
3:25/0 = 0
4:25/0 = 0
5:25/0 = 0
6:25/0 = 0
7:25/0 = 0
8:25/0 = 0
9:25/0 = 0
10:25/0 = 0
11:25/0 = 0
12:25/0 = 0
13:25/0 = 0
14:25/0 = 0
15:25/0 = 0
16:25/0 = 0
17:25/0 = 0
18:25/0 = 0
19:25/0 = 0
20:25/0 = 0
21:25/0 = 0
22:25/0 = 0
23:25/0 = 0
24:25/0 = 0
25:25/0 = 0
26:25/0 = 0
27:25/0 = 0
28:25/0 = 0
29:25/0 = 0
30:25/0 = 0
31:25/0 = 0
0:26/0 = 0
1:26/0 = 0
2:26/0 = 0
3:26/0 = 0
4:26/0 = 0
5:26/0 = 0
6:26/0 = 0
7:26/0 = 0
8:26/0 = 0
9:26/0 = 0
10:26/0 = 0
11:26/0 = 0
12:26/0 = 0
13:26/0 = 0
14:26/0 = 0
15:26/0 = 0
16:26/0 = 0
17:26/0 = 0
18:26/0 = 0
19:26/0 = 0
20:26/0 = 0
21:26/0 = 0
22:26/0 = 0
23:26/0 = 0
24:26/0 = 0
25:26/0 = 0
26:26/0 = 0
27:26/0 = 0
28:26/0 = 0
29:26/0 = 0
30:26/0 = 0
31:26/0 = 0
0:27/0 = 0
1:27/0 = 0
2:27/0 = 0
3:27/0 = 0
4:27/0 = 0
5:27/0 = 0
6:27/0 = 0
7:27/0 = 0
8:27/0 = 0
9:27/0 = 0
10:27/0 = 0
11:27/0 = 0
12:27/0 = 0
13:27/0 = 0
14:27/0 = 0
15:27/0 = 0
16:27/0 = 0
17:27/0 = 0
18:27/0 = 0
19:27/0 = 0
20:27/0 = 0
21:27/0 = 0
22:27/0 = 0
23:27/0 = 0
24:27/0 = 0
25:27/0 = 0
26:27/0 = 0
27:27/0 = 0
28:27/0 = 0
29:27/0 = 0
30:27/0 = 0
31:27/0 = 0
0:28/0 = 0
1:28/0 = 0
2:28/0 = 0
3:28/0 = 0
4:28/0 = 0
5:28/0 = 0
6:28/0 = 0
7:28/0 = 0
8:28/0 = 0
9:28/0 = 0
10:28/0 = 0
11:28/0 = 0
12:28/0 = 0
13:28/0 = 0
14:28/0 = 0
15:28/0 = 0
16:28/0 = 0
17:28/0 = 0
18:28/0 = 0
19:28/0 = 0
20:28/0 = 0
21:28/0 = 0
22:28/0 = 0
23:28/0 = 0
24:28/0 = 0
25:28/0 = 0
26:28/0 = 0
27:28/0 = 0
28:28/0 = 0
29:28/0 = 0
30:28/0 = 0
31:28/0 = 0
0:29/0 = 0
1:29/0 = 0
2:29/0 = 0
3:29/0 = 0
4:29/0 = 0
5:29/0 = 0
6:29/0 = 0
7:29/0 = 0
8:29/0 = 0
9:29/0 = 0
10:29/0 = 0
11:29/0 = 0
12:29/0 = 0
13:29/0 = 0
14:29/0 = 0
15:29/0 = 0
16:29/0 = 0
17:29/0 = 0
18:29/0 = 0
19:29/0 = 0
20:29/0 = 0
21:29/0 = 0
22:29/0 = 0
23:29/0 = 0
24:29/0 = 0
25:29/0 = 0
26:29/0 = 0
27:29/0 = 0
28:29/0 = 0
29:29/0 = 0
30:29/0 = 0
31:29/0 = 0
[sub_resource type="TileSet" id="TileSet_t3bbo"] [sub_resource type="TileSet" id="TileSet_t3bbo"]
terrain_set_0/mode = 0 terrain_set_0/mode = 0
sources/1 = SubResource("TileSetAtlasSource_s55i2") sources/1 = SubResource("TileSetAtlasSource_s55i2")
sources/0 = SubResource("TileSetAtlasSource_3q7ue") sources/0 = SubResource("TileSetAtlasSource_3q7ue")
sources/2 = SubResource("TileSetAtlasSource_bcy6h") sources/2 = SubResource("TileSetAtlasSource_hwjm3")
[node name="Main" type="Node"] [node name="Main" type="Node"]
script = ExtResource("1_ysxum") script = ExtResource("1_ysxum")

View file

@ -4,6 +4,7 @@
extends Node extends Node
var world_map: TileMap var world_map: TileMap
var map_image_size:Vector2i
# FILE PATHS # FILE PATHS
const SCENE_PATH:String = "res://scenes/" const SCENE_PATH:String = "res://scenes/"

View file

@ -9,7 +9,7 @@
extends Node extends Node
# The idea is for the user to be able to choose the map from GUI later # The idea is for the user to be able to choose the map from GUI later
var map_file_name: String = "res://maps/tampere_10x10km_1000px.png" var map_file_name: String = "res://maps/tampere_200px_crop.png"
func _init(): func _init():
DisplayServer.window_set_size( DisplayServer.window_set_size(

View file

@ -6,6 +6,7 @@ var has_placeable_building: bool = false
var building var building
var building_type: String var building_type: String
var scene var scene
var image:Image = Image.new()
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -78,9 +79,9 @@ func _input(event):
func calculate_grid_coordinates(map_position: Vector2) -> Vector2: func calculate_grid_coordinates(map_position: Vector2) -> Vector2:
return (map_position).floor() return (map_position).floor()
func are_coords_valid(value:int, errmsg:String) -> bool: func are_coords_valid(value:int, bounds:Vector2i, errmsg:String) -> bool:
if Globals.MAP_MIN_HEIGHT > value or value > Globals.MAP_MAX_HEIGHT: if bounds.x > value or value > bounds.y:
errmsg = errmsg % [value, Globals.MAP_MIN_HEIGHT, Globals.MAP_MAX_HEIGHT] errmsg = errmsg % [value, bounds.x, bounds.y]
push_error(errmsg) push_error(errmsg)
return false return false
@ -90,16 +91,23 @@ func place_building_to_map():
var building_properties = get_building_properties() var building_properties = get_building_properties()
var tile_on_mouse = local_to_map(get_global_mouse_position()) var tile_on_mouse = local_to_map(get_global_mouse_position())
if !are_coords_valid(tile_on_mouse.y,Globals.ERROR_TILE_Y_COORDS_OUT_OF_BOUNDS): if !are_coords_valid(
tile_on_mouse.y,
Vector2i(0, Globals.map_image_size.y),
Globals.ERROR_TILE_Y_COORDS_OUT_OF_BOUNDS
):
return false return false
elif !are_coords_valid(tile_on_mouse.x,Globals.ERROR_TILE_X_COORDS_OUT_OF_BOUNDS): elif !are_coords_valid(
tile_on_mouse.x,
Vector2i(0, Globals.map_image_size.x),
Globals.ERROR_TILE_X_COORDS_OUT_OF_BOUNDS
):
return false return false
set_cell(Globals.LAYER_BUILDINGS, tile_on_mouse, building_properties[0], building_properties[1], 0) set_cell(Globals.LAYER_BUILDINGS, tile_on_mouse, building_properties[0], building_properties[1], 0)
func generate_terrain(filename) -> bool: func generate_terrain(filename) -> bool:
# Try to load the image which we used to place water & ground to world map # Try to load the image which we used to place water & ground to world map
var image:Image = Image.new()
image = load(filename) image = load(filename)
if image == null: if image == null:
var errmsg = Globals.ERROR_FAILED_TO_LOAD_FILE var errmsg = Globals.ERROR_FAILED_TO_LOAD_FILE
@ -107,28 +115,99 @@ func generate_terrain(filename) -> bool:
return false return false
# Check if image is too small or too large # Check if image is too small or too large
var image_size:Vector2i = image.get_size() Globals.map_image_size = image.get_size()
if !are_coords_valid(image_size.y,Globals.ERROR_IMAGE_HEIGHT_INCORRECT): if !validate_mapgen_params():
return false return false
elif !are_coords_valid(image_size.x,Globals.ERROR_IMAGE_WIDTH_INCORRECT):
generate_water_and_land()
generate_shorelines()
# center camera to world map
emit_signal(
"set_camera_position",
Vector2(Globals.map_image_size.x / 2.0 * Globals.TILE_SIZE_X,
Globals.map_image_size.y / 2.0 * Globals.TILE_SIZE_Y)
)
return true
func validate_mapgen_params() -> bool:
if !are_coords_valid(
Globals.map_image_size.y,
Vector2i(Globals.MAP_MIN_HEIGHT, Globals.MAP_MAX_HEIGHT),
Globals.ERROR_IMAGE_HEIGHT_INCORRECT):
return false
elif !are_coords_valid(
Globals.map_image_size.x,
Vector2i(Globals.MAP_MIN_WIDTH, Globals.MAP_MAX_WIDTH),
Globals.ERROR_IMAGE_WIDTH_INCORRECT):
return false return false
# Try to load the world tilemap where we place the tiles # Try to load the world tilemap where we place the tiles
if (Globals.world_map == null): if (Globals.world_map == null):
var errmsg = Globals.ERROR_WORLD_TILEMAP_NODE_MISSING % Globals.WORLD_NODE var errmsg = Globals.ERROR_WORLD_TILEMAP_NODE_MISSING % Globals.WORLD_NODE
push_error(errmsg) push_error(errmsg)
return false return false
# Finally populate the world map with hopefully valid tiles! return true
for x in image_size.x:
for y in image_size.y: func generate_water_and_land() -> void:
for x in Globals.map_image_size.x:
for y in Globals.map_image_size.y:
# layer | position coords | tilemap id | coords of the tile at tilemap | alternative tile # layer | position coords | tilemap id | coords of the tile at tilemap | alternative tile
if image.get_pixel(x, y) == Globals.WATER_TILE_COLOR_IN_MAP_FILE: if image.get_pixel(x, y) == Globals.WATER_TILE_COLOR_IN_MAP_FILE:
Globals.world_map.set_cell(Globals.LAYER_TERRAIN, Vector2i(x, y), 2, Vector2i(15,5), 0)
else:
Globals.world_map.set_cell(Globals.LAYER_TERRAIN, Vector2i(x, y), 2, Vector2i(0,0), 0) Globals.world_map.set_cell(Globals.LAYER_TERRAIN, Vector2i(x, y), 2, Vector2i(0,0), 0)
func generate_shorelines() -> void:
# for testing avoid map borders to make it simpler to implement
var directions:Array = [
Vector2i(0,1), # south
Vector2i(1,0), # east
Vector2i(0,-1), # north
Vector2i(-1,0) # west
]
for x in range(1, Globals.map_image_size.x-1):
for y in range(1, Globals.map_image_size.y-1):
# skip tiles with water
if image.get_pixel(x, y) == Globals.WATER_TILE_COLOR_IN_MAP_FILE:
continue
# now we are supposed to be inspecting a tile with land
# 1 = water 0 = land
var surrounding_water_tiles:Array = []
# determine which directions have water around the tile
for dir in directions:
if image.get_pixel(x+dir.x, y+dir.y) == Globals.WATER_TILE_COLOR_IN_MAP_FILE:
surrounding_water_tiles.append(1)
continue
surrounding_water_tiles.append(0)
var selected_tile:Vector2i = Vector2i(0,0)
match surrounding_water_tiles:
[1,1,0,0]: # south & east
selected_tile = Vector2i(19,0) # or 20
[0,1,1,0]: # north & east
selected_tile = Vector2i(15,0) # or 60
[0,0,1,1]: # north & west
selected_tile = Vector2i(11,0) # or 12
[1,0,0,1]: # south & west
selected_tile = Vector2i(7,0) # or 8
[0,0,0,1]: # water in west only
selected_tile = Vector2i(9,0) # or 10
[0,0,1,0]: # water in north only
selected_tile = Vector2i(13,0) # or 14
[0,1,0,0]: # water in east only
selected_tile = Vector2i(17,0) # or 18
[1,0,0,0]: # water in south only
selected_tile = Vector2i(5,0) # or 6
_: # otherwise skip drawing
continue
# layer | position coords | tilemap id | coords of the tile at tilemap | alternative tile
Globals.world_map.set_cell(Globals.LAYER_TERRAIN, Vector2i(x, y), 2, selected_tile, 0)
# center camera to world map
emit_signal(
"set_camera_position",
Vector2(image_size.x/2.0*Globals.TILE_SIZE_X, image_size.y/2.0*Globals.TILE_SIZE_Y)
)
return true