summaryrefslogtreecommitdiff
path: root/BuildGrid.gd
blob: e7d3149ba027ea8d8ad1b34640167fc9dc7d313d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
extends Node2D


var map: TileMapLayer


func _ready():
	Game.mode_changed.connect(func():
		queue_redraw()
	)
	
	map = get_parent().get_node("Layer0") as TileMapLayer

func _draw():
	if Game.mode == Game.Mode.BUILD:
		var area = map.get_used_rect()
		#area = area.grow_individual(0, 0, area.size.x, area.size.y)
		var cell_size = map.tile_set.tile_size #/ 2
		#draw_rect(
			#Rect2(0, 0, area.size.x * cell_size.x, area.size.y * cell_size.y),
			#Color("#ffffff"),
			#false,
			#1.0
		#)
		#for row in range(area.size.x):
			#for column in range(area.size.y):
				#draw_rect(
					#Rect2(row * cell_size.x, column * cell_size.y, cell_size.x, cell_size.y),
					#Color("#fffffhttps://challonge.com/smash_nes_2024f"),
					#false,
					#1.0
				#)
		for row in range(0, area.size.y + 1):
			draw_line(
				Vector2(0, row * cell_size.y),
				Vector2(area.size.x * cell_size.x, row * cell_size.y),
				Color(1, 1, 1, 0.25),
				1.0
			)
		for column in range(0, area.size.x + 1):
			draw_line(
				Vector2(column * cell_size.x, 0),
				Vector2(column * cell_size.x, area.size.y * cell_size.y),
				Color(1, 1, 1, 0.25),
				1.0
			)