change score reporting
This commit is contained in:
parent
57e3151019
commit
100572749a
5 changed files with 16 additions and 17 deletions
|
@ -17,7 +17,7 @@ func submit_score():
|
|||
var err = config.load("user://settings.cfg")
|
||||
if not (err == OK and config.has_section_key("config", "username")):
|
||||
text = "Error: No Username!\nSet a username in settings to submit scores"
|
||||
var encrypted_score = "EGH" + make_urlsafe(Marshalls.utf8_to_base64(str(stopwatch.time_elapsed))) + "eHa" + make_urlsafe(Marshalls.utf8_to_base64(config.get_value("config", "username")) + "lAx" + make_urlsafe(Marshalls.utf8_to_base64(str(spawner.wave_count-1))))
|
||||
var encrypted_score = "EGH" + make_urlsafe(Marshalls.utf8_to_base64(str(stopwatch.time_since_wave if stopwatch.time_since_wave != 0 else stopwatch.time_elapsed))) + "eHa" + make_urlsafe(Marshalls.utf8_to_base64(config.get_value("config", "username")) + "lAx" + make_urlsafe(Marshalls.utf8_to_base64(str(spawner.wave_count-1))))
|
||||
$HTTPRequest.request_completed.connect(_on_request_completed)
|
||||
$HTTPRequest.request(API_BASE + "/leaderboard?score=%s" % encrypted_score, [], HTTPClient.METHOD_POST)
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ func _ready():
|
|||
spawn_loop()
|
||||
|
||||
signal all_enemies_perished
|
||||
signal wave_complete
|
||||
|
||||
func check_enemies_loop():
|
||||
var has_enemies = len(get_tree().get_nodes_in_group("enemy")) > 0
|
||||
|
@ -29,6 +30,7 @@ func spawn_loop():
|
|||
else:
|
||||
await get_tree().create_timer(wave.spawning_duration).timeout
|
||||
await get_tree().create_timer(wave.wait).timeout
|
||||
wave_complete.emit()
|
||||
|
||||
$"../GameOver".text = "YOU WIN!"
|
||||
$"../Player".destroy()
|
||||
|
|
|
@ -2,12 +2,16 @@ extends Label
|
|||
class_name Stopwatch
|
||||
|
||||
var time_elapsed: float = 0.0
|
||||
var time_since_wave: float = 0.0
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if not get_tree().paused:
|
||||
time_elapsed += delta
|
||||
text = seconds2hhmmss(time_elapsed)
|
||||
|
||||
func wave_finished():
|
||||
time_since_wave = time_elapsed
|
||||
|
||||
func seconds2hhmmss(total_seconds: float) -> String:
|
||||
#total_seconds = 12345
|
||||
var seconds: float = fmod(total_seconds , 60.0)
|
||||
|
|
22
main.tscn
22
main.tscn
File diff suppressed because one or more lines are too long
|
@ -59,8 +59,7 @@ restart={
|
|||
}
|
||||
jump={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
]
|
||||
"events": []
|
||||
}
|
||||
quare={
|
||||
"deadzone": 0.5,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue