Initial isometric testing
This commit is contained in:
parent
61d2058ea9
commit
735ce9f8b1
50
Scenes/node_2d.tscn
Normal file
50
Scenes/node_2d.tscn
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
[gd_scene load_steps=5 format=3 uid="uid://m70jvfin8k5p"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://coywpm8aqsltx" path="res://Sprites/iso_tileset.png" id="1_glwto"]
|
||||||
|
[ext_resource type="Script" path="res://Scripts/Ground.gd" id="2_s3ob6"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_pt4t4"]
|
||||||
|
texture = ExtResource("1_glwto")
|
||||||
|
texture_region_size = Vector2i(32, 32)
|
||||||
|
0:0/0 = 0
|
||||||
|
0:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
1:0/0 = 0
|
||||||
|
1:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
2:0/0 = 0
|
||||||
|
2:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
3:0/0 = 0
|
||||||
|
3:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
4:0/0 = 0
|
||||||
|
4:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
5:0/0 = 0
|
||||||
|
5:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
6:0/0 = 0
|
||||||
|
6:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_08ndw"]
|
||||||
|
tile_shape = 1
|
||||||
|
tile_layout = 5
|
||||||
|
tile_offset_axis = 1
|
||||||
|
tile_size = Vector2i(32, 16)
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_pt4t4")
|
||||||
|
|
||||||
|
[node name="Node2D" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
|
y_sort_enabled = true
|
||||||
|
tile_set = SubResource("TileSet_08ndw")
|
||||||
|
format = 2
|
||||||
|
layer_0/name = "layer0"
|
||||||
|
layer_0/y_sort_enabled = true
|
||||||
|
layer_0/tile_data = PackedInt32Array(5, 131072, 0, 6, 131072, 0, 65542, 131072, 0, 65543, 131072, 0, 131080, 131072, 0, 65544, 131072, 0, 65545, 131072, 0, 65546, 131072, 0, 65547, 131072, 0, 65548, 131072, 0, 65549, 131072, 0, 65550, 131072, 0, 131086, 131072, 0, 14, 131072, 0, 13, 131072, 0, -65523, 131072, 0, -65524, 0, 0, -65525, 0, 0, 11, 0, 0, 10, 0, 0, 7, 131072, 0, 8, 131072, 0, 9, 131072, 0, 12, 0, 0, -65527, 131072, 0, -65528, 131072, 0, -65530, 131072, 0, -65529, 131072, 0, -131062, 0, 0, -131061, 131072, 0, -131060, 131072, 0, -131063, 0, 0, -131064, 131072, 0, -131065, 131072, 0, -131066, 131072, 0, -196601, 131072, 0, -262137, 131072, 0, -262136, 131072, 0, -196600, 131072, 0, -196599, 131072, 0, -196598, 131072, 0, -262133, 131072, 0, -196597, 131072, 0, -262135, 131072, 0, -262132, 131072, 0, -196596, 131072, 0, -262134, 131072, 0, -65526, 0, 0, 393227, 131072, 0, 458763, 131072, 0, 458764, 131072, 0, 524300, 131072, 0, 524301, 131072, 0, 524302, 131072, 0, 589839, 131072, 0, 589840, 131072, 0, 524303, 131072, 0, 458766, 131072, 0, 458765, 131072, 0, 393228, 131072, 0, 393226, 131072, 0, 458762, 131072, 0, 524298, 131072, 0, 589834, 131072, 0, 655371, 131072, 0, 655372, 131072, 0, 655373, 131072, 0, 655374, 131072, 0, 655375, 131072, 0, 589838, 131072, 0, 589835, 131072, 0, 720908, 131072, 0, 720909, 131072, 0, 589837, 131072, 0, 589836, 131072, 0, 524299, 131072, 0, 327691, 327680, 0, 262155, 327680, 0, 196619, 327680, 0, 131083, 327680, 0)
|
||||||
|
layer_1/name = "layer1"
|
||||||
|
layer_1/y_sort_enabled = true
|
||||||
|
layer_1/y_sort_origin = 1
|
||||||
|
layer_1/z_index = 1
|
||||||
|
layer_1/tile_data = PackedInt32Array(-131065, 65536, 0)
|
||||||
|
layer_2/name = "layer2"
|
||||||
|
layer_2/y_sort_enabled = true
|
||||||
|
layer_2/y_sort_origin = 2
|
||||||
|
layer_2/z_index = 2
|
||||||
|
layer_2/tile_data = PackedInt32Array(-196602, 393216, 0)
|
||||||
|
script = ExtResource("2_s3ob6")
|
42
Scripts/Ground.gd
Normal file
42
Scripts/Ground.gd
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# https://youtu.be/dclc8w6JW7Y?si=QSu2dwSILyatO_oa
|
||||||
|
|
||||||
|
extends TileMap
|
||||||
|
|
||||||
|
const source_atlas_blue_pos = Vector2i(0, 0)
|
||||||
|
const source_atlas_red_pos = Vector2i(1, 0)
|
||||||
|
const source_atlas_green_pos = Vector2i(2, 0)
|
||||||
|
const source_atlas_orange_pos = Vector2i(6, 0)
|
||||||
|
|
||||||
|
const source_atlas = 0
|
||||||
|
|
||||||
|
#used by the "procgen"
|
||||||
|
const source_atlas_array = [
|
||||||
|
source_atlas_blue_pos,
|
||||||
|
source_atlas_green_pos,
|
||||||
|
source_atlas_green_pos, # duplicate entry to tweak the generator
|
||||||
|
]
|
||||||
|
|
||||||
|
enum Layers {
|
||||||
|
layer0 = 0,
|
||||||
|
layer1 = 1,
|
||||||
|
layer2 = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
#for "procgen"
|
||||||
|
var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
||||||
|
rng.randomize()
|
||||||
|
|
||||||
|
for i in range(10):
|
||||||
|
for j in range(10):
|
||||||
|
var rand_tile = rng.randf_range(0, source_atlas_array.size())
|
||||||
|
set_cell(Layers.layer0, Vector2i(i + 30, j + 0), source_atlas, source_atlas_array[rand_tile], 0)
|
||||||
|
|
||||||
|
func _input(event) -> void:
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT && event.is_pressed():
|
||||||
|
var clicked_pos = local_to_map(to_local(event.position))
|
||||||
|
|
||||||
|
#place a "house" prefab
|
||||||
|
set_cell(Layers.layer1, Vector2i(clicked_pos.x - 1, clicked_pos.y - 1), source_atlas, source_atlas_red_pos, 0)
|
||||||
|
set_cell(Layers.layer2, Vector2i(clicked_pos.x - 2, clicked_pos.y - 2), source_atlas, source_atlas_orange_pos, 0)
|
BIN
Sprites/iso_tileset.png
Normal file
BIN
Sprites/iso_tileset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
34
Sprites/iso_tileset.png.import
Normal file
34
Sprites/iso_tileset.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://coywpm8aqsltx"
|
||||||
|
path="res://.godot/imported/iso_tileset.png-032ccd9f28125fd9c02ad15106aacafd.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Sprites/iso_tileset.png"
|
||||||
|
dest_files=["res://.godot/imported/iso_tileset.png-032ccd9f28125fd9c02ad15106aacafd.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
|
@ -11,6 +11,7 @@ config_version=5
|
|||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Iron-throne"
|
config/name="Iron-throne"
|
||||||
|
run/main_scene="res://Scenes/node_2d.tscn"
|
||||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user