All sorts of fun and games
This commit is contained in:
parent
cf3c8d82f1
commit
ce0ef75241
116 changed files with 1849 additions and 109 deletions
|
|
@ -75,6 +75,7 @@ func _unhandled_input(event : InputEvent) -> void:
|
|||
## We spread to a 3x3 area for blowing up walls because it was very
|
||||
## weird with 1x1 cells
|
||||
var update_cells : Array = GridUtil.get_surrounding_tiles(tile_position)
|
||||
update_cells = filter_indestructible_tiles(update_cells)
|
||||
set_cells_terrain_connect(0, update_cells, 0, 0)
|
||||
|
||||
## Get all the co-ordinates around the given tile_position coordinates
|
||||
|
|
@ -85,22 +86,27 @@ func _unhandled_input(event : InputEvent) -> void:
|
|||
update_passable()
|
||||
check_for_visible_gatherables()
|
||||
|
||||
# Check if the tile is already highlighted
|
||||
#if highlighted_tiles.has(tile_position):
|
||||
# Change the tile to destroyed tile and remove from highlighted set
|
||||
# set_cellv(tile_position, DESTROYED_TILE)
|
||||
# highlighted_tiles.erase(tile_position)
|
||||
|
||||
func redraw_surrounding_tiles(positions : Array) -> void:
|
||||
var walls : Array = []
|
||||
|
||||
for cell_pos : Vector2 in positions:
|
||||
var tile_data : TileData = get_cell_tile_data(0, cell_pos)
|
||||
if tile_data and tile_data.get_custom_data('navtype') == 'wall':
|
||||
if tile_data and tile_data.get_custom_data('navtype') == 'wall' and tile_data.get_custom_data('indestructible') != true:
|
||||
walls.append(cell_pos)
|
||||
|
||||
set_cells_terrain_connect(0, walls, 0, 1)
|
||||
|
||||
func filter_indestructible_tiles(coords : Array) -> Array:
|
||||
var filtered_coords : Array = []
|
||||
for coord : Vector2 in coords:
|
||||
var tile_data : TileData = get_cell_tile_data(0, coord)
|
||||
if tile_data and tile_data.get_custom_data('indestructible') != true:
|
||||
filtered_coords.append(coord)
|
||||
|
||||
Log.pr(filtered_coords)
|
||||
return filtered_coords
|
||||
|
||||
func check_for_visible_gatherables() -> void:
|
||||
|
||||
# Remove all existing glowing lights
|
||||
|
|
@ -108,7 +114,7 @@ func check_for_visible_gatherables() -> void:
|
|||
child.queue_free()
|
||||
|
||||
## Loop through the tiles on the gatherables layer and check if the thing on
|
||||
# the layer below them is a wall, if it is they need to be hidden.
|
||||
# the layer below them is a wall, we don't add a glow - if it is visible then we do
|
||||
for i in tilemap_size.x:
|
||||
for j in tilemap_size.y:
|
||||
var coords : Vector2i = Vector2i(i, j)
|
||||
|
|
@ -121,14 +127,8 @@ func check_for_visible_gatherables() -> void:
|
|||
else:
|
||||
if tile_data.get_custom_data('glowcolour'):
|
||||
var glow_colour : String = tile_data.get_custom_data('glowcolour')
|
||||
Log.pr("Glow colour: " + str(glow_colour))
|
||||
var glow : MushroomGlow = mushroom_glow.instantiate()
|
||||
glow.set_position(coords * get_tileset().tile_size + get_tileset().tile_size / 2)
|
||||
glow.colour_name = glow_colour
|
||||
mushroom_glow_container.add_child.call_deferred(glow)
|
||||
Log.pr(glow)
|
||||
# Log.pr(below_tile_data)
|
||||
#if tile_data and tile_data.get_custom_data('navtype') == 'gatherable':
|
||||
# var below_tile_data : TileData = get_cell_tile_data(0, coords + Vector2i(0, 1))
|
||||
# if below_tile_data and below_tile_data.get_custom_data('navtype') == 'wall':
|
||||
# set_cellv(coords, -1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue