@@ -1,23 +1,21 @@
|
||||
extends Node2D
|
||||
class_name Base
|
||||
|
||||
@export var world_grid: TileMap
|
||||
var grid_loc
|
||||
var i = 1
|
||||
@export var world: World
|
||||
var grid_loc: Vector2i
|
||||
|
||||
const curruption_directions := [Vector2i.LEFT, Vector2i.RIGHT, Vector2i.UP, Vector2i.DOWN]
|
||||
var corruption_tiles: Array[Vector2i] = []
|
||||
|
||||
func _ready():
|
||||
grid_loc = world_grid.local_to_map(position)
|
||||
func _ready() -> void:
|
||||
grid_loc = world.grid_location(position)
|
||||
world.change_location_data(grid_loc, Constants.TilemapLayers.BUILDINGS, Vector2i(17,7))
|
||||
corruption_tiles.append(grid_loc)
|
||||
world_grid.set_cell(Constants.TilemapLayers.BUILDINGS, grid_loc, 0, Vector2i(17,7))
|
||||
world.corrupt_location(grid_loc)
|
||||
|
||||
|
||||
func _on_expand_timer_timeout():
|
||||
var corrupt_tile = corruption_tiles.pick_random() + self.curruption_directions.pick_random()
|
||||
func _on_expand_timer_timeout() -> void:
|
||||
var corrupt_tile: Vector2i = corruption_tiles.pick_random() + self.curruption_directions.pick_random()
|
||||
while corruption_tiles.has(corrupt_tile):
|
||||
corrupt_tile = corruption_tiles.pick_random() + self.curruption_directions.pick_random()
|
||||
corruption_tiles.append(corrupt_tile)
|
||||
world_grid.set_cells_terrain_connect(Constants.TilemapLayers.CORRUPTION, corruption_tiles, 0, 0)
|
||||
i += 1
|
||||
world.corrupt_location(corrupt_tile)
|
||||
|
||||
Reference in New Issue
Block a user