Compare commits
6 Commits
269f2daf6c
...
28466d71c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28466d71c9 | ||
|
|
a5523f4107 | ||
|
|
f8b4ab793c | ||
|
|
c57076cd52 | ||
|
|
dd50a00cfa | ||
|
|
9429d48e32 |
@@ -10,51 +10,26 @@ separation = Vector2i(1, 1)
|
||||
0:0/0/terrain_set = 0
|
||||
0:0/0/terrain = 0
|
||||
0:0/0/terrains_peering_bit/right_side = 0
|
||||
0:0/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
0:0/0/terrains_peering_bit/bottom_side = 0
|
||||
1:0/0 = 0
|
||||
1:0/0/terrain_set = 0
|
||||
1:0/0/terrain = 0
|
||||
1:0/0/terrains_peering_bit/right_side = 0
|
||||
1:0/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
1:0/0/terrains_peering_bit/bottom_side = 0
|
||||
1:0/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
1:0/0/terrains_peering_bit/left_side = 0
|
||||
2:0/0 = 0
|
||||
2:0/0/terrain_set = 0
|
||||
2:0/0/terrain = 0
|
||||
2:0/0/terrains_peering_bit/bottom_side = 0
|
||||
2:0/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
2:0/0/terrains_peering_bit/left_side = 0
|
||||
3:0/0 = 0
|
||||
3:0/0/terrain_set = 0
|
||||
3:0/0/terrain = 0
|
||||
3:0/0/terrains_peering_bit/bottom_side = 0
|
||||
4:0/0 = 0
|
||||
4:0/0/terrain_set = 0
|
||||
4:0/0/terrain = 0
|
||||
4:0/0/terrains_peering_bit/bottom_side = 0
|
||||
4:0/0/terrains_peering_bit/left_side = 0
|
||||
5:0/0 = 0
|
||||
5:0/0/terrain_set = 0
|
||||
5:0/0/terrain = 0
|
||||
5:0/0/terrains_peering_bit/right_side = 0
|
||||
5:0/0/terrains_peering_bit/bottom_side = 0
|
||||
5:0/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
5:0/0/terrains_peering_bit/left_side = 0
|
||||
5:0/0/terrains_peering_bit/top_left_corner = 0
|
||||
5:0/0/terrains_peering_bit/top_side = 0
|
||||
5:0/0/terrains_peering_bit/top_right_corner = 0
|
||||
6:0/0 = 0
|
||||
6:0/0/terrain_set = 0
|
||||
6:0/0/terrain = 0
|
||||
6:0/0/terrains_peering_bit/right_side = 0
|
||||
6:0/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
6:0/0/terrains_peering_bit/bottom_side = 0
|
||||
6:0/0/terrains_peering_bit/left_side = 0
|
||||
6:0/0/terrains_peering_bit/top_left_corner = 0
|
||||
6:0/0/terrains_peering_bit/top_side = 0
|
||||
6:0/0/terrains_peering_bit/top_right_corner = 0
|
||||
7:0/0 = 0
|
||||
7:0/0/terrain_set = 0
|
||||
7:0/0/terrain = 0
|
||||
@@ -82,59 +57,29 @@ separation = Vector2i(1, 1)
|
||||
0:1/0/terrain_set = 0
|
||||
0:1/0/terrain = 0
|
||||
0:1/0/terrains_peering_bit/right_side = 0
|
||||
0:1/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
0:1/0/terrains_peering_bit/bottom_side = 0
|
||||
0:1/0/terrains_peering_bit/top_side = 0
|
||||
0:1/0/terrains_peering_bit/top_right_corner = 0
|
||||
1:1/0 = 0
|
||||
1:1/0/terrain_set = 0
|
||||
1:1/0/terrain = 0
|
||||
1:1/0/terrains_peering_bit/right_side = 0
|
||||
1:1/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
1:1/0/terrains_peering_bit/bottom_side = 0
|
||||
1:1/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
1:1/0/terrains_peering_bit/left_side = 0
|
||||
1:1/0/terrains_peering_bit/top_left_corner = 0
|
||||
1:1/0/terrains_peering_bit/top_side = 0
|
||||
1:1/0/terrains_peering_bit/top_right_corner = 0
|
||||
2:1/0 = 0
|
||||
2:1/0/terrain_set = 0
|
||||
2:1/0/terrain = 0
|
||||
2:1/0/terrains_peering_bit/bottom_side = 0
|
||||
2:1/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
2:1/0/terrains_peering_bit/left_side = 0
|
||||
2:1/0/terrains_peering_bit/top_left_corner = 0
|
||||
2:1/0/terrains_peering_bit/top_side = 0
|
||||
3:1/0 = 0
|
||||
3:1/0/terrain_set = 0
|
||||
3:1/0/terrain = 0
|
||||
3:1/0/terrains_peering_bit/right_side = 0
|
||||
3:1/0/terrains_peering_bit/top_side = 0
|
||||
4:1/0 = 0
|
||||
4:1/0/terrain_set = 0
|
||||
4:1/0/terrain = 0
|
||||
4:1/0/terrains_peering_bit/left_side = 0
|
||||
4:1/0/terrains_peering_bit/top_side = 0
|
||||
5:1/0 = 0
|
||||
5:1/0/terrain_set = 0
|
||||
5:1/0/terrain = 0
|
||||
5:1/0/terrains_peering_bit/right_side = 0
|
||||
5:1/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
5:1/0/terrains_peering_bit/bottom_side = 0
|
||||
5:1/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
5:1/0/terrains_peering_bit/left_side = 0
|
||||
5:1/0/terrains_peering_bit/top_left_corner = 0
|
||||
5:1/0/terrains_peering_bit/top_side = 0
|
||||
6:1/0 = 0
|
||||
6:1/0/terrain_set = 0
|
||||
6:1/0/terrain = 0
|
||||
6:1/0/terrains_peering_bit/right_side = 0
|
||||
6:1/0/terrains_peering_bit/bottom_right_corner = 0
|
||||
6:1/0/terrains_peering_bit/bottom_side = 0
|
||||
6:1/0/terrains_peering_bit/bottom_left_corner = 0
|
||||
6:1/0/terrains_peering_bit/left_side = 0
|
||||
6:1/0/terrains_peering_bit/top_side = 0
|
||||
6:1/0/terrains_peering_bit/top_right_corner = 0
|
||||
7:1/0 = 0
|
||||
7:1/0/terrain_set = 0
|
||||
7:1/0/terrain = 0
|
||||
@@ -164,20 +109,16 @@ separation = Vector2i(1, 1)
|
||||
0:2/0/terrain = 0
|
||||
0:2/0/terrains_peering_bit/right_side = 0
|
||||
0:2/0/terrains_peering_bit/top_side = 0
|
||||
0:2/0/terrains_peering_bit/top_right_corner = 0
|
||||
1:2/0 = 0
|
||||
1:2/0/terrain_set = 0
|
||||
1:2/0/terrain = 0
|
||||
1:2/0/terrains_peering_bit/right_side = 0
|
||||
1:2/0/terrains_peering_bit/left_side = 0
|
||||
1:2/0/terrains_peering_bit/top_left_corner = 0
|
||||
1:2/0/terrains_peering_bit/top_side = 0
|
||||
1:2/0/terrains_peering_bit/top_right_corner = 0
|
||||
2:2/0 = 0
|
||||
2:2/0/terrain_set = 0
|
||||
2:2/0/terrain = 0
|
||||
2:2/0/terrains_peering_bit/left_side = 0
|
||||
2:2/0/terrains_peering_bit/top_left_corner = 0
|
||||
2:2/0/terrains_peering_bit/top_side = 0
|
||||
3:2/0 = 0
|
||||
3:2/0/terrain_set = 0
|
||||
@@ -543,23 +484,16 @@ separation = Vector2i(1, 1)
|
||||
25:14/0 = 0
|
||||
26:14/0 = 0
|
||||
0:15/0 = 0
|
||||
0:15/0/terrain_set = 0
|
||||
0:15/0/terrain = 1
|
||||
0:15/0/z_index = 1
|
||||
1:15/0 = 0
|
||||
1:15/0/z_index = 1
|
||||
1:15/0/terrain_set = 0
|
||||
1:15/0/terrain = 1
|
||||
1:15/0/terrains_peering_bit/right_side = 1
|
||||
1:15/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
1:15/0/terrains_peering_bit/bottom_side = 1
|
||||
1:15/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
1:15/0/terrains_peering_bit/left_side = 1
|
||||
2:15/0 = 0
|
||||
2:15/0/terrain_set = 0
|
||||
2:15/0/terrains_peering_bit/right_side = 1
|
||||
2:15/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
2:15/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
2:15/0/terrains_peering_bit/top_left_corner = 1
|
||||
2:15/0/terrains_peering_bit/top_right_corner = 1
|
||||
2:15/0/z_index = 1
|
||||
3:15/0 = 0
|
||||
4:15/0 = 0
|
||||
5:15/0 = 0
|
||||
@@ -585,70 +519,33 @@ separation = Vector2i(1, 1)
|
||||
25:15/0 = 0
|
||||
26:15/0 = 0
|
||||
0:16/0 = 0
|
||||
0:16/0/terrain_set = 0
|
||||
0:16/0/terrain = 1
|
||||
0:16/0/z_index = 1
|
||||
1:16/0 = 0
|
||||
1:16/0/z_index = 1
|
||||
1:16/0/y_sort_origin = 1
|
||||
1:16/0/terrain_set = 0
|
||||
1:16/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
1:16/0/terrains_peering_bit/right_side = 1
|
||||
1:16/0/terrains_peering_bit/bottom_side = 1
|
||||
1:16/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
1:16/0/terrains_peering_bit/top_left_corner = 1
|
||||
1:16/0/terrains_peering_bit/left_side = 1
|
||||
1:16/0/terrains_peering_bit/top_side = 1
|
||||
1:16/0/terrains_peering_bit/top_right_corner = 1
|
||||
2:16/0 = 0
|
||||
2:16/0/terrain_set = 0
|
||||
2:16/0/terrain = 1
|
||||
2:16/0/z_index = 1
|
||||
3:16/0 = 0
|
||||
3:16/0/terrain_set = 0
|
||||
3:16/0/terrain = 1
|
||||
3:16/0/z_index = 1
|
||||
4:16/0 = 0
|
||||
4:16/0/terrain_set = 0
|
||||
4:16/0/terrain = 1
|
||||
4:16/0/z_index = 1
|
||||
5:16/0 = 0
|
||||
5:16/0/terrain_set = 0
|
||||
5:16/0/terrain = 1
|
||||
5:16/0/terrains_peering_bit/right_side = 1
|
||||
5:16/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
5:16/0/terrains_peering_bit/bottom_side = 1
|
||||
5:16/0/z_index = 1
|
||||
6:16/0 = 0
|
||||
6:16/0/terrain_set = 0
|
||||
6:16/0/terrain = 1
|
||||
6:16/0/terrains_peering_bit/bottom_side = 1
|
||||
6:16/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
6:16/0/terrains_peering_bit/left_side = 1
|
||||
6:16/0/z_index = 1
|
||||
7:16/0 = 0
|
||||
7:16/0/terrain_set = 0
|
||||
7:16/0/terrain = 1
|
||||
7:16/0/terrains_peering_bit/right_side = 1
|
||||
7:16/0/terrains_peering_bit/bottom_side = 1
|
||||
7:16/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
7:16/0/terrains_peering_bit/left_side = 1
|
||||
7:16/0/terrains_peering_bit/top_left_corner = 1
|
||||
7:16/0/terrains_peering_bit/top_side = 1
|
||||
7:16/0/terrains_peering_bit/top_right_corner = 1
|
||||
7:16/0/z_index = 1
|
||||
8:16/0 = 0
|
||||
8:16/0/terrain_set = 0
|
||||
8:16/0/terrain = 1
|
||||
8:16/0/terrains_peering_bit/right_side = 1
|
||||
8:16/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
8:16/0/terrains_peering_bit/bottom_side = 1
|
||||
8:16/0/terrains_peering_bit/left_side = 1
|
||||
8:16/0/terrains_peering_bit/top_left_corner = 1
|
||||
8:16/0/terrains_peering_bit/top_side = 1
|
||||
8:16/0/terrains_peering_bit/top_right_corner = 1
|
||||
8:16/0/z_index = 1
|
||||
9:16/0 = 0
|
||||
9:16/0/terrain_set = 0
|
||||
9:16/0/terrain = 1
|
||||
9:16/0/terrains_peering_bit/right_side = 1
|
||||
9:16/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
9:16/0/terrains_peering_bit/bottom_side = 1
|
||||
9:16/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
9:16/0/terrains_peering_bit/left_side = 1
|
||||
9:16/0/terrains_peering_bit/top_left_corner = 1
|
||||
9:16/0/terrains_peering_bit/top_side = 1
|
||||
9:16/0/terrains_peering_bit/top_right_corner = 1
|
||||
9:16/0/z_index = 1
|
||||
10:16/0 = 0
|
||||
10:16/0/terrain_set = 0
|
||||
10:16/0/z_index = 1
|
||||
11:16/0 = 0
|
||||
12:16/0 = 0
|
||||
13:16/0 = 0
|
||||
@@ -666,85 +563,47 @@ separation = Vector2i(1, 1)
|
||||
25:16/0 = 0
|
||||
26:16/0 = 0
|
||||
0:17/0 = 0
|
||||
0:17/0/terrain_set = 0
|
||||
0:17/0/terrain = 1
|
||||
0:17/0/z_index = 1
|
||||
1:17/0 = 0
|
||||
1:17/0/z_index = 1
|
||||
1:17/0/terrain_set = 0
|
||||
1:17/0/terrain = 1
|
||||
1:17/0/terrains_peering_bit/right_side = 1
|
||||
1:17/0/terrains_peering_bit/left_side = 1
|
||||
1:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
1:17/0/terrains_peering_bit/top_side = 1
|
||||
1:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
2:17/0 = 0
|
||||
2:17/0/z_index = 1
|
||||
2:17/0/terrain_set = 0
|
||||
2:17/0/terrain = 1
|
||||
2:17/0/terrains_peering_bit/right_side = 1
|
||||
2:17/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
2:17/0/terrains_peering_bit/bottom_side = 1
|
||||
2:17/0/terrains_peering_bit/top_side = 1
|
||||
2:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
3:17/0 = 0
|
||||
3:17/0/z_index = 1
|
||||
3:17/0/terrain_set = 0
|
||||
3:17/0/terrains_peering_bit/right_side = 1
|
||||
3:17/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
3:17/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
3:17/0/terrains_peering_bit/bottom_side = 1
|
||||
3:17/0/terrains_peering_bit/left_side = 1
|
||||
3:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
3:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
3:17/0/terrains_peering_bit/top_side = 1
|
||||
4:17/0 = 0
|
||||
4:17/0/z_index = 1
|
||||
4:17/0/terrain_set = 0
|
||||
4:17/0/terrain = 1
|
||||
4:17/0/terrains_peering_bit/bottom_side = 1
|
||||
4:17/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
4:17/0/terrains_peering_bit/left_side = 1
|
||||
4:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
4:17/0/terrains_peering_bit/top_side = 1
|
||||
5:17/0 = 0
|
||||
5:17/0/terrain_set = 0
|
||||
5:17/0/terrain = 1
|
||||
5:17/0/terrains_peering_bit/right_side = 1
|
||||
5:17/0/terrains_peering_bit/top_side = 1
|
||||
5:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
5:17/0/z_index = 1
|
||||
6:17/0 = 0
|
||||
6:17/0/terrain_set = 0
|
||||
6:17/0/terrain = 1
|
||||
6:17/0/terrains_peering_bit/left_side = 1
|
||||
6:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
6:17/0/terrains_peering_bit/top_side = 1
|
||||
6:17/0/z_index = 1
|
||||
7:17/0 = 0
|
||||
7:17/0/terrain_set = 0
|
||||
7:17/0/terrain = 1
|
||||
7:17/0/terrains_peering_bit/right_side = 1
|
||||
7:17/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
7:17/0/terrains_peering_bit/bottom_side = 1
|
||||
7:17/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
7:17/0/terrains_peering_bit/left_side = 1
|
||||
7:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
7:17/0/terrains_peering_bit/top_side = 1
|
||||
7:17/0/z_index = 1
|
||||
8:17/0 = 0
|
||||
8:17/0/terrain_set = 0
|
||||
8:17/0/terrain = 1
|
||||
8:17/0/terrains_peering_bit/right_side = 1
|
||||
8:17/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
8:17/0/terrains_peering_bit/bottom_side = 1
|
||||
8:17/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
8:17/0/terrains_peering_bit/left_side = 1
|
||||
8:17/0/terrains_peering_bit/top_side = 1
|
||||
8:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
8:17/0/z_index = 1
|
||||
9:17/0 = 0
|
||||
9:17/0/terrain_set = 0
|
||||
9:17/0/terrain = 1
|
||||
9:17/0/terrains_peering_bit/right_side = 1
|
||||
9:17/0/terrains_peering_bit/bottom_right_corner = 1
|
||||
9:17/0/terrains_peering_bit/bottom_side = 1
|
||||
9:17/0/terrains_peering_bit/bottom_left_corner = 1
|
||||
9:17/0/terrains_peering_bit/left_side = 1
|
||||
9:17/0/terrains_peering_bit/top_left_corner = 1
|
||||
9:17/0/terrains_peering_bit/top_side = 1
|
||||
9:17/0/terrains_peering_bit/top_right_corner = 1
|
||||
9:17/0/z_index = 1
|
||||
10:17/0 = 0
|
||||
10:17/0/terrain_set = 0
|
||||
10:17/0/z_index = 1
|
||||
11:17/0 = 0
|
||||
12:17/0 = 0
|
||||
13:17/0 = 0
|
||||
@@ -763,7 +622,7 @@ separation = Vector2i(1, 1)
|
||||
26:17/0 = 0
|
||||
|
||||
[resource]
|
||||
terrain_set_0/mode = 0
|
||||
terrain_set_0/mode = 2
|
||||
terrain_set_0/terrain_0/name = "Gras"
|
||||
terrain_set_0/terrain_0/color = Color(0.545098, 0.658824, 0.635294, 1)
|
||||
terrain_set_0/terrain_1/name = "Asphalt"
|
||||
|
||||
17
Scenes/Main/camera_controller.gd
Normal file
17
Scenes/Main/camera_controller.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends Node2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_pressed("MoveUp"):
|
||||
global_position += Vector2.UP * 2
|
||||
if Input.is_action_pressed("MoveDown"):
|
||||
global_position += Vector2.DOWN * 2
|
||||
if Input.is_action_pressed("MoveLeft"):
|
||||
global_position += Vector2.LEFT * 2
|
||||
if Input.is_action_pressed("MoveRight"):
|
||||
global_position += Vector2.RIGHT * 2
|
||||
1
Scenes/Main/camera_controller.gd.uid
Normal file
1
Scenes/Main/camera_controller.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://brublmhrsdc7l
|
||||
@@ -1,13 +1,17 @@
|
||||
extends Node
|
||||
|
||||
@onready var _Map = $Map
|
||||
@onready var _Player = $Player
|
||||
@onready var _Camera = $WorldCamera
|
||||
@onready var _Map: Node = $Map
|
||||
#@onready var _Player = $Player
|
||||
#@onready var _Camera = $WorldCamera
|
||||
|
||||
@export var mapSize: int = 15
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
_Map.populate_terrain(_Camera.global_position)
|
||||
var thread: Thread = Thread.new()
|
||||
thread.start(func(): _Map.generate_map(mapSize))
|
||||
thread.wait_to_finish()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
@@ -1,18 +1,27 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d05j5yuhlsxp0"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://d05j5yuhlsxp0"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cywuuce71rmgb" path="res://Scenes/Map/map.tscn" id="1_1r6ip"]
|
||||
[ext_resource type="Script" uid="uid://btdvxp8ckmeb3" path="res://Scenes/Main/main.gd" id="1_qw60k"]
|
||||
[ext_resource type="PackedScene" uid="uid://dh8pjs2s1kud3" path="res://Scenes/Player/player.tscn" id="2_lixft"]
|
||||
[ext_resource type="Script" uid="uid://cpp4vte6rs37q" path="res://Scenes/Main/world_camera.gd" id="4_5yls4"]
|
||||
[ext_resource type="Script" uid="uid://brublmhrsdc7l" path="res://Scenes/Main/camera_controller.gd" id="3_p6jpk"]
|
||||
[ext_resource type="Script" uid="uid://xrddv2epi3ty" path="res://addons/smartcamera2D/SmartCamera2D.gd" id="3_qw60k"]
|
||||
[ext_resource type="Texture2D" uid="uid://bq6ud1dmn8fds" path="res://addons/smartcamera2D/Camera2D.svg" id="5_2a143"]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource("1_qw60k")
|
||||
mapSize = 100
|
||||
|
||||
[node name="Map" parent="." instance=ExtResource("1_1r6ip")]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_lixft")]
|
||||
[node name="CameraController" type="Node2D" parent="."]
|
||||
script = ExtResource("3_p6jpk")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="WorldCamera" type="Camera2D" parent="."]
|
||||
script = ExtResource("4_5yls4")
|
||||
[node name="SmartCamera2D" type="Camera2D" parent="CameraController"]
|
||||
script = ExtResource("3_qw60k")
|
||||
target = NodePath("..")
|
||||
metadata/_custom_type_script = "uid://xrddv2epi3ty"
|
||||
|
||||
[editable path="Player"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="CameraController"]
|
||||
texture = ExtResource("5_2a143")
|
||||
|
||||
[editable path="Map"]
|
||||
|
||||
13
Scenes/Main/procedural_map.tscn
Normal file
13
Scenes/Main/procedural_map.tscn
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://byecwjojbqcsf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ch84gxwetfvk3" path="res://procedural_map.gd" id="1_2fyk6"]
|
||||
[ext_resource type="TileSet" uid="uid://duodt2t14xjc8" path="res://Resource/UrbanKitTileMap.tres" id="2_2qyxa"]
|
||||
|
||||
[node name="ProceduralMap" type="Node"]
|
||||
script = ExtResource("1_2fyk6")
|
||||
|
||||
[node name="Ground" type="TileMapLayer" parent="."]
|
||||
tile_set = ExtResource("2_2qyxa")
|
||||
|
||||
[node name="Roads" type="TileMapLayer" parent="."]
|
||||
tile_set = ExtResource("2_2qyxa")
|
||||
@@ -20,7 +20,6 @@ const GREEN_TILE: Vector2i = Vector2i(1, 1)
|
||||
|
||||
var tilemap: TileMap;
|
||||
|
||||
@onready var Player = $Player/AnimatedSprite2D
|
||||
@onready var GroundLayer: TileMapLayer = $Ground
|
||||
|
||||
func _get_player_position() -> Vector2i:
|
||||
@@ -43,21 +42,20 @@ func _ready() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func _on_exited_chunk():
|
||||
print("Chunk exited...")
|
||||
$VisibleOnScreenNotifier2D.global_position = Player.global_position
|
||||
|
||||
var thread: Thread = Thread.new()
|
||||
thread.start(func(): _populate_terrain())
|
||||
thread.wait_to_finish()
|
||||
|
||||
func populate_terrain(startPos: Vector2i):
|
||||
for i in range(-CHUNK_DOUBLE, CHUNK_DOUBLE):
|
||||
for j in range(-CHUNK_DOUBLE, CHUNK_DOUBLE):
|
||||
var pos: Vector2i = startPos + Vector2i(i, j)
|
||||
if _is_empty(pos):
|
||||
_populate_cell(pos, 1, _pick_random_tile())
|
||||
|
||||
|
||||
func generate_map(mapSize: int):
|
||||
print_debug("Generating map")
|
||||
for x in range(-mapSize, mapSize):
|
||||
for y in range(-mapSize, mapSize):
|
||||
var pos: Vector2i = Vector2i(x, y)
|
||||
_populate_cell(pos, 1, _pick_random_tile())
|
||||
|
||||
func _populate_terrain():
|
||||
var player_position: Vector2i = _get_player_position()
|
||||
|
||||
@@ -78,11 +76,15 @@ func _populate_cell(coords: Vector2i, source_id: int, atlas_coords: Vector2i) ->
|
||||
# set_cell(coords: Vector2i, source_id: int = -1, atlas_coords: Vector2i = Vector2i(-1, -1), alternative_tile: int = 0)
|
||||
GroundLayer.set_cell.call_deferred(coords, source_id, atlas_coords, alternativeTileId)
|
||||
|
||||
|
||||
|
||||
# full random (absolute nonsense)
|
||||
func _pick_random_tile() -> Vector2i:
|
||||
# Make all Tiles green
|
||||
return Vector2i(1, 1)
|
||||
var atlasSize: Vector2i = _source.get_atlas_grid_size()
|
||||
var rndX: int = randi_range(0, atlasSize.x)
|
||||
var rndY: int = randi_range(0, atlasSize.y)
|
||||
|
||||
return Vector2i(rndX, rndY)
|
||||
|
||||
func _is_empty(pos: Vector2i) -> bool:
|
||||
# Check if the cell is empty (source_id is -1)
|
||||
return true if GroundLayer.get_cell_source_id(pos) == -1 else false;
|
||||
return true if GroundLayer.get_cell_source_id(pos) == -1 else false;
|
||||
@@ -1,10 +1,7 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://cywuuce71rmgb"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cywuuce71rmgb"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dneqmqsd8yj4p" path="res://Scenes/Map/Map.gd" id="1_anho1"]
|
||||
[ext_resource type="TileSet" uid="uid://duodt2t14xjc8" path="res://Resource/UrbanKitTileMap.tres" id="2_fyo8k"]
|
||||
[ext_resource type="Script" uid="uid://bapvlrx6dm7gu" path="res://Scenes/Map/visible_on_screen_notifier_2d.gd" id="3_eu35m"]
|
||||
|
||||
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_vjcy3"]
|
||||
|
||||
[node name="Map" type="Node"]
|
||||
script = ExtResource("1_anho1")
|
||||
@@ -24,16 +21,3 @@ metadata/_edit_lock_ = true
|
||||
[node name="Details" type="TileMapLayer" parent="."]
|
||||
tile_set = ExtResource("2_fyo8k")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
rect = Rect2(0, 0, 100, 100)
|
||||
script = ExtResource("3_eu35m")
|
||||
metadata/_edit_lock_ = true
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="VisibleOnScreenNotifier2D"]
|
||||
position = Vector2(50, 50)
|
||||
scale = Vector2(10, 10)
|
||||
texture = SubResource("PlaceholderTexture2D_vjcy3")
|
||||
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_exited_chunk"]
|
||||
|
||||
1
addons/smartcamera2D/Camera2D.svg
Normal file
1
addons/smartcamera2D/Camera2D.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#8da5f3" d="M9 2a3 3 0 0 0-3 2.777 3 3 0 1 0-3 5.047V12a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-1l3 2V7l-3 2V7.23A3 3 0 0 0 9 2z"/></svg>
|
||||
|
After Width: | Height: | Size: 203 B |
37
addons/smartcamera2D/Camera2D.svg.import
Normal file
37
addons/smartcamera2D/Camera2D.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bq6ud1dmn8fds"
|
||||
path="res://.godot/imported/Camera2D.svg-e2316bbab95f65a3786cbb6cb8741380.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/smartcamera2D/Camera2D.svg"
|
||||
dest_files=["res://.godot/imported/Camera2D.svg-e2316bbab95f65a3786cbb6cb8741380.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
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
14
addons/smartcamera2D/CameraControl.gd
Normal file
14
addons/smartcamera2D/CameraControl.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Node
|
||||
|
||||
signal apply_flash
|
||||
signal apply_shake
|
||||
|
||||
var active = true
|
||||
|
||||
func apply_camera_flash(color: Color, duration = 0.3):
|
||||
if not active: return
|
||||
apply_flash.emit(color, duration)
|
||||
|
||||
func apply_camera_shake(force: float = 2.0, duration = 0.4):
|
||||
if not active: return
|
||||
apply_shake.emit(force, duration)
|
||||
1
addons/smartcamera2D/CameraControl.gd.uid
Normal file
1
addons/smartcamera2D/CameraControl.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cl0y12rxbo7ub
|
||||
21
addons/smartcamera2D/LICENSE
Normal file
21
addons/smartcamera2D/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 AndreMicheletti
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
205
addons/smartcamera2D/SmartCamera2D.gd
Normal file
205
addons/smartcamera2D/SmartCamera2D.gd
Normal file
@@ -0,0 +1,205 @@
|
||||
@tool
|
||||
extends Camera2D
|
||||
|
||||
class_name SmartCamera2D
|
||||
|
||||
enum TARGET_MODE {
|
||||
PARENT,
|
||||
SINGLE,
|
||||
MULTIPLE,
|
||||
GROUP
|
||||
}
|
||||
|
||||
@export_category("GENERAL CONFIG")
|
||||
@export var default_zoom: Vector2 = Vector2.ONE
|
||||
|
||||
@export_category("TARGET CONFIG")
|
||||
@export var target_mode: TARGET_MODE:
|
||||
set(value):
|
||||
target_mode = value
|
||||
notify_property_list_changed()
|
||||
|
||||
@export var target: NodePath
|
||||
@export var targets: Array[NodePath]
|
||||
@export var group_name: String
|
||||
@export var adjust_zoom: bool = true
|
||||
@export_range(1.0, 999.9) var adjust_zoom_margin: float
|
||||
@export_range(0.001, 999.9) var adjust_zoom_min: float = 0.1
|
||||
@export_range(0.001, 999.9) var adjust_zoom_max: float = 1.0
|
||||
@export_range(-1, 999, 1) var adjust_zoom_priority_node_index: int = -1
|
||||
|
||||
@export_category("EFFECTS CONFIG")
|
||||
@export var effects_layer: int = 2
|
||||
|
||||
var target_node: Node2D
|
||||
var target_nodes: Array[Node]
|
||||
var extra_position = Vector2.ZERO
|
||||
|
||||
@onready var refresh_target_timer = Timer.new()
|
||||
@onready var canvas_layer = CanvasLayer.new()
|
||||
@onready var camera_flash: ColorRect
|
||||
|
||||
func _ready():
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
CameraControl.apply_flash.connect(apply_camera_flash)
|
||||
CameraControl.apply_shake.connect(apply_camera_shake)
|
||||
zoom = default_zoom
|
||||
_make_refresh_timer()
|
||||
_make_effects_layers()
|
||||
if target_mode == TARGET_MODE.SINGLE:
|
||||
ensure_target_node()
|
||||
elif target_mode == TARGET_MODE.MULTIPLE:
|
||||
ensure_target_nodes()
|
||||
call_deferred("_refresh_targets")
|
||||
|
||||
func _make_refresh_timer():
|
||||
refresh_target_timer.connect("timeout", _refresh_targets)
|
||||
refresh_target_timer.wait_time = 0.3
|
||||
add_child(refresh_target_timer)
|
||||
refresh_target_timer.start()
|
||||
|
||||
func _make_effects_layers():
|
||||
canvas_layer.layer = effects_layer
|
||||
add_child(canvas_layer)
|
||||
camera_flash = create_color_rect()
|
||||
|
||||
func apply_camera_shake(force: float = 2.0, duration = 0.8):
|
||||
var tween = create_tween()
|
||||
var step_dur = duration / 5.0
|
||||
tween.tween_property(self, "extra_position", Vector2(-force, force), step_dur)
|
||||
tween.tween_property(self, "extra_position", Vector2(force, force), step_dur)
|
||||
tween.tween_property(self, "extra_position", Vector2(force, -force), step_dur)
|
||||
tween.tween_property(self, "extra_position", Vector2(-force, -force), step_dur)
|
||||
tween.tween_property(self, "extra_position", Vector2.ZERO, step_dur)
|
||||
|
||||
func apply_camera_flash(color: Color, duration = 0.3):
|
||||
var screen_size = get_viewport_rect().size
|
||||
camera_flash.size = screen_size
|
||||
var tween = create_tween()
|
||||
var final_color = Color(color, 0.0)
|
||||
var initial_color = Color(color, 0.2)
|
||||
camera_flash.visible = true
|
||||
tween.tween_property(camera_flash, "color", final_color, duration) \
|
||||
.from(initial_color)
|
||||
await tween.finished
|
||||
camera_flash.visible = false
|
||||
|
||||
func _process(delta):
|
||||
if not Engine.is_editor_hint():
|
||||
_sanitize_targets()
|
||||
if target_mode == TARGET_MODE.PARENT:
|
||||
position = Vector2.ZERO
|
||||
elif target_mode == TARGET_MODE.SINGLE:
|
||||
_process_target_single(delta)
|
||||
elif target_mode == TARGET_MODE.MULTIPLE:
|
||||
_process_target_multiple(delta)
|
||||
elif target_mode == TARGET_MODE.GROUP:
|
||||
_process_target_group(delta)
|
||||
position = position + extra_position
|
||||
|
||||
func _process_target_single(delta):
|
||||
if not target_node:
|
||||
printerr("[SmartCamera2D] TARGET NODE IS NULL")
|
||||
return
|
||||
global_position = target_node.global_position
|
||||
|
||||
func _process_target_multiple(delta):
|
||||
if target_nodes.size() < 0:
|
||||
printerr("[SmartCamera2D] NOT ENOUGH TARGET NODES")
|
||||
return
|
||||
adjust_camera_zoom()
|
||||
|
||||
func _process_target_group(delta):
|
||||
if target_nodes.size() < 0:
|
||||
printerr("[SmartCamera2D] NOT ENOUGH TARGET NODES")
|
||||
return
|
||||
adjust_camera_zoom()
|
||||
|
||||
func ensure_target_node():
|
||||
if target_node: return
|
||||
target_node = get_node(target)
|
||||
|
||||
func ensure_target_nodes():
|
||||
target_nodes.clear()
|
||||
for path in targets:
|
||||
target_nodes.append(get_node(path))
|
||||
|
||||
func adjust_camera_zoom():
|
||||
if target_nodes.is_empty():
|
||||
return
|
||||
if target_nodes.size() == 1:
|
||||
zoom = default_zoom
|
||||
global_position = target_nodes[0].global_position
|
||||
return
|
||||
var screen_size = get_viewport_rect().size
|
||||
var min_pos = target_nodes[0].global_position
|
||||
var max_pos = target_nodes[0].global_position
|
||||
for node in target_nodes:
|
||||
min_pos = min_pos.min(node.global_position)
|
||||
max_pos = max_pos.max(node.global_position)
|
||||
var size = max_pos - min_pos
|
||||
var zoom_x = screen_size.x / size.x if size.x != 0 else 1.0
|
||||
var zoom_y = screen_size.y / size.y if size.y != 0 else 1.0
|
||||
var zoom_safe = clamp(min(zoom_x, zoom_y) / adjust_zoom_margin, adjust_zoom_min, adjust_zoom_max)
|
||||
zoom = Vector2(zoom_safe, zoom_safe)
|
||||
var center_position = (min_pos + max_pos) / 2.0
|
||||
global_position = center_position
|
||||
|
||||
var priority_i = adjust_zoom_priority_node_index
|
||||
if priority_i > -1:
|
||||
if not is_point_visible(target_nodes[priority_i].global_position, screen_size):
|
||||
center_position = target_nodes[priority_i].global_position
|
||||
|
||||
func is_point_visible(point: Vector2, screen_size: Vector2) -> bool:
|
||||
var half_screen = (screen_size / 2.0) / zoom
|
||||
var camera_min = global_position - half_screen
|
||||
var camera_max = global_position + half_screen
|
||||
return point.x >= camera_min.x and point.x <= camera_max.x and point.y >= camera_min.y and point.y <= camera_max.y
|
||||
|
||||
func create_color_rect():
|
||||
var color_rect = ColorRect.new()
|
||||
color_rect.visible = false
|
||||
color_rect.color = Color.TRANSPARENT
|
||||
color_rect.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
color_rect.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
canvas_layer.add_child(color_rect)
|
||||
return color_rect
|
||||
|
||||
func _refresh_targets():
|
||||
if target_mode == TARGET_MODE.SINGLE:
|
||||
if not target_node:
|
||||
target_node = get_node(target)
|
||||
elif target_mode == TARGET_MODE.GROUP:
|
||||
target_nodes = get_tree().get_nodes_in_group(group_name)
|
||||
|
||||
func _sanitize_targets():
|
||||
if target_node and target_node.is_queued_for_deletion():
|
||||
target_node = null
|
||||
if not target_nodes.is_empty():
|
||||
target_nodes = target_nodes.filter(_filter_existing_node)
|
||||
|
||||
func _filter_existing_node(variant) -> bool:
|
||||
if variant == null:
|
||||
return false
|
||||
if not variant is Node2D:
|
||||
return false
|
||||
if variant is Node2D and variant.is_queued_for_deletion():
|
||||
return false
|
||||
return true
|
||||
|
||||
|
||||
func _validate_property(property: Dictionary):
|
||||
var multiple_properties = [
|
||||
"adjust_zoom", "zoom_margin", "adjust_zoom_margin",
|
||||
"adjust_zoom_min", "adjust_zoom_max", "adjust_zoom_priority_node_index"
|
||||
]
|
||||
if property.name == "target" and target_mode != TARGET_MODE.SINGLE:
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR
|
||||
if property.name == "group_name" and target_mode != TARGET_MODE.GROUP:
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR
|
||||
if property.name == "targets" and target_mode != TARGET_MODE.MULTIPLE:
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR
|
||||
if property.name in multiple_properties and target_mode not in [TARGET_MODE.MULTIPLE, TARGET_MODE.GROUP]:
|
||||
property.usage = PROPERTY_USAGE_NO_EDITOR
|
||||
1
addons/smartcamera2D/SmartCamera2D.gd.uid
Normal file
1
addons/smartcamera2D/SmartCamera2D.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xrddv2epi3ty
|
||||
7
addons/smartcamera2D/plugin.cfg
Normal file
7
addons/smartcamera2D/plugin.cfg
Normal file
@@ -0,0 +1,7 @@
|
||||
[plugin]
|
||||
|
||||
name="smartcamera2D"
|
||||
description="A plug-and-play camera controller with smooth follow, screen shake, zoom"
|
||||
author="Async Studio"
|
||||
version="1.0"
|
||||
script="plugin.gd"
|
||||
14
addons/smartcamera2D/plugin.gd
Normal file
14
addons/smartcamera2D/plugin.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
func _enter_tree():
|
||||
# Initialization of the plugin goes here.
|
||||
# Add the new type with a name, a parent type, a script and an icon.
|
||||
add_custom_type("SmartCamera2D", "Camera2D", preload("SmartCamera2D.gd"), preload("Camera2D.svg"))
|
||||
add_autoload_singleton("CameraControl", "CameraControl.gd")
|
||||
|
||||
func _exit_tree():
|
||||
# Clean-up of the plugin goes here.
|
||||
# Always remember to remove it from the engine when deactivated.
|
||||
remove_custom_type("SmartCamera2D")
|
||||
remove_autoload_singleton("CameraControl")
|
||||
1
addons/smartcamera2D/plugin.gd.uid
Normal file
1
addons/smartcamera2D/plugin.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b6pcau1vjhp20
|
||||
49
procedural_map.gd
Normal file
49
procedural_map.gd
Normal file
@@ -0,0 +1,49 @@
|
||||
extends Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var width: int = 100
|
||||
var height: int = 100
|
||||
var terrainMap: Array[Variant] = generateTerrainMap(width, height)
|
||||
paintTerrainMap($Ground, terrainMap, "grass", 0)
|
||||
|
||||
func generateTerrainMap(width: int, heigth: int) -> Array[Variant]:
|
||||
var terrainMap: Array[Variant] = []
|
||||
for y in range(heigth):
|
||||
terrainMap.append([])
|
||||
for x in range(width):
|
||||
if randf() < 0.1: # 10% chance for asphalt
|
||||
terrainMap[y].append("asphalt")
|
||||
else:
|
||||
terrainMap[y].append("grass")
|
||||
|
||||
return terrainMap
|
||||
|
||||
func paintTerrainMap(layer, terrain_map, default_terrain, terrain_set_index):
|
||||
var tile_set = layer.tile_set
|
||||
#var terrain_set = tile_set.get_terrain_set(terrain_set_index)
|
||||
#var grass_id = terrain_set.find_terrain_by_name("Gras")
|
||||
#var asphalt_id = terrain_set.find_terrain_by_name("Asphalt")
|
||||
|
||||
# Collect coordinates for each terrain type
|
||||
var grass_cells = []
|
||||
var asphalt_cells = []
|
||||
|
||||
for y in range(terrain_map.size()):
|
||||
for x in range(terrain_map[y].size()):
|
||||
var terrain_name = terrain_map[y][x]
|
||||
if terrain_name == "grass":
|
||||
grass_cells.append(Vector2i(x, y))
|
||||
elif terrain_name == "asphalt":
|
||||
asphalt_cells.append(Vector2i(x, y))
|
||||
|
||||
# Paint grass
|
||||
if grass_cells.size() > 0:
|
||||
$Ground.set_cells_terrain_connect(grass_cells, terrain_set_index, 0)
|
||||
# Paint asphalt
|
||||
if asphalt_cells.size() > 0:
|
||||
for x in range(asphalt_cells.size()):
|
||||
for y in range(asphalt_cells.size()):
|
||||
if terrain_map[x][y] == "asphalt":
|
||||
$Roads.set_cell(Vector2i(x, y), 1, Vector2i(9, 16))
|
||||
|
||||
1
procedural_map.gd.uid
Normal file
1
procedural_map.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ch84gxwetfvk3
|
||||
@@ -15,17 +15,25 @@ run/main_scene="uid://d05j5yuhlsxp0"
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
CameraControl="*res://addons/smartcamera2D/CameraControl.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=800
|
||||
window/size/viewport_height=450
|
||||
window/size/initial_position_type=3
|
||||
window/size/initial_screen=1
|
||||
window/size/no_focus=true
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="TurnBasedStrategyGame"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PackedStringArray("res://addons/smartcamera2D/plugin.cfg")
|
||||
|
||||
[input]
|
||||
|
||||
MoveUp={
|
||||
|
||||
Reference in New Issue
Block a user