Tileset updated

This commit is contained in:
DIvan2000 2024-12-06 21:03:26 +04:00
parent d24df6511e
commit 0db30fb0fb
10 changed files with 770 additions and 753 deletions

BIN
assets/Sprite-0001.aseprite Normal file

Binary file not shown.

BIN
assets/moonbase.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ws7nut2tt600"
path="res://.godot/imported/moonbase.png-523666d101e661dad97cf1aea4405702.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/moonbase.png"
dest_files=["res://.godot/imported/moonbase.png-523666d101e661dad97cf1aea4405702.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.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/tileset.xcf Normal file

Binary file not shown.

27
blueprint.gdshader Normal file
View File

@ -0,0 +1,27 @@
shader_type canvas_item;
uniform vec4 line_color : source_color = vec4(1);
uniform float line_thickness : hint_range(0, 10) = 1.0;
const vec2 OFFSETS[8] = {
vec2(-1, -1), vec2(-1, 0), vec2(-1, 1), vec2(0, -1), vec2(0, 1),
vec2(1, -1), vec2(1, 0), vec2(1, 1)
};
void fragment() {
vec2 size = TEXTURE_PIXEL_SIZE * line_thickness / 2.0;
vec4 color = texture(TEXTURE, UV);
float inline = 1.0;
float outline = 0.0;
for (int i = 0; i < OFFSETS.length(); i++) {
float sample = texture(TEXTURE, UV + size * OFFSETS[i]).a;
outline += sample;
inline *= sample;
}
outline = min(1.0, outline) - color.a;
inline = (1.0 - inline) * color.a;
vec4 outlined_result = mix(color, line_color, outline + inline);
COLOR = mix(vec4(0,0,0,1), outlined_result, outlined_result.a);
}

0
export_presets.cfg Normal file
View File

View File

@ -15,6 +15,13 @@ run/main_scene="res://world.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility") config/features=PackedStringArray("4.3", "GL Compatibility")
config/icon="res://assets/icon.svg" config/icon="res://assets/icon.svg"
[display]
window/size/viewport_width=1024
window/size/viewport_height=1024
window/stretch/mode="canvas_items"
window/stretch/aspect="keep_width"
[dotnet] [dotnet]
project/assembly_name="TestProject" project/assembly_name="TestProject"

View File

@ -1,8 +1,12 @@
extends Node2D extends Node2D
# Переменная для хранения ссылки на TileMap # Переменная для хранения ссылки на TileMap
@onready var tilemap: TileMapLayer = $TileMapLayer @onready var buildings: TileMapLayer = $TileMap/buildings
var is_drawing: bool = false # Флаг для отслеживания зажатия кнопки мыши @onready var roads: TileMapLayer = $TileMap/roads
@onready var ground: TileMapLayer = $TileMap/ground
var is_drawing_road: bool = false # Флаг для отслеживания зажатия кнопки мыши
var is_drawing_mountian: bool = false # Флаг для отслеживания зажатия кнопки мыши
func _ready(): func _ready():
pass pass
@ -11,12 +15,18 @@ func _input(event):
if event is InputEventMouseButton: if event is InputEventMouseButton:
# Проверяем нажатие или отпускание левой кнопки мыши # Проверяем нажатие или отпускание левой кнопки мыши
if event.button_index == MOUSE_BUTTON_LEFT: if event.button_index == MOUSE_BUTTON_LEFT:
is_drawing = event.pressed # Устанавливаем флаг, если кнопка нажата is_drawing_road = event.pressed # Устанавливаем флаг, если кнопка нажата
elif event.button_index == MOUSE_BUTTON_RIGHT:
is_drawing_mountian = event.pressed # Устанавливаем флаг, если кнопка нажата
if event is InputEventMouseMotion and is_drawing: if event is InputEventMouseMotion and is_drawing_road:
# Получаем позицию мыши в мировых координатах # Получаем позицию мыши в мировых координатах
var current_tile:Vector2 = tilemap.local_to_map(get_global_mouse_position()-tilemap.global_position) var current_tile:Vector2 = ground.local_to_map(get_global_mouse_position()-$TileMap.global_position)
var tile_pos = tilemap.map_to_local(current_tile) if buildings.get_cell_source_id(current_tile) == -1:
tilemap.set_cells_terrain_connect([current_tile], 0, 2, true) roads.set_cells_terrain_connect([current_tile], 0, 2, true)
# Преобразуем в координаты тайлов
# Устанавливаем тайл (tile_id = 1 в данном случае) if event is InputEventMouseMotion and is_drawing_mountian:
# Получаем позицию мыши в мировых координатах
var current_tile:Vector2 = ground.local_to_map(get_global_mouse_position()-$TileMap.global_position)
roads.set_cells_terrain_connect([current_tile], 0, -1, true)
buildings.set_cells_terrain_connect([current_tile], 0, 1, true)

1427
world.tscn

File diff suppressed because one or more lines are too long