Using tilemaplayer as grid

This commit is contained in:
gdz
2025-12-22 17:35:13 +01:00
parent 67b6198412
commit 6e1a9eff35
10 changed files with 147 additions and 22 deletions

View File

@@ -3,7 +3,7 @@
<CLASSES /> <CLASSES />
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="file://$APPLICATION_PLUGINS_DIR$/GdScript/extracted/4.4.1" /> <root url="file://$APPLICATION_PLUGINS_DIR$/GdScript/extracted/Master" />
</SOURCES> </SOURCES>
</library> </library>
</component> </component>

View File

@@ -7,7 +7,7 @@ class_name Grid
# The of a cell in pixels # The of a cell in pixels
@export var cellSize := Vector2(16, 16) @export var cellSize := Vector2(16, 16)
@export var cameraPosition := Vector2.ONE @export var cameraPosition := Vector2.ZERO
func setCameraPosition(pos: Vector2): func setCameraPosition(pos: Vector2):
cameraPosition = pos cameraPosition = pos
@export var cameraZoom := Vector2(2, 2) @export var cameraZoom := Vector2(2, 2)
@@ -24,14 +24,22 @@ var _halfCellSize: Vector2 = cellSize / 2
# Returns the position of a cell's center in pixels. # Returns the position of a cell's center in pixels.
# We'll place units and have them move through cells using this function. # We'll place units and have them move through cells using this function.
# Example:
# cellSize = (32)
# gridPosition = (2, 3)
# cameraZoom = 1
# (2,3) * 32 + 16
# (64, 96) + 16
# == (80, 112) <- This is the position ON THE SCREEN.
func calculateMapPosition(gridPosition: Vector2) -> Vector2: func calculateMapPosition(gridPosition: Vector2) -> Vector2:
return cameraPosition + (gridPosition * cellSize + _halfCellSize) / cameraZoom return (gridPosition * cellSize + _halfCellSize) / cameraZoom
# Returns the coordinates of the cell on the grid given a position on the map. # Returns the coordinates of the cell on the grid given a position on the map.
# This is the complementary of `calculate_map_position()` above. # This is the complementary of `calculate_map_position()` above.
# When designing a level, you'll place units visually in the editor. We'll use this function to find # When designing a level, you'll place units visually in the editor. We'll use this function to find
# the grid coordinates they're placed on, and call `calculate_map_position()` to snap them to the # the grid coordinates they're placed on, and call `calculate_map_position()` to snap them to the
# cell's center. # cell's center.
# This is the position IN THE GRID
func calculateGridCoordinates(mapPosition: Vector2) -> Vector2: func calculateGridCoordinates(mapPosition: Vector2) -> Vector2:
return (mapPosition / cellSize).floor() return (mapPosition / cellSize).floor()

View File

