24 lines
562 B
GDScript
24 lines
562 B
GDScript
extends Node
|
|
|
|
var score : int
|
|
|
|
@onready var Bird = %Bird
|
|
@export var Pipes : PackedScene
|
|
const START_POSITION : int = 500
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
var instance : Node2D = Pipes.instantiate()
|
|
instance.connect("pipe_collision", _on_pipes_pipe_collision)
|
|
instance.position.x = START_POSITION
|
|
add_child(instance)
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|
|
|
|
func increment_score():
|
|
score += 1
|
|
|
|
func _on_pipes_pipe_collision():
|
|
print("hello")
|