star.gd 358 B

1234567891011121314151617
  1. extends Polygon2D
  2. onready var MAIN = find_parent("MAIN")
  3. class_name Star
  4. func _process(delta: float) -> void:
  5. position.x += MAIN.speed * delta * 0.3
  6. if position.x <= -40:
  7. queue_free()
  8. func _init(poly:Polygon2D) -> void:
  9. polygon = poly.polygon
  10. func _ready() -> void:
  11. self.scale = Vector2.ONE*rand_range(0,0.5)
  12. self.rotation = rand_range(0, 2 * PI)