Tabs? Spaces?! WHO KNOWS!
This commit is contained in:
parent
ba3630f69b
commit
3d047f3a8b
2 changed files with 7 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,6 @@
|
|||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
/android/
|
||||
|
||||
# Directories
|
||||
.zed/
|
||||
|
|
|
|||
8
ball.gd
8
ball.gd
|
|
@ -5,13 +5,15 @@ const SPEED : float = 300.0
|
|||
func _ready() -> void:
|
||||
initialize()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
move_and_slide()
|
||||
func _physics_process(delta: float) -> void:
|
||||
var collision = move_and_collide(velocity * _delta)
|
||||
if collision:
|
||||
velocity = velocity.bounce(collision.get_normal())
|
||||
|
||||
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() * SPEED
|
||||
velocity = Vector2(cos(angle), sin(angle)).normalized() * SPEED
|
||||
position = get_viewport_rect().size / 2.0
|
||||
|
||||
func _on_screen_exited() -> void:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue