Level_first
unknown
plain_text
3 years ago
428 B
18
Indexable
extends Node2D
var score = 0
var lives = 3
var ball = preload("res://Ball.tscn")
func _on_Area2D_body_entered(body):
if body is RigidBody2D:
lives -= 1
$GameLabel/Lives.text = "LIVES: "+str(lives)
var ballx = ball.instance()
add_child(ballx)
ballx.global_position = $Paddle.global_position + Vector2(0,-20)
body.queue_free()
if lives==0:
get_tree().change_scene("res://Game/GameOver.tscn")
Editor is loading...