@@ -50,11 +50,21 @@ separation = Vector2i(1, 1)
5:0/0/terrain = 0 5:0/0/terrain = 0
5:0/0/terrains_peering_bit/right_side = 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_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 = 0
6:0/0/terrain_set = 0 6:0/0/terrain_set = 0
6:0/0/terrain = 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/bottom_side = 0
6:0/0/terrains_peering_bit/left_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 = 0
7:0/0/terrain_set = 0 7:0/0/terrain_set = 0
7:0/0/terrain = 0 7:0/0/terrain = 0
@@ -63,34 +73,52 @@ separation = Vector2i(1, 1)
8:0/0/terrain_set = 0 8:0/0/terrain_set = 0
8:0/0/terrain = 3 8:0/0/terrain = 3
8:0/0/terrains_peering_bit/right_side = 3 8:0/0/terrains_peering_bit/right_side = 3
8:0/0/terrains_peering_bit/bottom_right_corner = 3
8:0/0/terrains_peering_bit/bottom_side = 3 8:0/0/terrains_peering_bit/bottom_side = 3
9:0/0 = 0 9:0/0 = 0
9:0/0/terrain_set = 0 9:0/0/terrain_set = 0
9:0/0/terrain = 3 9:0/0/terrain = 3
9:0/0/terrains_peering_bit/right_side = 3 9:0/0/terrains_peering_bit/right_side = 3
9:0/0/terrains_peering_bit/bottom_right_corner = 3
9:0/0/terrains_peering_bit/bottom_side = 3 9:0/0/terrains_peering_bit/bottom_side = 3
9:0/0/terrains_peering_bit/bottom_left_corner = 3
9:0/0/terrains_peering_bit/left_side = 3 9:0/0/terrains_peering_bit/left_side = 3
10:0/0 = 0 10:0/0 = 0
10:0/0/terrain_set = 0 10:0/0/terrain_set = 0
10:0/0/terrain = 3 10:0/0/terrain = 3
10:0/0/terrains_peering_bit/bottom_side = 3 10:0/0/terrains_peering_bit/bottom_side = 3
10:0/0/terrains_peering_bit/bottom_left_corner = 3
10:0/0/terrains_peering_bit/left_side = 3 10:0/0/terrains_peering_bit/left_side = 3
11:0/0 = 0 11:0/0 = 0
11:0/0/terrain_set = 0 11:0/0/terrain_set = 0
11:0/0/terrain = 3
11:0/0/terrains_peering_bit/right_side = 3 11:0/0/terrains_peering_bit/right_side = 3
11:0/0/terrains_peering_bit/bottom_side = 3 11:0/0/terrains_peering_bit/bottom_side = 3
12:0/0 = 0 12:0/0 = 0
12:0/0/terrain_set = 0 12:0/0/terrain_set = 0
12:0/0/terrain = 3
12:0/0/terrains_peering_bit/bottom_side = 3 12:0/0/terrains_peering_bit/bottom_side = 3
12:0/0/terrains_peering_bit/left_side = 3 12:0/0/terrains_peering_bit/left_side = 3
13:0/0 = 0 13:0/0 = 0
13:0/0/terrain_set = 0 13:0/0/terrain_set = 0
13:0/0/terrain = 3
13:0/0/terrains_peering_bit/right_side = 3 13:0/0/terrains_peering_bit/right_side = 3
13:0/0/terrains_peering_bit/bottom_side = 3 13:0/0/terrains_peering_bit/bottom_side = 3
13:0/0/terrains_peering_bit/bottom_left_corner = 3
13:0/0/terrains_peering_bit/left_side = 3
13:0/0/terrains_peering_bit/top_left_corner = 3
13:0/0/terrains_peering_bit/top_side = 3
13:0/0/terrains_peering_bit/top_right_corner = 3
14:0/0 = 0 14:0/0 = 0
14:0/0/terrain_set = 0 14:0/0/terrain_set = 0
14:0/0/terrain = 3
14:0/0/terrains_peering_bit/right_side = 3
14:0/0/terrains_peering_bit/bottom_right_corner = 3
14:0/0/terrains_peering_bit/bottom_side = 3 14:0/0/terrains_peering_bit/bottom_side = 3
14:0/0/terrains_peering_bit/left_side = 3 14:0/0/terrains_peering_bit/left_side = 3
14:0/0/terrains_peering_bit/top_left_corner = 3
14:0/0/terrains_peering_bit/top_side = 3
14:0/0/terrains_peering_bit/top_right_corner = 3
15:0/0 = 0 15:0/0 = 0
15:0/0/terrain_set = 0 15:0/0/terrain_set = 0
15:0/0/terrain = 3 15:0/0/terrain = 3
@@ -147,12 +175,22 @@ separation = Vector2i(1, 1)
5:1/0/terrain_set = 0 5:1/0/terrain_set = 0
5:1/0/terrain = 0 5:1/0/terrain = 0
5:1/0/terrains_peering_bit/right_side = 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 5:1/0/terrains_peering_bit/top_side = 0
6:1/0 = 0 6:1/0 = 0
6:1/0/terrain_set = 0 6:1/0/terrain_set = 0
6:1/0/terrain = 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/left_side = 0
6:1/0/terrains_peering_bit/top_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 = 0
7:1/0/terrain_set = 0 7:1/0/terrain_set = 0
7:1/0/terrain = 0 7:1/0/terrain = 0
@@ -162,37 +200,59 @@ separation = Vector2i(1, 1)
8:1/0/terrain_set = 0 8:1/0/terrain_set = 0
8:1/0/terrain = 3 8:1/0/terrain = 3
8:1/0/terrains_peering_bit/right_side = 3 8:1/0/terrains_peering_bit/right_side = 3
8:1/0/terrains_peering_bit/bottom_right_corner = 3
8:1/0/terrains_peering_bit/bottom_side = 3 8:1/0/terrains_peering_bit/bottom_side = 3
8:1/0/terrains_peering_bit/top_side = 3 8:1/0/terrains_peering_bit/top_side = 3
8:1/0/terrains_peering_bit/top_right_corner = 3
9:1/0 = 0 9:1/0 = 0
9:1/0/terrain_set = 0 9:1/0/terrain_set = 0
9:1/0/terrain = 3 9:1/0/terrain = 3
9:1/0/terrains_peering_bit/right_side = 3 9:1/0/terrains_peering_bit/right_side = 3
9:1/0/terrains_peering_bit/bottom_right_corner = 3
9:1/0/terrains_peering_bit/bottom_side = 3 9:1/0/terrains_peering_bit/bottom_side = 3
9:1/0/terrains_peering_bit/bottom_left_corner = 3
9:1/0/terrains_peering_bit/left_side = 3 9:1/0/terrains_peering_bit/left_side = 3
9:1/0/terrains_peering_bit/top_left_corner = 3
9:1/0/terrains_peering_bit/top_side = 3 9:1/0/terrains_peering_bit/top_side = 3
9:1/0/terrains_peering_bit/top_right_corner = 3
10:1/0 = 0 10:1/0 = 0
10:1/0/terrain_set = 0 10:1/0/terrain_set = 0
10:1/0/terrain = 3 10:1/0/terrain = 3
10:1/0/terrains_peering_bit/bottom_side = 3 10:1/0/terrains_peering_bit/bottom_side = 3
10:1/0/terrains_peering_bit/bottom_left_corner = 3
10:1/0/terrains_peering_bit/left_side = 3 10:1/0/terrains_peering_bit/left_side = 3
10:1/0/terrains_peering_bit/top_left_corner = 3
10:1/0/terrains_peering_bit/top_side = 3 10:1/0/terrains_peering_bit/top_side = 3
11:1/0 = 0 11:1/0 = 0
11:1/0/terrain_set = 0 11:1/0/terrain_set = 0
11:1/0/terrain = 3
11:1/0/terrains_peering_bit/right_side = 3 11:1/0/terrains_peering_bit/right_side = 3
11:1/0/terrains_peering_bit/top_side = 3 11:1/0/terrains_peering_bit/top_side = 3
12:1/0 = 0 12:1/0 = 0
12:1/0/terrain_set = 0 12:1/0/terrain_set = 0
12:1/0/terrain = 3
12:1/0/terrains_peering_bit/left_side = 3 12:1/0/terrains_peering_bit/left_side = 3
12:1/0/terrains_peering_bit/top_side = 3 12:1/0/terrains_peering_bit/top_side = 3
13:1/0 = 0 13:1/0 = 0
13:1/0/terrain_set = 0 13:1/0/terrain_set = 0
13:1/0/terrain = 3
13:1/0/terrains_peering_bit/right_side = 3 13:1/0/terrains_peering_bit/right_side = 3
13:1/0/terrains_peering_bit/bottom_right_corner = 3
13:1/0/terrains_peering_bit/bottom_side = 3
13:1/0/terrains_peering_bit/bottom_left_corner = 3
13:1/0/terrains_peering_bit/left_side = 3
13:1/0/terrains_peering_bit/top_left_corner = 3
13:1/0/terrains_peering_bit/top_side = 3 13:1/0/terrains_peering_bit/top_side = 3
14:1/0 = 0 14:1/0 = 0
14:1/0/terrain_set = 0 14:1/0/terrain_set = 0
14:1/0/terrain = 3
14:1/0/terrains_peering_bit/right_side = 3
14:1/0/terrains_peering_bit/bottom_right_corner = 3
14:1/0/terrains_peering_bit/bottom_side = 3
14:1/0/terrains_peering_bit/bottom_left_corner = 3
14:1/0/terrains_peering_bit/left_side = 3 14:1/0/terrains_peering_bit/left_side = 3
14:1/0/terrains_peering_bit/top_side = 3 14:1/0/terrains_peering_bit/top_side = 3
14:1/0/terrains_peering_bit/top_right_corner = 3
15:1/0 = 0 15:1/0 = 0
15:1/0/terrain_set = 0 15:1/0/terrain_set = 0
15:1/0/terrain = 3 15:1/0/terrain = 3
@@ -254,16 +314,20 @@ separation = Vector2i(1, 1)
8:2/0/terrain = 3 8:2/0/terrain = 3
8:2/0/terrains_peering_bit/right_side = 3 8:2/0/terrains_peering_bit/right_side = 3
8:2/0/terrains_peering_bit/top_side = 3 8:2/0/terrains_peering_bit/top_side = 3
8:2/0/terrains_peering_bit/top_right_corner = 3
9:2/0 = 0 9:2/0 = 0
9:2/0/terrain_set = 0 9:2/0/terrain_set = 0
9:2/0/terrain = 3 9:2/0/terrain = 3
9:2/0/terrains_peering_bit/right_side = 3 9:2/0/terrains_peering_bit/right_side = 3
9:2/0/terrains_peering_bit/left_side = 3 9:2/0/terrains_peering_bit/left_side = 3
9:2/0/terrains_peering_bit/top_left_corner = 3
9:2/0/terrains_peering_bit/top_side = 3 9:2/0/terrains_peering_bit/top_side = 3
9:2/0/terrains_peering_bit/top_right_corner = 3
10:2/0 = 0 10:2/0 = 0
10:2/0/terrain_set = 0 10:2/0/terrain_set = 0
10:2/0/terrain = 3 10:2/0/terrain = 3
10:2/0/terrains_peering_bit/left_side = 3 10:2/0/terrains_peering_bit/left_side = 3
10:2/0/terrains_peering_bit/top_left_corner = 3
10:2/0/terrains_peering_bit/top_side = 3 10:2/0/terrains_peering_bit/top_side = 3
11:2/0 = 0 11:2/0 = 0
11:2/0/terrain_set = 0 11:2/0/terrain_set = 0
@@ -274,7 +338,6 @@ separation = Vector2i(1, 1)
12:2/0/terrain = 3 12:2/0/terrain = 3
12:2/0/terrains_peering_bit/right_side = 3 12:2/0/terrains_peering_bit/right_side = 3
12:2/0/terrains_peering_bit/left_side = 3 12:2/0/terrains_peering_bit/left_side = 3
12:2/0/terrains_peering_bit/top_side = 3
13:2/0 = 0 13:2/0 = 0
13:2/0/terrain_set = 0 13:2/0/terrain_set = 0
13:2/0/terrain = 3 13:2/0/terrain = 3
@@ -944,6 +1007,7 @@ terrain_set_0/terrain_3/name = "Pavement"
terrain_set_0/terrain_3/color = Color(0.835294, 0.831373, 0.870588, 1) terrain_set_0/terrain_3/color = Color(0.835294, 0.831373, 0.870588, 1)
terrain_set_0/terrain_4/name = "Roof_1" terrain_set_0/terrain_4/name = "Roof_1"
terrain_set_0/terrain_4/color = Color(0.886275, 0.870588, 0.811765, 1) terrain_set_0/terrain_4/color = Color(0.886275, 0.870588, 0.811765, 1)
navigation_layer_0/layers = 1
sources/1 = SubResource("TileSetAtlasSource_vqaso") sources/1 = SubResource("TileSetAtlasSource_vqaso")
pattern_0 = SubResource("TileMapPattern_vrbvq") pattern_0 = SubResource("TileMapPattern_vrbvq")
pattern_1 = SubResource("TileMapPattern_07llt") pattern_1 = SubResource("TileMapPattern_07llt")

View File

@@ -31,17 +31,24 @@ var cell := Vector2.ZERO:
# a signal, and start the cooldown timer that will limit the rate # a signal, and start the cooldown timer that will limit the rate
# at which the cursor moves when we keep the direction key held # at which the cursor moves when we keep the direction key held
# down # down
position = grid.calculateMapPosition(cell) # global_position = grid.calculateMapPosition(cell)
global_position = GroundLayer.map_to_local(cell)
print("Position is ", position) print("Position is ", position)
emit_signal("moved", cell) emit_signal("moved", cell)
_timer.start() _timer.start()
@onready var _timer: Timer = $Timer @onready var _timer: Timer = $Timer
@onready var Map: Node = $"../../Map"
@onready var GroundLayer: TileMapLayer = $"../../Map/Ground"
func _ready() -> void: func _ready() -> void:
# Map = get_parent().get_parent().get_node("Map")
# GroundLayer = Map.get_node("Ground")
#
_timer.wait_time = ui_cooldown _timer.wait_time = ui_cooldown
position = grid.calculateMapPosition(cell) #position = grid.calculateMapPosition(cell)
position = GroundLayer.map_to_local(cell)
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:

16
Scenes/Main/grid_debug.gd Normal file
View File

@@ -0,0 +1,16 @@
extends Node2D
@export var grid: Resource
func _drawO():
var gridSize = grid.size
var cellSize = grid.cellSize
var rectSize: Vector2 = Vector2(float(cellSize), float(cellSize))
var rectPos: Vector2 = Vector2.ZERO
for x in range(gridSize.x):
for y in range(gridSize.y):
rectPos = Vector2(x, y)
var cellRect := Rect2(rectPos, rectSize)
draw_rect(cellRect, Color.ALICE_BLUE, false, 2.0)

