continued player handling

This commit is contained in:
Jonas 2025-03-28 20:34:57 +01:00
parent 10eaf40c64
commit db749e0df2

View File

@ -614,7 +614,7 @@ func set_player(p):
func init_player():
var tile = debug_map[int(INITIAL_GRID_SIZE_WIDTH/2)][INITIAL_GRID_SIZE_LENGTH/2][1]
var tile = debug_map[10][10][1]
tile["visibility"] = true
tile["unit"] = player_node
tile["unit_type"] ="PC"
@ -625,23 +625,30 @@ func _on_player_z_layer_change_pressed() -> void:
var new_z = 0
var new_y = 0
var new_x = 0
var tile = debug_map[0][0][0]
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]
tile = debug_map[x][y][z]
if tile["unit_type"] == "PC":
new_z = z + 1
new_y = y - 1
new_x = x - 1
tile["unit"] = null
tile["unit_tpye"] = null
tile["visibility"] = null
new_y = y
new_x = x
break
if tile["unit_type"] == "PC":
break
if tile["unit_type"] == "PC":
break
print("x ", new_x, " y ", new_y, " z ", new_z)
tile["unit"] = null
tile["unit_type"] = null
tile["visibility"] = null
var new_player_tile = debug_map[new_x][new_y][new_z]
new_player_tile["unit"] = null
new_player_tile["unit_tpye"] = null
new_player_tile["visibility"] = null
var new_player_tile = debug_map[new_x][new_y][new_z]
new_player_tile["unit"] = player_node
new_player_tile["visibility"] = true
new_player_tile["unit_type"] ="PC"
player_node.set_unit_position(new_player_tile["x"], new_player_tile["y"], new_player_tile["z"])
@ -650,21 +657,34 @@ func _on_player_z_layer_change_down_pressed() -> void:
var new_z = 0
var new_y = 0
var new_x = 0
var tile = debug_map[0][0][0]
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]
tile = debug_map[x][y][z]
if tile["unit_type"] == "PC":
new_z = z - 1
new_y = y + 1
new_x = x + 1
tile["unit"] = null
tile["unit_tpye"] = null
tile["visibility"] = null
new_y = 1
new_x = 1
break
if tile["unit_type"] == "PC":
print("y ", tile)
break
if tile["unit_type"] == "PC":
print("x ", tile)
break
if tile["unit_type"] == "PC":
print("z ", tile)
break
print("tile ", tile)
print("x ", new_x, " y ", new_y, " z ", new_z)
tile["unit"] = null
tile["unit_type"] = null
tile["visibility"] = null
var new_player_tile = debug_map[new_x][new_y][new_z]
new_player_tile["unit"] = null
new_player_tile["unit_tpye"] = null
new_player_tile["visibility"] = null
var new_player_tile = debug_map[new_x][new_y][new_z]
new_player_tile["visibility"] = true
new_player_tile["unit"] = player_node
new_player_tile["unit_type"] ="PC"
player_node.set_unit_position(new_player_tile["x"], new_player_tile["y"], new_player_tile["z"])