Code clean up

This commit is contained in:
Rain Clark 2024-05-16 14:42:02 -04:00
parent 560f66b32d
commit 17bc3578ba
4 changed files with 3 additions and 5 deletions

View File

@ -12,8 +12,6 @@ func _physics_process(delta: float) -> void:
# Movement # Movement
position += direction.rotated(rotation) * speed * delta position += direction.rotated(rotation) * speed * delta
print(rotation)
# Screenwrap # Screenwrap
if screen_wrap: if screen_wrap:
var viewport_size := get_viewport_rect().size var viewport_size := get_viewport_rect().size

View File

@ -45,7 +45,7 @@ func _on_invader_spawner_shot() -> void:
func increase_score(comet_size : int) -> void: func increase_score(comet_size : int) -> void:
# We add one since comet_size starts count at 0 # We add one since comet_size starts count at 0
comet_size += 1 comet_size += 1
score += points_per_comet / comet_size score += int(points_per_comet / comet_size)
func update_ui()-> void: func update_ui()-> void:
# Label strings must be all caps for font to render proper # Label strings must be all caps for font to render proper

View File

@ -23,7 +23,7 @@ func _ready() -> void:
movement_direction.x = -1 movement_direction.x = -1
else: else:
movement_direction.x = 1 movement_direction.x = 1
random_position.y = randi_range(32, viewport_size.y + 32) random_position.y = randf_range(32, viewport_size.y + 32)
position = random_position position = random_position

View File

@ -6,7 +6,7 @@ const INVADER = preload("res://scenes/invader.tscn")
var can_spawn = false var can_spawn = false
func _process(delta: float) -> void: func _process(_delta: float) -> void:
if can_spawn: if can_spawn:
spawn_invader() spawn_invader()
$SpawnTimer.wait_time = randi_range(20, 40) $SpawnTimer.wait_time = randi_range(20, 40)