mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
33 lines
963 B
GDScript
33 lines
963 B
GDScript
extends Area2D
|
|
|
|
# TODO: Have a list of "sizes" a comet can be
|
|
# TODO: Have speeds be determined on a rage based on its "size"
|
|
# TODO: Provide a specific score based on the "size"
|
|
# TODO: Have the comet spawn 2 of the next "size" when hit
|
|
# TODO: Have the comet disapear if shot at is smallest "size"
|
|
|
|
@export var movement_speed := 600
|
|
|
|
var rotation_speed : int
|
|
var rotaion_direction : int
|
|
|
|
func _ready() -> void:
|
|
rotaion_direction = randi_range(-1, 1)
|
|
rotation_speed = randi_range(50, 250)
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
rotate(deg_to_rad(rotaion_direction * rotation_speed * delta))
|
|
|
|
# TODO: Add "floating in space" movement
|
|
|
|
# Screen Wrap
|
|
var viewport_size := get_viewport_rect().size
|
|
position.x = wrap(position.x, 0, viewport_size.x)
|
|
position.y = wrap(position.y, 0,viewport_size.y)
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
print(body)
|
|
# TODO: Add "explosion" logic if bullet hits me
|
|
if body.is_in_group("ship"):
|
|
body.crash()
|