Adding initial game files.

This commit is contained in:
Henry 2025-08-24 13:39:07 +01:00
parent 8a5d7f634c
commit c5615cbdd8
12 changed files with 229 additions and 0 deletions

23
ball.gd Normal file
View file

@ -0,0 +1,23 @@
extends CharacterBody2D
const SPEED : float = 300.0
func _ready() -> void:
initialize()
func _physics_process(delta: float) -> void:
move_and_slide()
func initialize():
var extra_offset = 0.0 if randf() < 0.5 else PI
var angle = \
extra_offset + randf_range(-PI/3.0, PI/3.0)
velocity = Vector2(cos(angle), sin(angle)).normalized()
position = get_viewport_rect().size / 2.0
func _on_screen_exited() -> void:
# update score
# reinit after 1 second
await get_tree().create_timer (1.0).timeout
initialize()