From 39a7eb14b487ada5b935ec98c37074af5c57c195 Mon Sep 17 00:00:00 2001 From: pennyrigate Date: Sat, 7 Jan 2023 03:02:26 -0500 Subject: [PATCH] saving and level list --- ...d.png-d633f5249ccc091a7e592fabc835a18c.md5 | 4 +- ....png-d633f5249ccc091a7e592fabc835a18c.stex | Bin 366 -> 366 bytes fonts/2ndpuberty..fnt | 2 +- fonts/2ndpuberty..tres | 3 ++ game.gd | 38 ++++++++++----- graphics/hud/hud.png | Bin 734 -> 736 bytes maps/level_select.gd | 32 ++++++++----- maps/level_select.tscn | 45 +++++++++++++++--- maps/map01.gd | 2 + maps/map01.tscn | 2 + objects/exit/exit.gd | 17 +++++++ objects/hud/hud.gd | 12 ++--- objects/hud/hud.tscn | 23 +++++---- 13 files changed, 128 insertions(+), 52 deletions(-) create mode 100644 fonts/2ndpuberty..tres diff --git a/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.md5 b/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.md5 index 1d7212b..e1201a3 100644 --- a/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.md5 +++ b/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.md5 @@ -1,3 +1,3 @@ -source_md5="c0160f559a57791b0ab96a8c9ef45d0c" -dest_md5="a40b0bbf70fb2e4f0d971d734f832ac1" +source_md5="82f232cbd11bbebe6d1233db07f644d6" +dest_md5="5ae15f7f93ebb7667d6cf1268987bb99" diff --git a/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.stex b/.import/hud.png-d633f5249ccc091a7e592fabc835a18c.stex index 2522f531f6a39000be5b9c67c8d0a8cbc6571bed..e39c5ca39f5f405ecef6de596169341d3338af8e 100644 GIT binary patch delta 177 zcmV;i08anz0`3BkvL4;DXGip(k=wRmWV!8j@;ewblB6id^w9q0J{|~|k=MQ fAG`mNw}05~=l37^PyUntd${=Skgmcsei!$01m+cxRGn^0006NNklv=KZS$#{Q)O5BQu3F2An9cDoy|@qhkKfO-Eyf&VJNG>!e^ z>%J4JFjw+Q37+5U;<>5U;;lH$OF8-{sK+*1!hKDXB7Yd002ov JPDHLkV1kz|pmqQN delta 306 zcmV-20nPs41>Oaasei%%01m- zcl{*5^Su9=Pgh(AVA`@1aV)U7|K;h0>%wK&t=HOYcbnJU z?sc$NuH_y5UKfV=&EdH*PYuQ?pv4hQZt$5E$=w_R)V zKK}!Z{qH 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")) diff --git a/objects/hud/hud.gd b/objects/hud/hud.gd index 7bb88ec..67fbd72 100644 --- a/objects/hud/hud.gd +++ b/objects/hud/hud.gd @@ -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) diff --git a/objects/hud/hud.tscn b/objects/hud/hud.tscn index 3293a01..34ea3b4 100644 --- a/objects/hud/hud.tscn +++ b/objects/hud/hud.tscn @@ -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"