I am working on a tile map (of my own code). Each hexagon has an Dictionary that holds its individual data. I need to check to see if each tile meets some conditions...
if (hex["neighbors_index"]["North_index"] != null && hex["neighbors_index"]["North_index"] > 0 && hexagon_grid_data["tile_" + str(hex["neighbors_index"]["North_index"])]["framed"] == false):
#code
pass
This seems messy and hard to follow the way the "variable" repeats.
Is there a way that I can set up an "advanced" IF statement that will allow me to reference the variable only one time and then test it againts the conditions, or do I simply need to convert it to a Match test?
example of a solution I am fishing for...
if (hex["neighbors_index"]["North_index"] != null && > 0 && hexagon_grid_data["tile_" + str(hex["neighbors_index"]["North_index"])]["framed"] == false):
#code
pass
In this case, I entered the varaible of hex["neighbors_index"]["North_index"]
and did the conditions as != null && > 0
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I tried the short hand of...
if (hex["neighbors_index"]["North_index"] != null && > 0...)
I recieved an error stating...
res://Script(s)/HEXAGON_Polygon2D.gd:546 - Parse Error: Expected expression after "&&" operator.