extends Node2D
class_name Planet
@onready var label = $Label
var pname: String = ""
var orbit_radius: float = 30.0
var orbit_speed: float = 0.01
var biosfere: float = 0.1
var resources := {}

var texture: Texture2D
var angle = randf() * TAU
func _ready():
	print("Planeta: %s, surowiec: %s" % [pname, resources])
	  #str(round(biosfere * 100) / 100.0)
	_update_position()


func _process(delta):
	angle += orbit_speed * delta  # obrót w czasie
	angle = fmod(angle, TAU)      # utrzymanie kąta w 0..2π
	_update_position()
	print(pname, angle)
	label.text = str(round(position * 100) / 100.0)

func _update_position():
	# pozycja lokalna względem gwiazdy
	position = Vector2(cos(angle), sin(angle)) * orbit_radius
