From 155c86c01376f06dc0ed7c0d44c3d475f513c682 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Sun, 1 Dec 2024 13:24:47 -0500 Subject: [PATCH] Hook score submission into new server and move into the results screen. --- .gitignore | 3 +- autoloads/game.gd | 6 +- autoloads/options.gd | 10 + autoloads/scoreboard.gd | 123 ++++++ graphics/hud/high_score.png | Bin 0 -> 960 bytes graphics/hud/high_score.png.import | 35 ++ menus/results.gd | 35 +- menus/results.tscn | 649 ++++++++++++++++++++++++++++- project.godot | 1 + 9 files changed, 853 insertions(+), 9 deletions(-) create mode 100644 autoloads/scoreboard.gd create mode 100644 graphics/hud/high_score.png create mode 100644 graphics/hud/high_score.png.import diff --git a/.gitignore b/.gitignore index fb85297..d6037ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .import/ build/ -ngio.ini \ No newline at end of file +ngio.ini +scoreboard_host.txt diff --git a/autoloads/game.gd b/autoloads/game.gd index 6c6ee40..a17ea40 100644 --- a/autoloads/game.gd +++ b/autoloads/game.gd @@ -37,6 +37,7 @@ var time_bonus: int = 0 var life_bonus: int = 0 var perfect_bonus: int = 0 var final_score: int = 0 +var old_high_score: int = 0 #== state ==# var current_sector := Vector2.ZERO var respawn_point := Vector2(32,166) @@ -60,9 +61,6 @@ var marathon_shards: int = 0 var marathon_deaths: int = 0 -func _ready(): - pause_mode = Node.PAUSE_MODE_PROCESS - func _get_stars() -> int: return stars_collected.count(true) @@ -197,6 +195,8 @@ func save(): var save_id = LevelData.levels[current_level].save_id var save_data: Save.LevelSaveData = Save.current_file.levels[save_id] + old_high_score = max(save_data.score_100, save_data.score_any) + # save score and time depending on completion if _get_shards() >= 5 && keys >= 50: save_data.score_100 = max(save_data.score_100, final_score) as int diff --git a/autoloads/options.gd b/autoloads/options.gd index 26ec300..fca7516 100644 --- a/autoloads/options.gd +++ b/autoloads/options.gd @@ -18,6 +18,8 @@ const TRANS_SPEEDS := [0.8, 0.4, 0.2, 0.0000001] #Game var rumble: int = RumbleMode.FULL var gore: int = Gore.FULL +var scoreboard_name: String = "" +var scoreboard_id: int = -1 #Video var fullscreen: bool = false setget _set_fullscreen @@ -42,6 +44,7 @@ var defaults = null func _ready() -> void: pause_mode = PAUSE_MODE_PROCESS + # clone self into defaults before loading stored values if defaults == null: defaults = duplicate() @@ -58,6 +61,9 @@ func load_options() -> void: # game rumble = file.get_value("game", "rumble", defaults.rumble) gore = file.get_value("game", "gore", defaults.gore) + scoreboard_name = file.get_value("game", "scoreboard_name", "") + randomize() + scoreboard_id = file.get_value("game", "scoreboard_id", randi()) # video _set_fullscreen(file.get_value("video", "fullscreen", defaults.fullscreen)) _set_window_size(file.get_value("video", "window_size", defaults.window_size)) @@ -78,6 +84,8 @@ func load_defaults(section: int = Section.ALL) -> void: Section.GAME, Section.ALL: rumble = defaults.rumble gore = defaults.gore + scoreboard_name = defaults.scoreboard_name + scoreboard_id = randi() Section.VIDEO, Section.ALL: fullscreen = defaults.fullscreen window_size = defaults.window_size @@ -96,6 +104,8 @@ func save_options() -> void: #Game file.set_value("game", "rumble", rumble) file.set_value("game", "gore", gore) + file.set_value("game", "scoreboard_name", scoreboard_name) + file.set_value("game", "scoreboard_id", scoreboard_id) #Video file.set_value("video", "fullscreen", fullscreen) file.set_value("video", "window_size", window_size) diff --git a/autoloads/scoreboard.gd b/autoloads/scoreboard.gd new file mode 100644 index 0000000..4464cd5 --- /dev/null +++ b/autoloads/scoreboard.gd @@ -0,0 +1,123 @@ +extends Node + + +signal _response_received + + +const CHECK_INTERVAL: float = 60.0 +const POLL_INTERVAL: float = 0.5 + + +var server_host: String = "" +var http: HTTPRequest = null +## True if there is currently a request processing. +var waiting_for_response: bool = false +## True if the last request failed and the result is not valid. +var errored: bool = false + +var _response_code: int = -1 +var _response_body: String = "" + + +class ScoreEntry: + var score: int + var time: int + var difficulty: int + + func _init(score: int, time: int, difficulty: int) -> void: + self.score = score + self.time = time + self.difficulty = difficulty + + static func from_dict(dict: Dictionary) -> ScoreEntry: + return ScoreEntry.new(dict.score, dict.time, dict.difficulty) + + +func _ready() -> void: + var file = File.new() + file.open("res://scoreboard_host.txt", File.READ) + server_host = file.get_line() + file.close() + + http = HTTPRequest.new() + http.download_chunk_size = 4096 + http.timeout = 10.0 + http.use_threads = true + http.connect("request_completed", self, "_on_request_completed") + add_child(http) + +func _on_request_completed(result: int, response_code: int, headers: PoolStringArray, body: PoolByteArray) -> void: + if result != OK: + errored = true + else: + errored = false + _response_code = response_code + _response_body = body.get_string_from_utf8() + waiting_for_response = false + emit_signal("_response_received") + + +func is_name_free(player_name: String, id: int) -> bool: + if waiting_for_response: + yield(self, "_response_received") + var err = http.request(server_host + "/api/players/" + player_name) + if err != OK: + errored = true + return false + waiting_for_response = true + + yield(self, "_response_received") + if _response_code == HTTPClient.RESPONSE_NOT_FOUND or _response_body.to_int() == id: + return true + return false + + +func touch_name(player_name: String, id: int) -> void: + if waiting_for_response: + yield(self, "_response_received") + var err = http.request( + server_host + "/api/players/%s/%d" % [player_name, id], + [], true, HTTPClient.METHOD_POST + ) + if err != OK: + errored = true + return + waiting_for_response = true + + +func submit_score(level: String, entry: ScoreEntry) -> bool: + if waiting_for_response: + yield(self, "_response_received") + var err = http.request( + server_host + "/api/scores/%s/%s/%d/%d/%d" % [ + level, Options.scoreboard_name, + entry.score, entry.time, entry.difficulty + ], + [], true, HTTPClient.METHOD_POST + ) + if err != OK: + errored = true + return false + waiting_for_response = true + yield(self, "_response_received") + if errored or _response_code != HTTPClient.RESPONSE_OK: + return false + return true + + +func get_scores(level: String) -> Dictionary: + if waiting_for_response: + yield(self, "_response_received") + var err = http.request(server_host + "/api/scores/%s" % level) + if err != OK: + errored = true + return {} + waiting_for_response = true + yield(self, "_response_received") + if not errored and _response_code == HTTPClient.RESPONSE_OK: + var dict = parse_json(_response_body) + var scores = {} + for player in dict.keys(): + scores[player] = ScoreEntry.from_dict(dict[player]) + return scores + return {} diff --git a/graphics/hud/high_score.png b/graphics/hud/high_score.png new file mode 100644 index 0000000000000000000000000000000000000000..908a3d74d7a4d3af61e3744acb5d4c15b3298363 GIT binary patch literal 960 zcmV;x13&zUP)AHIP0004nX+uL$Nkc;* zaB^>EX>4Tx04R}tkvmAkP!xv$riu?L3U&~2$WWauf{HlSDionYs1;guFuCaqnlvOS zE{=k0!NJF3)xpJCR|i)?5PX0*J2)x2NQvhrg%&X$xZIEbp8x0Ga{-}VW}4Lz12o+> zQ;E2k$*ziBuLvQ49t>bYW|lE0NlEzD*FE)8-9>qpf8U?gr{*jM1VrK(GfbO!gLr1s zHaPDShgnfpiO-40O}ZfQBi9v=-#8as7IZLMN=c5CXT3@PWeK{ zW0mt3XRTai&3p0}hI0DKGS_L1Ab~|JL4pVcRg_SMjVSFpDHc+69{2GNyMBpW3b{&P z_CX>@2HM@dakSAh-}0004(Nkl@UNfEYrMeDs|f#`885xA2$h z^5oNSDYvIDAk>O+v(g7@Qx3#LxBDY$zD;O{*pX7&gc#m7$Im;Ktu*!{pyz$6pLSqo2NSir>ng!=;#7{C0mNT91TF?Mro9?4x$?+SeuEKb1gN1k@v7qJ*Z;7PepiplY4&sIJSr+cjw iW5s*)*Aw@)e_%hti_TLb%*k*70000 LevelData.marathon_end: @@ -70,9 +73,33 @@ func _on_AnimationPlayer_animation_finished(anim_name): else: Game.change_map(LevelData.levels[Game.current_level].scene) return + if Game.final_score > Game.old_high_score and not Debug.is_cheating: + animation_player.play("submit_score_popup") + else: + Fade.fade_out(Options.transition_speed_secs) + yield(Fade, "fade_finished") + SceneManager.change_scene(LevelSelect.instance()) + + +func _on_YesSubmit_button_down() -> void: + $"%YesSubmit".release_focus() + animation_player.play("submit") + + var save_id = LevelData.levels[Game.current_level].save_id + var entry = ScoreBoard.ScoreEntry.new(Game.final_score, int(Game.time * 1000.0), Game.difficulty) + var submitted = yield(ScoreBoard.submit_score(save_id, entry), "completed") + if ScoreBoard.errored or not submitted: + animation_player.play("try_again") + else: + animation_player.play("success") + + +func _on_NoSubmit_button_down() -> void: + $"%NoSubmit".release_focus() + _next_screen() + + +func _next_screen() -> void: Fade.fade_out(Options.transition_speed_secs) yield(Fade, "fade_finished") - if Debug.is_cheating == false: - SceneManager.change_scene(SubmitScore.instance()) - else: - SceneManager.change_scene(LevelSelect.instance()) + SceneManager.change_scene(LevelSelect.instance()) diff --git a/menus/results.tscn b/menus/results.tscn index b6d0d50..aa437f8 100644 --- a/menus/results.tscn +++ b/menus/results.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=2] +[gd_scene load_steps=34 format=2] [ext_resource path="res://shaders/wibble_wobble.gdshader" type="Shader" id=1] [ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=2] @@ -14,6 +14,11 @@ [ext_resource path="res://graphics/player/palettes/default.tex" type="Texture" id=12] [ext_resource path="res://menus/results.gd" type="Script" id=13] [ext_resource path="res://menus/results_icon.tscn" type="PackedScene" id=14] +[ext_resource path="res://graphics/hud/high_score.png" type="Texture" id=15] +[ext_resource path="res://graphics/particles/shine.png" type="Texture" id=16] +[ext_resource path="res://scripts/randomize_particle_start.gd" type="Script" id=17] +[ext_resource path="res://graphics/hud/pause_arrow.png" type="Texture" id=18] +[ext_resource path="res://ui/2ndpuberty_scholar_outline.fnt" type="BitmapFont" id=19] [sub_resource type="ShaderMaterial" id=5] shader = ExtResource( 2 ) @@ -36,6 +41,29 @@ shader = ExtResource( 3 ) shader_param/border_color = Color( 0, 0, 0, 1 ) shader_param/border_corners = false +[sub_resource type="Curve" id=11] +_data = [ Vector2( 0, 0 ), 0.0, 0.100639, 0, 0, Vector2( 0.158257, 1 ), 7.51724, -6.83592, 0, 0, Vector2( 0.31422, 0 ), 0.0, 0.0, 0, 0 ] + +[sub_resource type="Gradient" id=17] +interpolation_mode = 2 +offsets = PoolRealArray( 0, 0.734694, 1 ) +colors = PoolColorArray( 0.576471, 0.980392, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ) + +[sub_resource type="ShaderMaterial" id=14] +resource_local_to_scene = true +shader = ExtResource( 1 ) +shader_param/speed = Vector2( 4, 8 ) +shader_param/ammount = Vector2( 24, 12 ) +shader_param/offset = Vector2( 0, 0 ) +shader_param/delay = Vector2( 0, 0 ) + +[sub_resource type="ShaderMaterial" id=13] +shader = ExtResource( 1 ) +shader_param/speed = Vector2( 4, 8 ) +shader_param/ammount = Vector2( 1, 1 ) +shader_param/offset = Vector2( 0, 0 ) +shader_param/delay = Vector2( 0, 0 ) + [sub_resource type="ShaderMaterial" id=6] shader = ExtResource( 1 ) shader_param/speed = Vector2( 4, 8 ) @@ -117,6 +145,138 @@ tracks/5/keys = { "update": 1, "values": [ false ] } +tracks/6/type = "value" +tracks/6/path = NodePath("ShardsAndBonuses/FinalScore:visible") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/7/type = "value" +tracks/7/path = NodePath("ShardsAndBonuses/HighScore:visible") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/8/type = "value" +tracks/8/path = NodePath("ShardsAndBonuses/FinalScore:scale") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} +tracks/9/type = "value" +tracks/9/path = NodePath("ShardsAndBonuses/HighScore:scale") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} +tracks/10/type = "value" +tracks/10/path = NodePath("CenterContainer/SubmitScore:visible") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/11/type = "value" +tracks/11/path = NodePath("CenterContainer/SubmitScore:rect_scale") +tracks/11/interp = 1 +tracks/11/loop_wrap = true +tracks/11/imported = false +tracks/11/enabled = true +tracks/11/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} +tracks/12/type = "value" +tracks/12/path = NodePath("CenterContainer/LoadingGraphic:visible") +tracks/12/interp = 1 +tracks/12/loop_wrap = true +tracks/12/imported = false +tracks/12/enabled = true +tracks/12/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/13/type = "value" +tracks/13/path = NodePath("CenterContainer/LoadingGraphic:rect_scale") +tracks/13/interp = 1 +tracks/13/loop_wrap = true +tracks/13/imported = false +tracks/13/enabled = true +tracks/13/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} +tracks/14/type = "value" +tracks/14/path = NodePath("CenterContainer/LoadingGraphic:material:shader_param/ammount") +tracks/14/interp = 1 +tracks/14/loop_wrap = true +tracks/14/imported = false +tracks/14/enabled = true +tracks/14/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 24, 12 ) ] +} +tracks/15/type = "value" +tracks/15/path = NodePath("CenterContainer/SubmitScore:modulate") +tracks/15/interp = 1 +tracks/15/loop_wrap = true +tracks/15/imported = false +tracks/15/enabled = true +tracks/15/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Color( 1, 1, 1, 1 ) ] +} +tracks/16/type = "value" +tracks/16/path = NodePath("CenterContainer/SubmitScore/Label:text") +tracks/16/interp = 1 +tracks/16/loop_wrap = true +tracks/16/imported = false +tracks/16/enabled = true +tracks/16/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "submit score?" ] +} [sub_resource type="Animation" id=4] resource_name = "results" @@ -321,6 +481,340 @@ tracks/14/keys = { } ] } +[sub_resource type="Animation" id=15] +resource_name = "submit" +length = 0.3 +tracks/0/type = "value" +tracks/0/path = NodePath("CenterContainer/SubmitScore:rect_scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1e-05, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("CenterContainer/SubmitScore:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("CenterContainer/LoadingGraphic:material:shader_param/ammount") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.2 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 0, 0 ), Vector2( 24, 12 ) ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("CenterContainer/LoadingGraphic:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} + +[sub_resource type="Animation" id=12] +resource_name = "submit_score_popup" +length = 1.5 +tracks/0/type = "value" +tracks/0/path = NodePath("ShardsAndBonuses:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( -512, 0 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("ShardsAndBonuses/FinalScore:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("ShardsAndBonuses/HighScore:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ false, true ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("ShardsAndBonuses/FinalScore:scale") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1e-05, 1 ) ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("ShardsAndBonuses/HighScore:scale") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0, 0.3, 0.6 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1e-05, 1 ), Vector2( 1, 1 ) ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("CenterContainer/SubmitScore:visible") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0, 1 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ false, true ] +} +tracks/6/type = "value" +tracks/6/path = NodePath("CenterContainer/SubmitScore:rect_scale") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/keys = { +"times": PoolRealArray( 0, 1, 1.3 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1e-05, 1 ), Vector2( 1e-05, 1 ), Vector2( 1, 1 ) ] +} +tracks/7/type = "method" +tracks/7/path = NodePath("CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer/YesSubmit") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/keys = { +"times": PoolRealArray( 1.5 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "grab_focus" +} ] +} +tracks/8/type = "value" +tracks/8/path = NodePath("CenterContainer/SubmitScore:modulate") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/keys = { +"times": PoolRealArray( 1, 1.056 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ] +} +tracks/9/type = "value" +tracks/9/path = NodePath("CenterContainer/LoadingGraphic:visible") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/10/type = "value" +tracks/10/path = NodePath("CenterContainer/SubmitScore/Label:text") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "submit score?" ] +} + +[sub_resource type="Animation" id=18] +resource_name = "success" +length = 1.5 +tracks/0/type = "value" +tracks/0/path = NodePath("CenterContainer/LoadingGraphic:material:shader_param/ammount") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 24, 12 ), Vector2( 0, 0 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("CenterContainer/CollectedParticles:emitting") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0.3 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("CenterContainer/LoadingGraphic:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 1, +"values": [ true, false ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("CenterContainer/SubmitScore:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/4/type = "method" +tracks/4/path = NodePath(".") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 1.5 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "_next_screen" +} ] +} + +[sub_resource type="Animation" id=16] +resource_name = "try_again" +length = 0.5 +tracks/0/type = "value" +tracks/0/path = NodePath("CenterContainer/SubmitScore:rect_scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0, 0.3 ), +"transitions": PoolRealArray( 1, 1 ), +"update": 0, +"values": [ Vector2( 1e-05, 1 ), Vector2( 1, 1 ) ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("CenterContainer/SubmitScore:visible") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/2/type = "value" +tracks/2/path = NodePath("CenterContainer/LoadingGraphic:material:shader_param/ammount") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0, 0.1, 0.3 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 24, 12 ), Vector2( 24, 12 ), Vector2( 0, 0 ) ] +} +tracks/3/type = "value" +tracks/3/path = NodePath("CenterContainer/LoadingGraphic:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/4/type = "value" +tracks/4/path = NodePath("CenterContainer/SubmitScore/Label:text") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ "failed. try again?" ] +} +tracks/5/type = "method" +tracks/5/path = NodePath("CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer/YesSubmit") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0.5 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "grab_focus" +} ] +} + [node name="Results" type="Node"] script = ExtResource( 13 ) @@ -529,6 +1023,28 @@ material = ExtResource( 7 ) position = Vector2( 640, 40 ) texture = ExtResource( 8 ) +[node name="HighScore" type="Sprite" parent="ShardsAndBonuses"] +visible = false +material = ExtResource( 7 ) +position = Vector2( 640, 40 ) +texture = ExtResource( 15 ) + +[node name="Sparkles" type="CPUParticles2D" parent="ShardsAndBonuses/HighScore"] +light_mask = 0 +amount = 4 +lifetime = 2.0 +texture = ExtResource( 16 ) +emission_shape = 2 +emission_rect_extents = Vector2( 48, 8 ) +gravity = Vector2( 0, 0 ) +angular_velocity = 720.0 +angular_velocity_random = 1.0 +angle = 720.0 +angle_random = 1.0 +scale_amount_curve = SubResource( 11 ) +color = Color( 0.72549, 0.956863, 1, 1 ) +script = ExtResource( 17 ) + [node name="Score" type="Label" parent="."] material = ExtResource( 9 ) margin_top = 8.0 @@ -547,6 +1063,131 @@ theme = ExtResource( 10 ) text = "Time: " align = 1 +[node name="CenterContainer" type="CenterContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = 77.0 +theme = ExtResource( 10 ) + +[node name="CollectedParticles" type="CPUParticles2D" parent="CenterContainer"] +pause_mode = 2 +position = Vector2( 127, 56 ) +emitting = false +amount = 64 +one_shot = true +explosiveness = 1.0 +local_coords = false +emission_shape = 2 +emission_rect_extents = Vector2( 4, 4 ) +direction = Vector2( 0, -1 ) +spread = 180.0 +gravity = Vector2( 0, 150 ) +initial_velocity = 250.0 +initial_velocity_random = 0.9 +damping = 2.0 +angle = 720.0 +angle_random = 1.0 +scale_amount_random = 1.0 +color_ramp = SubResource( 17 ) + +[node name="LoadingGraphic" type="Label" parent="CenterContainer"] +unique_name_in_owner = true +visible = false +material = SubResource( 14 ) +margin_left = 124.0 +margin_top = 52.0 +margin_right = 131.0 +margin_bottom = 62.0 +text = "ยง" +align = 1 +valign = 1 + +[node name="SubmitScore" type="VBoxContainer" parent="CenterContainer"] +unique_name_in_owner = true +visible = false +margin_left = 82.0 +margin_top = 47.0 +margin_right = 173.0 +margin_bottom = 67.0 +rect_pivot_offset = Vector2( 45.5, 18 ) +theme = ExtResource( 10 ) + +[node name="Label" type="Label" parent="CenterContainer/SubmitScore"] +margin_right = 126.0 +margin_bottom = 10.0 +custom_fonts/font = ExtResource( 19 ) +text = "submit score?" + +[node name="YesNoPrompt" type="PanelContainer" parent="CenterContainer/SubmitScore"] +margin_left = 18.0 +margin_top = 14.0 +margin_right = 107.0 +margin_bottom = 36.0 +size_flags_horizontal = 4 + +[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/SubmitScore/YesNoPrompt"] +margin_left = 3.0 +margin_top = 3.0 +margin_right = 86.0 +margin_bottom = 19.0 +rect_min_size = Vector2( 0, 16 ) +rect_pivot_offset = Vector2( -174, -69 ) +custom_constants/separation = 0 +alignment = 1 + +[node name="YesSubmit" type="TextureButton" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +unique_name_in_owner = true +material = SubResource( 13 ) +margin_top = 4.0 +margin_right = 12.0 +margin_bottom = 12.0 +rect_min_size = Vector2( 12, 8 ) +focus_neighbour_right = NodePath("../NoSubmit") +size_flags_vertical = 4 +texture_focused = ExtResource( 18 ) +expand = true +stretch_mode = 3 + +[node name="YesLabel" type="Label" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +margin_left = 12.0 +margin_top = 3.0 +margin_right = 33.0 +margin_bottom = 13.0 +text = "Yes" + +[node name="Spacer" type="Control" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +margin_left = 33.0 +margin_right = 45.0 +margin_bottom = 16.0 +rect_min_size = Vector2( 12, 0 ) + +[node name="NoSubmit" type="TextureButton" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +unique_name_in_owner = true +material = SubResource( 13 ) +margin_left = 45.0 +margin_top = 4.0 +margin_right = 57.0 +margin_bottom = 12.0 +rect_min_size = Vector2( 12, 8 ) +focus_neighbour_left = NodePath("../YesSubmit") +size_flags_vertical = 4 +texture_focused = ExtResource( 18 ) +expand = true +stretch_mode = 3 + +[node name="NoLabel" type="Label" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +margin_left = 57.0 +margin_top = 3.0 +margin_right = 71.0 +margin_bottom = 13.0 +text = "No" + +[node name="Spacer2" type="Control" parent="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer"] +margin_left = 71.0 +margin_right = 83.0 +margin_bottom = 16.0 +rect_min_size = Vector2( 12, 0 ) + [node name="Results" type="Sprite" parent="."] material = SubResource( 6 ) position = Vector2( 232, 80 ) @@ -557,5 +1198,11 @@ autoplay = "results" playback_speed = 2.0 anims/RESET = SubResource( 10 ) anims/results = SubResource( 4 ) +anims/submit = SubResource( 15 ) +anims/submit_score_popup = SubResource( 12 ) +anims/success = SubResource( 18 ) +anims/try_again = SubResource( 16 ) +[connection signal="button_down" from="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer/YesSubmit" to="." method="_on_YesSubmit_button_down"] +[connection signal="button_down" from="CenterContainer/SubmitScore/YesNoPrompt/HBoxContainer/NoSubmit" to="." method="_on_NoSubmit_button_down"] [connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"] diff --git a/project.godot b/project.godot index ec768cd..4b61178 100644 --- a/project.godot +++ b/project.godot @@ -110,6 +110,7 @@ Console="*res://autoloads/console.tscn" Fade="*res://autoloads/fade.tscn" StainLayer="*res://autoloads/stain_layer.tscn" Ngio="*res://autoloads/ngio.gd" +ScoreBoard="*res://autoloads/scoreboard.gd" [debug]