mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Code clean up
This commit is contained in:
parent
560f66b32d
commit
17bc3578ba
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user