40 lines
913 B
GDScript
40 lines
913 B
GDScript
extends Node2D
|
|
|
|
onready var light1 = $Lights / Light2D;
|
|
onready var light2 = $Lights / Light2D2
|
|
var maxEnergy = 2.5
|
|
var minEnergy = 1.0
|
|
var timeFactor = 3.5
|
|
var isIncreasing;
|
|
|
|
func _ready():
|
|
light1.energy = maxEnergy
|
|
isIncreasing = false
|
|
|
|
var windowSize = SettingsSingleton.GetCurrectScreenResolutionVector2();
|
|
|
|
$Cloud1.position = Vector2( - 500, - windowSize.y * 0.1)
|
|
$Cloud2.position = Vector2(0, - windowSize.y * 0.35)
|
|
|
|
GallerySingleton.AddBackground("Scene8")
|
|
|
|
|
|
|
|
func _process(delta):
|
|
|
|
if (isIncreasing):
|
|
light1.energy += delta / timeFactor;
|
|
if light1.energy > maxEnergy:
|
|
light1.energy = maxEnergy
|
|
isIncreasing = false
|
|
elif ( not isIncreasing):
|
|
light1.energy -= delta / timeFactor;
|
|
if light1.energy < minEnergy:
|
|
light1.energy = minEnergy
|
|
isIncreasing = true
|
|
|
|
func InitForGallery()->Array:
|
|
for i in get_children():
|
|
if i is Node2D:
|
|
i.scale = Vector2(0.5, 0.5)
|
|
return [];
|