forked from team-sg/hero-mark-2
20 lines
445 B
GDScript
20 lines
445 B
GDScript
extends Node2D
|
|
|
|
export var cost = 0
|
|
onready var label = $Label
|
|
onready var anims = $AnimationPlayer
|
|
|
|
func _ready():
|
|
anims.play("closed")
|
|
label.text = str(cost)
|
|
|
|
|
|
func _physics_process(delta):
|
|
if Game.shards >= cost:
|
|
anims.play("open")
|
|
|
|
func _on_Area2D_area_entered(area):
|
|
if area.is_in_group("player"):
|
|
if Game.score > Game.high_score: Game.high_score = Game.score
|
|
Game.save()
|
|
Game.change_map(load("res://maps/level_select.tscn"))
|