Finallized scoring logic and adjusted ball speed.

This commit is contained in:
Henry 2025-08-25 14:51:30 +01:00
parent 4eba01e61b
commit e5dc6dd42a
3 changed files with 48 additions and 4 deletions

12
ball.gd
View file

@ -1,6 +1,10 @@
extends CharacterBody2D
const SPEED : float = 300.0
const SPEED : float = 310.0
@export var paddle_0 : Node2D
@export var paddle_1 : Node2D
func _ready() -> void:
initialize()
@ -17,5 +21,11 @@ func initialize():
position = get_viewport_rect().size / 2.0
func _on_screen_exited() -> void:
#Update Score
if position.x <0.0:
paddle_1.increment_score()
else:
paddle_0.increment_score()
#Reint After 1 second
await get_tree().create_timer(1.0).timeout
initialize()