map handling refined, map selection logic implemented
This commit is contained in:
parent
bbcb098b06
commit
48ee4b49ea
Binary file not shown.
BIN
assets/sprites/tiles/iso_tileset_with_select.png
Normal file
BIN
assets/sprites/tiles/iso_tileset_with_select.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
34
assets/sprites/tiles/iso_tileset_with_select.png.import
Normal file
34
assets/sprites/tiles/iso_tileset_with_select.png.import
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bsox4y2fftlh8"
|
||||||
|
path="res://.godot/imported/iso_tileset_with_select.png-ffd5c8774cc61a06e608c6b93e2ee00f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/sprites/tiles/iso_tileset_with_select.png"
|
||||||
|
dest_files=["res://.godot/imported/iso_tileset_with_select.png-ffd5c8774cc61a06e608c6b93e2ee00f.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
|
||||||
BIN
assets/sprites/tiles/iso_tileset_with_select.xcf
Normal file
BIN
assets/sprites/tiles/iso_tileset_with_select.xcf
Normal file
Binary file not shown.
15
scenes/debug_level.tscn
Normal file
15
scenes/debug_level.tscn
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://c87m8r007ned1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://0aqxvhvqbtr" path="res://scripts/debug_level.gd" id="1_8d50e"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dg0qxdwe2rlcn" path="res://scenes/isometric_map_layer_holder.tscn" id="1_ln2x5"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d1jhpluu86cbd" path="res://scenes/player.tscn" id="2_6or15"]
|
||||||
|
|
||||||
|
[node name="DebugLevel" type="Node2D"]
|
||||||
|
y_sort_enabled = true
|
||||||
|
script = ExtResource("1_8d50e")
|
||||||
|
|
||||||
|
[node name="IsometricMapLayerHolder" parent="." instance=ExtResource("1_ln2x5")]
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("2_6or15")]
|
||||||
|
visible = false
|
||||||
|
z_index = 99
|
||||||
@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://dg0qxdwe2rlcn"]
|
[gd_scene load_steps=7 format=3 uid="uid://dg0qxdwe2rlcn"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dxcfy8xypdde6" path="res://scripts/isometric_map_layer_holder.gd" id="1_4o54u"]
|
[ext_resource type="Script" uid="uid://dxcfy8xypdde6" path="res://scripts/isometric_map_layer_holder.gd" id="1_4o54u"]
|
||||||
[ext_resource type="Texture2D" uid="uid://p8iyle6kr3nf" path="res://assets/sprites/tiles/iso_tileset.png" id="1_fme3d"]
|
[ext_resource type="Texture2D" uid="uid://p8iyle6kr3nf" path="res://assets/sprites/tiles/iso_tileset.png" id="1_fme3d"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bsox4y2fftlh8" path="res://assets/sprites/tiles/iso_tileset_with_select.png" id="3_s16iq"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4o54u"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4o54u"]
|
||||||
texture = ExtResource("1_fme3d")
|
texture = ExtResource("1_fme3d")
|
||||||
@ -21,12 +22,61 @@ texture_region_size = Vector2i(32, 32)
|
|||||||
6:0/0 = 0
|
6:0/0 = 0
|
||||||
6:0/0/texture_origin = Vector2i(0, -8)
|
6:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wvhlo"]
|
||||||
|
texture = ExtResource("3_s16iq")
|
||||||
|
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)
|
||||||
|
7:0/0 = 0
|
||||||
|
7:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
1:1/0 = 0
|
||||||
|
1:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
4:1/0 = 0
|
||||||
|
4:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
5:1/0 = 0
|
||||||
|
5:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
6:1/0 = 0
|
||||||
|
6:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
0:2/0 = 0
|
||||||
|
1:2/0 = 0
|
||||||
|
2:2/0 = 0
|
||||||
|
3:2/0 = 0
|
||||||
|
4:2/0 = 0
|
||||||
|
5:2/0 = 0
|
||||||
|
6:2/0 = 0
|
||||||
|
0:3/0 = 0
|
||||||
|
1:3/0 = 0
|
||||||
|
2:3/0 = 0
|
||||||
|
3:3/0 = 0
|
||||||
|
4:3/0 = 0
|
||||||
|
5:3/0 = 0
|
||||||
|
6:3/0 = 0
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_s16iq"]
|
[sub_resource type="TileSet" id="TileSet_s16iq"]
|
||||||
tile_shape = 1
|
tile_shape = 1
|
||||||
tile_layout = 5
|
tile_layout = 5
|
||||||
tile_offset_axis = 1
|
tile_offset_axis = 1
|
||||||
tile_size = Vector2i(32, 16)
|
tile_size = Vector2i(32, 16)
|
||||||
sources/0 = SubResource("TileSetAtlasSource_4o54u")
|
sources/0 = SubResource("TileSetAtlasSource_4o54u")
|
||||||
|
sources/1 = SubResource("TileSetAtlasSource_wvhlo")
|
||||||
|
|
||||||
[node name="IsometricMapLayerHolder" type="Node2D"]
|
[node name="IsometricMapLayerHolder" type="Node2D"]
|
||||||
script = ExtResource("1_4o54u")
|
script = ExtResource("1_4o54u")
|
||||||
|
|||||||
171
scenes/isometric_map_layer_holder.tscn38204884929.tmp
Normal file
171
scenes/isometric_map_layer_holder.tscn38204884929.tmp
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://dg0qxdwe2rlcn"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dxcfy8xypdde6" path="res://scripts/isometric_map_layer_holder.gd" id="1_4o54u"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://p8iyle6kr3nf" path="res://assets/sprites/tiles/iso_tileset.png" id="1_fme3d"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bsox4y2fftlh8" path="res://assets/sprites/tiles/iso_tileset_with_select.png" id="3_s16iq"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_4o54u"]
|
||||||
|
texture = ExtResource("1_fme3d")
|
||||||
|
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="TileSetAtlasSource" id="TileSetAtlasSource_wvhlo"]
|
||||||
|
texture = ExtResource("3_s16iq")
|
||||||
|
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)
|
||||||
|
7:0/0 = 0
|
||||||
|
7:0/0/texture_origin = Vector2i(0, -8)
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
1:1/0 = 0
|
||||||
|
1:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
4:1/0 = 0
|
||||||
|
4:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
5:1/0 = 0
|
||||||
|
5:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
6:1/0 = 0
|
||||||
|
6:1/0/texture_origin = Vector2i(0, -8)
|
||||||
|
0:2/0 = 0
|
||||||
|
1:2/0 = 0
|
||||||
|
2:2/0 = 0
|
||||||
|
3:2/0 = 0
|
||||||
|
4:2/0 = 0
|
||||||
|
5:2/0 = 0
|
||||||
|
6:2/0 = 0
|
||||||
|
0:3/0 = 0
|
||||||
|
1:3/0 = 0
|
||||||
|
2:3/0 = 0
|
||||||
|
3:3/0 = 0
|
||||||
|
4:3/0 = 0
|
||||||
|
5:3/0 = 0
|
||||||
|
6:3/0 = 0
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_s16iq"]
|
||||||
|
tile_shape = 1
|
||||||
|
tile_layout = 5
|
||||||
|
tile_offset_axis = 1
|
||||||
|
tile_size = Vector2i(32, 16)
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_4o54u")
|
||||||
|
sources/1 = SubResource("TileSetAtlasSource_wvhlo")
|
||||||
|
|
||||||
|
[node name="IsometricMapLayerHolder" type="Node2D"]
|
||||||
|
script = ExtResource("1_4o54u")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
zoom = Vector2(0.5, 0.5)
|
||||||
|
|
||||||
|
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||||
|
tile_set = SubResource("TileSet_s16iq")
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="ResetButton" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 7
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -25.5
|
||||||
|
offset_top = -31.0
|
||||||
|
offset_right = 25.5
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
|
text = "Reset"
|
||||||
|
|
||||||
|
[node name="Z_CW" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -34.0
|
||||||
|
offset_top = -15.5
|
||||||
|
offset_bottom = 15.5
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Rotate CW Z-Axis"
|
||||||
|
|
||||||
|
[node name="Z_CCW" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_top = -15.5
|
||||||
|
offset_right = 44.0
|
||||||
|
offset_bottom = 15.5
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "Rotate CCW Z-Axis"
|
||||||
|
|
||||||
|
[node name="X_CW" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -140.0
|
||||||
|
offset_top = -31.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Rotate CW X-Axis"
|
||||||
|
|
||||||
|
[node name="X_CCW" type="Button" parent="CanvasLayer"]
|
||||||
|
offset_right = 150.0
|
||||||
|
offset_bottom = 31.0
|
||||||
|
text = "Rotate CCW X-Axis"
|
||||||
|
|
||||||
|
[node name="Y_CW" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_top = -31.0
|
||||||
|
offset_right = 139.0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Rotate CW Y-Axis"
|
||||||
|
|
||||||
|
[node name="Y_CCW" type="Button" parent="CanvasLayer"]
|
||||||
|
anchors_preset = 1
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_left = -150.0
|
||||||
|
offset_bottom = 31.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
text = "Rotate CCW Y-Axis"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="CanvasLayer/ResetButton" to="." method="_on_reset_button_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/Z_CW" to="." method="_on_cw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/Z_CCW" to="." method="_on_ccw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/X_CW" to="." method="_on_x_cw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/X_CCW" to="." method="_on_x_ccw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/Y_CW" to="." method="_on_y_cw_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/Y_CCW" to="." method="_on_y_ccw_pressed"]
|
||||||
@ -1,9 +1,7 @@
|
|||||||
[gd_scene load_steps=16 format=3 uid="uid://d1jhpluu86cbd"]
|
[gd_scene load_steps=17 format=3 uid="uid://d1jhpluu86cbd"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://d3tfo61gemayy" path="res://assets/sprites/units/$Cat_Female (2).png" id="1_3vyb7"]
|
[ext_resource type="Texture2D" uid="uid://d3tfo61gemayy" path="res://assets/sprites/units/$Cat_Female (2).png" id="1_3vyb7"]
|
||||||
|
[ext_resource type="Script" uid="uid://jfojoaymauh2" path="res://scripts/player.gd" id="1_g2els"]
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_v6fml"]
|
|
||||||
size = Vector2(36, 51)
|
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3li8b"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3li8b"]
|
||||||
atlas = ExtResource("1_3vyb7")
|
atlas = ExtResource("1_3vyb7")
|
||||||
@ -112,13 +110,18 @@ animations = [{
|
|||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_v6fml"]
|
||||||
|
size = Vector2(36, 51)
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D"]
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
script = ExtResource("1_g2els")
|
||||||
|
|
||||||
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||||
|
scale = Vector2(0.5, 0.5)
|
||||||
|
sprite_frames = SubResource("SpriteFrames_0rnld")
|
||||||
|
animation = &"down"
|
||||||
|
frame_progress = 0.830149
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
position = Vector2(0, 4.5)
|
position = Vector2(0, 4.5)
|
||||||
shape = SubResource("RectangleShape2D_v6fml")
|
shape = SubResource("RectangleShape2D_v6fml")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
|
||||||
sprite_frames = SubResource("SpriteFrames_0rnld")
|
|
||||||
animation = &"down"
|
|
||||||
frame_progress = 0.830149
|
|
||||||
|
|||||||
4
scripts/debug_level.gd
Normal file
4
scripts/debug_level.gd
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
1
scripts/debug_level.gd.uid
Normal file
1
scripts/debug_level.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://0aqxvhvqbtr
|
||||||
@ -69,7 +69,10 @@ func create_debug_map_array():
|
|||||||
"x": coord_x,
|
"x": coord_x,
|
||||||
"y": coord_y,
|
"y": coord_y,
|
||||||
"z": z,
|
"z": z,
|
||||||
"atlas_position": null,
|
"atlas_base_position": null,
|
||||||
|
"atlas_highlight_position": null,
|
||||||
|
"highlighted": false,
|
||||||
|
"selected": false,
|
||||||
"hp": 100,
|
"hp": 100,
|
||||||
"armour": 0,
|
"armour": 0,
|
||||||
"destroyable": false,
|
"destroyable": false,
|
||||||
@ -78,40 +81,47 @@ func create_debug_map_array():
|
|||||||
"gravity": null
|
"gravity": null
|
||||||
}
|
}
|
||||||
_debug_map[x][y][z] = tile_data
|
_debug_map[x][y][z] = tile_data
|
||||||
# Bottum
|
|
||||||
|
var tile = _debug_map[0][0][0]
|
||||||
for y in INITIAL_GRID_SIZE_LENGTH:
|
for y in INITIAL_GRID_SIZE_LENGTH:
|
||||||
for x in INITIAL_GRID_SIZE_WIDTH:
|
for x in INITIAL_GRID_SIZE_WIDTH:
|
||||||
var tile = _debug_map[x][y][0]
|
tile = _debug_map[x][y][0]
|
||||||
tile["atlas_position"] = BLUE_ISOMETRICTILE_ATLAS_POSITION
|
tile["atlas_base_position"] = BLUE_ISOMETRICTILE_ATLAS_POSITION
|
||||||
tile["visibility"] = true
|
tile["atlas_highlight_position"] = WHITE_ISOMETRICTILE_ATLAS_POSITION
|
||||||
# Top
|
|
||||||
for y in INITIAL_GRID_SIZE_LENGTH:
|
|
||||||
for x in INITIAL_GRID_SIZE_WIDTH:
|
|
||||||
var tile = _debug_map[x][y][INITIAL_GRID_SIZE_HEIGHT-1]
|
|
||||||
tile["atlas_position"] = BLUE_ISOMETRICTILE_ATLAS_POSITION
|
|
||||||
tile["visibility"] = true
|
tile["visibility"] = true
|
||||||
|
for i in range(1,10):
|
||||||
|
tile = _debug_map[5][5][i]
|
||||||
|
tile["atlas_base_position"] = RED_ISOMETRICTILE_ATLAS_POSITION
|
||||||
|
tile["atlas_highlight_position"] = WHITE_ISOMETRICTILE_ATLAS_POSITION
|
||||||
|
tile["visibility"] = true
|
||||||
|
|
||||||
|
# for y in INITIAL_GRID_SIZE_LENGTH:
|
||||||
|
# for x in INITIAL_GRID_SIZE_WIDTH:
|
||||||
|
# tile = _debug_map[x][y][INITIAL_GRID_SIZE_HEIGHT-1]
|
||||||
|
# tile["atlas_position"] = BLUE_ISOMETRICTILE_ATLAS_POSITION
|
||||||
|
# tile["visibility"] = true
|
||||||
|
|
||||||
for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
# for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
||||||
for x in INITIAL_GRID_SIZE_WIDTH:
|
# for x in INITIAL_GRID_SIZE_WIDTH:
|
||||||
var tile = _debug_map[x][0][z]
|
# tile = _debug_map[x][0][z]
|
||||||
tile["atlas_position"] = GREEN_ISOMETRICTILE_ATLAS_POSITION
|
# tile["atlas_position"] = GREEN_ISOMETRICTILE_ATLAS_POSITION
|
||||||
tile["visibility"] = true
|
# tile["visibility"] = true
|
||||||
for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
# for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
||||||
for x in INITIAL_GRID_SIZE_WIDTH:
|
# for x in INITIAL_GRID_SIZE_WIDTH:
|
||||||
var tile = _debug_map[x][INITIAL_GRID_SIZE_LENGTH-1][z]
|
# tile = _debug_map[x][INITIAL_GRID_SIZE_LENGTH-1][z]
|
||||||
tile["atlas_position"] = GREEN_ISOMETRICTILE_ATLAS_POSITION
|
# tile["atlas_position"] = GREEN_ISOMETRICTILE_ATLAS_POSITION
|
||||||
tile["visibility"] = true
|
# tile["visibility"] = true
|
||||||
|
|
||||||
for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
# for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
||||||
for y in range(1,INITIAL_GRID_SIZE_LENGTH-1):
|
# for y in range(1,INITIAL_GRID_SIZE_LENGTH-1):
|
||||||
var tile = _debug_map[0][y][z]
|
# tile = _debug_map[0][y][z]
|
||||||
tile["atlas_position"] = BLACK_ISOMETRICTILE_ATLAS_POSITION
|
# tile["atlas_position"] = BLACK_ISOMETRICTILE_ATLAS_POSITION
|
||||||
tile["visibility"] = true
|
# tile["visibility"] = true
|
||||||
for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
# for z in range(1,INITIAL_GRID_SIZE_HEIGHT-1):
|
||||||
for y in range(1,INITIAL_GRID_SIZE_LENGTH-1):
|
# for y in range(1,INITIAL_GRID_SIZE_LENGTH-1):
|
||||||
var tile = _debug_map[INITIAL_GRID_SIZE_WIDTH-1][y][z]
|
# tile = _debug_map[INITIAL_GRID_SIZE_WIDTH-1][y][z]
|
||||||
tile["atlas_position"] = RED_ISOMETRICTILE_ATLAS_POSITION
|
# tile["atlas_position"] = RED_ISOMETRICTILE_ATLAS_POSITION
|
||||||
tile["visibility"] = true
|
# tile["visibility"] = true
|
||||||
|
|
||||||
|
|
||||||
GRID_SIZE_WIDTH = INITIAL_GRID_SIZE_WIDTH # play area size x
|
GRID_SIZE_WIDTH = INITIAL_GRID_SIZE_WIDTH # play area size x
|
||||||
@ -357,9 +367,78 @@ func draw_visible_tiles():
|
|||||||
isometric_map_layers[z].set_cell(
|
isometric_map_layers[z].set_cell(
|
||||||
Vector2i(tile["x"], tile["y"]),
|
Vector2i(tile["x"], tile["y"]),
|
||||||
MAIN_SOURCE_ID,
|
MAIN_SOURCE_ID,
|
||||||
tile["atlas_position"]
|
tile["atlas_base_position"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
var highlighted_tiles = {} # Dictionary to store all currently highlighted tiles
|
||||||
|
|
||||||
|
func isometric_grid_hover():
|
||||||
|
var hover_tile_position = isometric_map_layers[0].local_to_map(get_global_mouse_position())
|
||||||
|
var new_highlighted_tiles = {} # Will store tiles to highlight this frame
|
||||||
|
|
||||||
|
# First find all tiles that should be highlighted
|
||||||
|
for z in GRID_SIZE_HEIGHT:
|
||||||
|
for x in GRID_SIZE_WIDTH:
|
||||||
|
for y in GRID_SIZE_LENGTH:
|
||||||
|
var tile = debug_map[x][y][z]
|
||||||
|
|
||||||
|
if tile != null and tile["visibility"]:
|
||||||
|
if tile["x"] == hover_tile_position.x and tile["y"] == hover_tile_position.y:
|
||||||
|
# Store this tile for highlighting
|
||||||
|
var tile_key = str(x) + "_" + str(y) + "_" + str(z)
|
||||||
|
new_highlighted_tiles[tile_key] = {
|
||||||
|
"x": x,
|
||||||
|
"y": y,
|
||||||
|
"z": z
|
||||||
|
}
|
||||||
|
|
||||||
|
# Highlight new tiles
|
||||||
|
for tile_key in new_highlighted_tiles:
|
||||||
|
var tile_data = new_highlighted_tiles[tile_key]
|
||||||
|
var tile = debug_map[tile_data.x][tile_data.y][tile_data.z]
|
||||||
|
|
||||||
|
if not tile["selected"]:
|
||||||
|
isometric_map_layers[tile_data.z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
MAIN_SOURCE_ID,
|
||||||
|
tile["atlas_highlight_position"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
isometric_map_layers[tile_data.z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
1,
|
||||||
|
Vector2i(3,1) #
|
||||||
|
)
|
||||||
|
|
||||||
|
tile["highlighted"] = true
|
||||||
|
|
||||||
|
# De-highlight tiles that are no longer under the cursor
|
||||||
|
for tile_key in highlighted_tiles:
|
||||||
|
if not (tile_key in new_highlighted_tiles):
|
||||||
|
var tile_data = highlighted_tiles[tile_key]
|
||||||
|
var tile = debug_map[tile_data.x][tile_data.y][tile_data.z]
|
||||||
|
|
||||||
|
if tile != null and tile["visibility"]:
|
||||||
|
|
||||||
|
if not tile["selected"]:
|
||||||
|
isometric_map_layers[tile_data.z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
MAIN_SOURCE_ID,
|
||||||
|
tile["atlas_base_position"] # Original appearance
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
isometric_map_layers[tile_data.z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
1,
|
||||||
|
Vector2i(0,1) #
|
||||||
|
)
|
||||||
|
tile["highlighted"] = false
|
||||||
|
|
||||||
|
# Update the highlighted tiles list
|
||||||
|
highlighted_tiles = new_highlighted_tiles
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
# Store initial camera position
|
# Store initial camera position
|
||||||
@ -368,10 +447,16 @@ func _ready() -> void:
|
|||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
# isometric_grid_hover()
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
isometric_grid_hover()
|
||||||
# Camera drag (pan) control
|
# Camera drag (pan) control
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == MOUSE_BUTTON_LEFT:
|
if event.button_index == MOUSE_BUTTON_RIGHT:
|
||||||
if event.pressed:
|
if event.pressed:
|
||||||
drag_start = event.position
|
drag_start = event.position
|
||||||
drag_active = true
|
drag_active = true
|
||||||
@ -379,9 +464,9 @@ func _input(event):
|
|||||||
drag_active = false
|
drag_active = false
|
||||||
|
|
||||||
# Zoom control with mouse wheel
|
# Zoom control with mouse wheel
|
||||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
zoom_camera(-zoom_speed)
|
zoom_camera(-zoom_speed)
|
||||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
elif event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||||
zoom_camera(zoom_speed)
|
zoom_camera(zoom_speed)
|
||||||
|
|
||||||
# Handle camera movement while dragging
|
# Handle camera movement while dragging
|
||||||
@ -403,31 +488,90 @@ func zoom_camera(zoom_amount):
|
|||||||
camera.zoom = Vector2(new_zoom, new_zoom)
|
camera.zoom = Vector2(new_zoom, new_zoom)
|
||||||
|
|
||||||
func _on_cw_pressed() -> void:
|
func _on_cw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_z_axis(3)
|
rotate_map_around_z_axis(3)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
func _on_ccw_pressed() -> void:
|
func _on_ccw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_z_axis(1)
|
rotate_map_around_z_axis(1)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
func _on_x_cw_pressed() -> void:
|
func _on_x_cw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_x_axis(1)
|
rotate_map_around_x_axis(1)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
func _on_x_ccw_pressed() -> void:
|
func _on_x_ccw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_x_axis(3)
|
rotate_map_around_x_axis(3)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
func _on_y_cw_pressed() -> void:
|
func _on_y_cw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_y_axis(3)
|
rotate_map_around_y_axis(3)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
func _on_y_ccw_pressed() -> void:
|
func _on_y_ccw_pressed() -> void:
|
||||||
|
_reset_class_values()
|
||||||
rotate_map_around_y_axis(1)
|
rotate_map_around_y_axis(1)
|
||||||
initialize_map_layers()
|
initialize_map_layers()
|
||||||
draw_visible_tiles()
|
draw_visible_tiles()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _reset_class_values():
|
||||||
|
highlighted_tiles = {}
|
||||||
|
last_click_time = 0.0
|
||||||
|
clicked_position = Vector2i(1, 1)
|
||||||
|
is_tile_selected = false
|
||||||
|
|
||||||
|
var click_delay: float = 0.2
|
||||||
|
var last_click_time: float = 0.0
|
||||||
|
var clicked_position: Vector2i = Vector2i(1, 1)
|
||||||
|
var is_tile_selected: bool = false
|
||||||
|
|
||||||
|
func tile_selction_logic(position: Vector2i):
|
||||||
|
for z in GRID_SIZE_HEIGHT:
|
||||||
|
for x in GRID_SIZE_WIDTH:
|
||||||
|
for y in GRID_SIZE_LENGTH:
|
||||||
|
var tile = debug_map[x][y][z]
|
||||||
|
if tile["selected"] and tile["highlighted"]:
|
||||||
|
isometric_map_layers[z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
1,
|
||||||
|
Vector2i(0,1) #
|
||||||
|
)
|
||||||
|
tile["selected"] = false
|
||||||
|
if tile["selected"] and not tile["highlighted"]:
|
||||||
|
isometric_map_layers[z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
0,
|
||||||
|
Vector2i(0,0) #
|
||||||
|
)
|
||||||
|
tile["selected"] = false
|
||||||
|
if not tile["selected"] and tile["highlighted"]:
|
||||||
|
isometric_map_layers[z].set_cell(
|
||||||
|
Vector2i(tile["x"], tile["y"]),
|
||||||
|
1,
|
||||||
|
Vector2i(3,1) #
|
||||||
|
)
|
||||||
|
tile["selected"] = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
var current_time = Time.get_ticks_msec() / 1000.0
|
||||||
|
if current_time - last_click_time >= click_delay:
|
||||||
|
last_click_time = current_time
|
||||||
|
var new_clicked_position = isometric_map_layers[0].local_to_map(get_global_mouse_position())
|
||||||
|
tile_selction_logic(new_clicked_position)
|
||||||
|
elif event is InputEventKey and event.pressed and event.keycode == KEY_ESCAPE:
|
||||||
|
pass
|
||||||
|
#deselect_tile()
|
||||||
|
|||||||
@ -12,7 +12,7 @@ func _process(delta):
|
|||||||
|
|
||||||
|
|
||||||
func _on_start_button_pressed():
|
func _on_start_button_pressed():
|
||||||
get_tree().change_scene_to_file("res://scenes/isometric_map_layer_holder.tscn")
|
get_tree().change_scene_to_file("res://scenes/debug_level.tscn")
|
||||||
|
|
||||||
|
|
||||||
func _on_option_button_pressed():
|
func _on_option_button_pressed():
|
||||||
|
|||||||
12
scripts/player.gd
Normal file
12
scripts/player.gd
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
|
||||||
|
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float):
|
||||||
|
play_idle_animation()
|
||||||
|
|
||||||
|
|
||||||
|
func play_idle_animation():
|
||||||
|
animated_sprite.play("down")
|
||||||
1
scripts/player.gd.uid
Normal file
1
scripts/player.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://jfojoaymauh2
|
||||||
Loading…
x
Reference in New Issue
Block a user