2021-06-12 02:05:05 +02:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
export var entity_name = "DROPOFF"
|
|
|
|
export var destinationColor = Color.yellow
|
|
|
|
var rng = RandomNumberGenerator.new()
|
|
|
|
|
|
|
|
onready var sprite = $Sprite
|
|
|
|
|
|
|
|
|
|
|
|
var colorList = [
|
|
|
|
Color.yellow,
|
|
|
|
Color.violet,
|
|
|
|
Color.red,
|
|
|
|
Color.turquoise,
|
|
|
|
]
|
|
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
|
|
# var a = 2
|
|
|
|
# var b = "text"
|
|
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
2021-06-13 18:05:10 +02:00
|
|
|
modulate_color()
|
|
|
|
|
|
|
|
func modulate_color():
|
2021-06-12 02:05:05 +02:00
|
|
|
rng.randomize()
|
2021-06-13 18:05:10 +02:00
|
|
|
var n = rng.randi_range(0,colorList.size()-1)
|
2021-06-12 02:05:05 +02:00
|
|
|
print(n)
|
|
|
|
destinationColor = colorList[n]
|
|
|
|
print(destinationColor)
|
|
|
|
sprite.modulate = destinationColor
|
|
|
|
|
|
|
|
|
2021-06-13 18:05:10 +02:00
|
|
|
func _on_Timer_timeout():
|
|
|
|
modulate_color()
|