summaryrefslogtreecommitdiff
path: root/Levels/IncreaseSize.gd
blob: 764a114e135668ae2fec0ab63a09dfe6cf9b9ef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extends Node
class_name IncreaseSize
## Increase size as [member NumberNode.value] increases.

@export var me : NumberNode
@export var player : Node # Should be [Player] or [AI]

@export var max_value : int
@export var min_size : float
@export var max_size : float
@export var min_range : float
@export var max_range : float

func _process(_delta):
	var scale = min_size + ((max_size - min_size) * ((max_value - (max_value - clampf(me.value, 0, max_value))) / max_value))
	me.size = scale

	var range = min_range + ((max_range - min_range) * ((max_range - (max_range - clampf(me.value, 0, max_range))) / max_value))
	player.max_distance = range