18 lines
466 B
GDScript
18 lines
466 B
GDScript
class_name Meteor extends "res://scenes/obstacle/obstacle.gd"
|
|
|
|
@export var minSpeed: int = 100
|
|
@export var maxSpeed: int = 1000
|
|
|
|
var speed: int = 1000
|
|
var direction: int
|
|
|
|
func _init() -> void:
|
|
var rng = RandomNumberGenerator.new()
|
|
direction = rng.randi_range(0, 360)
|
|
speed = rng.randi_range(minSpeed, maxSpeed)
|
|
rotation = direction
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
velocity = Vector2.UP.rotated(direction).normalized() * speed
|
|
move_and_slide()
|