extends Node2D export var cost = 0 onready var label = $Label onready var anims = $AnimationPlayer onready var map = get_owner() func _ready(): anims.play("closed") label.text = str(cost) func _physics_process(delta): if Game.keys >= cost: anims.play("open") func _on_Area2D_area_entered(area): if area.is_in_group("player_hitbox"): if Game.score > Game.high_score: Game.high_score = Game.score #BONUSES #Collection bonus if Game.keys == 50: Game.score += 500 if Game.shards == 5: Game.score += 500 if Game.keys == 50 && Game.shards == 5: Game.score += 250 Game.shards_collected[5] = true #Time bonus if Game.keys == 50 && Game.shards == 5: if Game.time < map.target_time_100: Game.score += max(2500 - 2500 * int(Game.time / map.target_time_100), 0) Game.shards_collected[6] = true else: if Game.time < map.target_time_any: Game.score += max(2500 - 2500 * int(Game.time / map.target_time_any), 0) Game.shards_collected[6] = true #Life bonus if Game.lives == 1: Game.score += 500 if Game.lives == 2: Game.score += 1500 Game.shards_collected[7] = true #Perfect bonus if Game.lives == 2 && Game.keys == 50 && Game.shards == 5 && Game.time < map.target_time_100: Game.score += 1000 Game.save() Game.change_map(load("res://maps/level_select.tscn"))