View File

@@ -0,0 +1 @@
uid://dukn3yshfepum

View File

@@ -1,5 +1,7 @@
extends Node extends Node
@export var grid: Resource
@onready var _Map: Node = $Map @onready var _Map: Node = $Map
@onready var _Camera = $CameraController @onready var _Camera = $CameraController
@@ -12,17 +14,29 @@ var _MovingMarkerScene = preload("res://Scenes/Unit/marker.tscn")
var _MovingMarker: Node2D = _MovingMarkerScene.instantiate() var _MovingMarker: Node2D = _MovingMarkerScene.instantiate()
#@export var mapSize: int = 15 #@export var mapSize: int = 15
@onready var UnitCamera: SmartCamera2D = $SmartCamera2D
@onready var GroundLayer: TileMapLayer = $Map/Ground
# 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() -> void: func _ready() -> void:
# add_child(_MovingMarker) # add_child(_MovingMarker)
# _MovingMarker.hide() # _MovingMarker.hide()
# #
# _createUnit(Vector2i(10,10)) # create unit at local position (50, 50) => eg mouse position
# for unit in _Units: _createUnit(GroundLayer.local_to_map(Vector2i(50, 50)))
# add_child(unit) # create unit at map position (50, 50) => tile x = 50, y = 50 in the map
_createUnit(GroundLayer.map_to_local(Vector2i(50,50)))
for unit in _Units:
add_child(unit)
# $CameraController.position = get_viewport().get_camera_2d().get_screen_center_position()
var firstUnit: Node2D = _Units[0]
# if firstUnit.is_node_ready():
# UnitCamera.target = _Units[0].get_path_to(get_parent())
# UnitCamera.target_node = _Units[0]
$CameraController.position = get_viewport().get_camera_2d().get_screen_center_position()
pass pass
@@ -38,7 +52,8 @@ func _createUnit(pos: Vector2i):
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event.is_action_pressed("SetMarker"): if event.is_action_pressed("SetMarker"):
print("Action is SetMarker") print("Action is SetMarker")
_MovingMarker.global_position = _getMousePosition(event).position # _MovingMarker.global_position = _getMousePosition(event).position
_MovingMarker.position = GroundLayer.local_to_map(event.position)
_MovingMarker.show() _MovingMarker.show()

View File

@@ -1,30 +1,37 @@
[gd_scene load_steps=9 format=3 uid="uid://d05j5yuhlsxp0"] [gd_scene load_steps=10 format=3 uid="uid://d05j5yuhlsxp0"]
[ext_resource type="PackedScene" uid="uid://cywuuce71rmgb" path="res://Scenes/Map/map.tscn" id="1_1r6ip"] [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="Script" uid="uid://btdvxp8ckmeb3" path="res://Scenes/Main/main.gd" id="1_qw60k"]
[ext_resource type="PackedScene" uid="uid://bfvijh611aggp" path="res://Scenes/Camera/camera_controller.tscn" id="3_qw60k"]
[ext_resource type="Script" uid="uid://14cwbxcvt5dx" path="res://Scenes/Main/game_board.gd" id="4_5yls4"] [ext_resource type="Script" uid="uid://14cwbxcvt5dx" path="res://Scenes/Main/game_board.gd" id="4_5yls4"]
[ext_resource type="Resource" uid="uid://bpf7mj7w5kftq" path="res://Resource/Grid.tres" id="5_p6jpk"] [ext_resource type="Resource" uid="uid://bpf7mj7w5kftq" path="res://Resource/Grid.tres" id="5_p6jpk"]
[ext_resource type="Script" uid="uid://dukn3yshfepum" path="res://Scenes/Main/grid_debug.gd" id="5_y3v7k"]
[ext_resource type="PackedScene" uid="uid://b1d6lktijxy3s" path="res://Scenes/Unit/move/unit.tscn" id="6_2a143"] [ext_resource type="PackedScene" uid="uid://b1d6lktijxy3s" path="res://Scenes/Unit/move/unit.tscn" id="6_2a143"]
[ext_resource type="Script" uid="uid://cidjtc27oj1gn" path="res://Scenes/Main/cursor.gd" id="7_y3v7k"] [ext_resource type="Script" uid="uid://cidjtc27oj1gn" path="res://Scenes/Main/cursor.gd" id="7_y3v7k"]
[ext_resource type="Texture2D" uid="uid://bckknh8k5fh1s" path="res://Graphics/TileMaps/kenney_rpgUrbanKit/Tiles/tile_0448.png" id="8_hryqi"] [ext_resource type="Texture2D" uid="uid://bckknh8k5fh1s" path="res://Graphics/TileMaps/kenney_rpgUrbanKit/Tiles/tile_0448.png" id="8_hryqi"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_y3v7k"]
[node name="Main" type="Node"] [node name="Main" type="Node"]
script = ExtResource("1_qw60k") script = ExtResource("1_qw60k")
grid = ExtResource("5_p6jpk")
[node name="Map" parent="." instance=ExtResource("1_1r6ip")] [node name="Map" parent="." instance=ExtResource("1_1r6ip")]
[node name="CameraController" parent="." instance=ExtResource("3_qw60k")]
grid = ExtResource("5_p6jpk")
[node name="GameBoard" type="Node2D" parent="."] [node name="GameBoard" type="Node2D" parent="."]
script = ExtResource("4_5yls4") script = ExtResource("4_5yls4")
grid = ExtResource("5_p6jpk") grid = ExtResource("5_p6jpk")
[node name="GridDebug" type="Node2D" parent="GameBoard"]
script = ExtResource("5_y3v7k")
grid = ExtResource("5_p6jpk")
[node name="Unit" parent="GameBoard" instance=ExtResource("6_2a143")] [node name="Unit" parent="GameBoard" instance=ExtResource("6_2a143")]
visible = false
position = Vector2(400, 224)
grid = ExtResource("5_p6jpk") grid = ExtResource("5_p6jpk")
[node name="Cursor" type="Node2D" parent="GameBoard"] [node name="Cursor" type="Node2D" parent="GameBoard"]
position = Vector2(8, 8)
script = ExtResource("7_y3v7k") script = ExtResource("7_y3v7k")
grid = ExtResource("5_p6jpk") grid = ExtResource("5_p6jpk")
@@ -35,4 +42,7 @@ texture = ExtResource("8_hryqi")
[node name="Timer" type="Timer" parent="GameBoard/Cursor"] [node name="Timer" type="Timer" parent="GameBoard/Cursor"]
wait_time = 0.1 wait_time = 0.1
[editable path="CameraController"] [node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(50, 50)
scale = Vector2(2, 2)
texture = SubResource("PlaceholderTexture2D_y3v7k")

File diff suppressed because one or more lines are too long

View File

@@ -12,7 +12,7 @@ config_version=5
config/name="TurnBasedStrategyGame" config/name="TurnBasedStrategyGame"
run/main_scene="uid://d05j5yuhlsxp0" run/main_scene="uid://d05j5yuhlsxp0"
config/features=PackedStringArray("4.4", "GL Compatibility") config/features=PackedStringArray("4.5", "GL Compatibility")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[autoload] [autoload]