brackeys-12/main.gd
2024-09-14 21:19:19 -04:00

29 lines
839 B
GDScript

extends Node2D
@onready var building_levels = [
$Node2D/Level2/BuildingLevel2,
$Node2D/Level3/BuildingLevel3,
$Node2D/Level4/BuildingLevel4,
$Node2D/Level5/BuildingLevel5,
$Node2D/BuildingLevel6
]
@onready var night: ColorRect = $CanvasLayer/Night
var night_tween
func _ready() -> void:
if night_tween:
night_tween.kill()
night_tween = create_tween()
night_tween.set_loops()
night_tween.tween_property(night, "modulate", Color.TRANSPARENT, 5)
night_tween.tween_interval(15)
night_tween.tween_property(night, "modulate", Color.WHITE, 5)
func _process(delta: float) -> void:
if Input.is_action_just_released("lclick"):
if Persister.get_value("drag_mode") and Persister.get_value("building_mode"):
for build_level in building_levels:
build_level.place_building()
Persister.persist_data("building_mode", false)