saving and level list

This commit is contained in:
pennyrigate 2023-01-07 03:02:26 -05:00
parent 38ef040ae9
commit 39a7eb14b4
13 changed files with 128 additions and 52 deletions

View file

@ -3,6 +3,7 @@ extends Node2D
export var cost = 0
onready var label = $Label
onready var anims = $AnimationPlayer
onready var map = get_owner()
func _ready():
anims.play("closed")
@ -16,5 +17,21 @@ func _physics_process(delta):
func _on_Area2D_area_entered(area):
if area.is_in_group("player"):
if Game.score > Game.high_score: Game.high_score = Game.score
#BONUSES
#Time bonus
if Game.golds == 50 && Game.shards == 5:
if Game.time < map.target_time_100: Game.score += floor(2500 * (Game.time / map.target_time_100))
else:
if Game.time < map.target_time_any: Game.score += floor(2500 * (Game.time / map.target_time_any))
#Collection bonus
if Game.golds == 50: Game.score += 500
if Game.shards == 5: Game.score += 500
if Game.golds == 50 && Game.shards == 5: Game.score += 250
#Life bonus
if Game.lives == 1: Game.score += 500
if Game.lives == 2: Game.score += 1500
#Perfect bonus
if Game.lives == 2 && Game.golds == 50 && Game.shards == 5 && Game.time < map.target_time_100:
Game.score += 1000
Game.save()
Game.change_map(load("res://maps/level_select.tscn"))