29 lines
636 B
GDScript
29 lines
636 B
GDScript
extends Node2D
|
|
|
|
@export var ball_scene: PackedScene
|
|
var ball
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
ball = ball_scene.instantiate()
|
|
|
|
ball.position = $BallStartPos.position
|
|
|
|
var direction = randf_range(-PI/2, PI/2)
|
|
ball.rotation = direction
|
|
|
|
ball.linear_velocity = Vector2(randf_range(150.0, 250.0), 0.0).rotated(direction)
|
|
|
|
add_child(ball)
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func _on_block_removal(node: Node) -> void:
|
|
pass # Replace with function body.
|