campfires tiles now emit light

This commit is contained in:
Solene Rapenne 2022-04-30 20:34:07 +02:00
parent 63689f8e60
commit e85d786136
3 changed files with 15 additions and 1 deletions

View File

@ -38,6 +38,12 @@ func _ready():
VisualServer.set_default_clear_color(Color(0.0,0.0,0.0,1.0))
randomize()
$Darkness.visible = true
for tile in $TileMap.add_light_campfire():
var light = preload("res://Campfire_Light.tscn").instance()
light.position = tile
add_child(light)
for i in 8:
add_relics()
$Player.relic_left(relic_left)

File diff suppressed because one or more lines are too long

View File

@ -15,3 +15,11 @@ func random_valid_safe_position(player, tile_name):
position_to_player = position.distance_to(player)
if position_to_player > 4*32 and position_to_player < 30*32:
return(position)
func add_light_campfire():
var clear_tiles = get_used_cells()
var light_tiles = []
for tile in clear_tiles:
if get_cellv(tile) == tile_set.find_tile_by_name("campfire"):
light_tiles.append(tile*self.cell_size + cell_size/2)
return(light_tiles)