saving and level list
This commit is contained in:
parent
38ef040ae9
commit
39a7eb14b4
13 changed files with 128 additions and 52 deletions
|
@ -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"))
|
||||
|
|
|
@ -20,7 +20,7 @@ func _physics_process(delta):
|
|||
#Gold Counter
|
||||
gold_counter.text = "%02d" % Game.golds
|
||||
#Shard Counter
|
||||
shard_counter.text = "%02d" % Game.shards
|
||||
shard_counter.text = str(Game.shards)
|
||||
#Star Counter
|
||||
red_star.visible = Game.stars[0]
|
||||
yellow_star.visible = Game.stars[1]
|
||||
|
@ -28,7 +28,7 @@ func _physics_process(delta):
|
|||
blue_star.visible = Game.stars[3]
|
||||
magenta_star.visible = Game.stars[4]
|
||||
#Score Counter
|
||||
score_counter.text = "%06d" % Game.score
|
||||
score_counter.text = "%05d" % Game.score
|
||||
#Arrow Counter
|
||||
arrow_counter.text = str(Game.arrows)
|
||||
##TOUCH UP LATER
|
||||
|
@ -38,10 +38,4 @@ func _physics_process(delta):
|
|||
high_counter.text = str("HIGH:") + str("%06d" % Game.high_score)
|
||||
##Timer
|
||||
Game.time += delta
|
||||
var minutes = str(floor(Game.time / 60))
|
||||
var seconds = floor(fmod(Game.time,60))
|
||||
var milliseconds := floor(fmod(Game.time, 1) * 100)
|
||||
if Game.time < 600:
|
||||
time_counter.text = minutes + ":" + ("%02d" % seconds) + ":" + ("%02d" % milliseconds)
|
||||
else:
|
||||
time_counter.text = "9:59:99"
|
||||
time_counter.text = Game.timeify(Game.time)
|
||||
|
|
|
@ -36,36 +36,41 @@ margin_top = -2.0
|
|||
margin_right = 81.0
|
||||
margin_bottom = 18.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "00"
|
||||
text = "0"
|
||||
|
||||
[node name="RedStar" type="Sprite" parent="HUD"]
|
||||
visible = false
|
||||
material = SubResource( 1 )
|
||||
position = Vector2( 86, 5 )
|
||||
position = Vector2( 83, 5 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[node name="YellowStar" type="Sprite" parent="HUD"]
|
||||
visible = false
|
||||
material = SubResource( 2 )
|
||||
position = Vector2( 96, 5 )
|
||||
position = Vector2( 93, 5 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 8, 0, 8, 8 )
|
||||
|
||||
[node name="GreenStar" type="Sprite" parent="HUD"]
|
||||
position = Vector2( 106, 5 )
|
||||
visible = false
|
||||
position = Vector2( 103, 5 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 16, 0, 8, 8 )
|
||||
|
||||
[node name="BlueStar" type="Sprite" parent="HUD"]
|
||||
position = Vector2( 116, 5 )
|
||||
visible = false
|
||||
position = Vector2( 113, 5 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 24, 0, 8, 8 )
|
||||
|
||||
[node name="MagentaStar" type="Sprite" parent="HUD"]
|
||||
position = Vector2( 126, 5 )
|
||||
visible = false
|
||||
position = Vector2( 123, 5 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 32, 0, 8, 8 )
|
||||
|
@ -84,7 +89,7 @@ margin_top = -2.0
|
|||
margin_right = 263.0
|
||||
margin_bottom = 18.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "000000"
|
||||
text = "00000"
|
||||
|
||||
[node name="HighCounter" type="Label" parent="HUD"]
|
||||
visible = false
|
||||
|
@ -104,9 +109,9 @@ theme = ExtResource( 10 )
|
|||
text = "2"
|
||||
|
||||
[node name="ArrowCounter" type="Label" parent="HUD"]
|
||||
margin_left = 68.0
|
||||
margin_left = 61.0
|
||||
margin_top = -2.0
|
||||
margin_right = 152.0
|
||||
margin_right = 145.0
|
||||
margin_bottom = 18.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "0"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue