Moved comet.gd to proper folder

This commit is contained in:
Rain Clark 2024-05-12 22:40:13 -04:00
parent 8da8a60d94
commit abad40fbd4

View File

@ -1,10 +1,8 @@
extends Area2D
# 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"
# TODO: Have like 1 in 4 different sprites (and maybe shapes) the comet can be
signal exploded (new_size: SIZE, current_position: Vector2)
enum SIZE {SMALL, MEDIUM, LARGE}
@ -16,7 +14,6 @@ var size_data = {
SIZE.LARGE : {"Scale": 2.5, "Speed-Multi": 0.5}
}
var movement_speed : int
var movement_speed_min : int = 100
var movement_speed_max : int = 500
@ -25,7 +22,6 @@ var movement_direciton := Vector2.UP
var rotation_speed : int
var rotaion_direction : int
func _ready() -> void:
movement_speed = randi_range(movement_speed_min, movement_speed_max)
movement_speed *= size_data[current_size]["Speed-Multi"]
@ -50,11 +46,15 @@ func _physics_process(delta: float) -> void:
position.y = wrap(position.y, 0,viewport_size.y)
func _on_body_entered(body: Node2D) -> void:
print(body)
if body.is_in_group("bullet"):
explode()
if body.is_in_group("ship"):
body.crash()
func _on_area_entered(area: Area2D) -> void:
if area.is_in_group("bullet"):
area.queue_free()
# TODO: Have some kind of (maybe) particle explosion happen when hit with bullet
$AnimationPlayer.play("explode")
func explode() -> void:
exploded.emit(current_size - 1, global_position)
queue_free()