fix most of the script errors and warnings, fixed a couple tiny bugs in the process :)
This commit is contained in:
parent
9435089f21
commit
72733db609
23 changed files with 55 additions and 63 deletions
|
@ -95,7 +95,7 @@ func _set_difficulty(value: int) -> void:
|
|||
func instance_node(node:PackedScene,x:float,y:float,parent):
|
||||
var Instance = node.instance()
|
||||
Instance.global_position = Vector2(x,y)
|
||||
parent.add_child(Instance)
|
||||
parent.call_deferred("add_child", Instance)
|
||||
|
||||
#Get position in sectors
|
||||
func get_sector(pos):
|
||||
|
@ -122,12 +122,12 @@ func tally_scores() -> void:
|
|||
shards_collected[5] = true
|
||||
# 100% time bonus
|
||||
if time < map.target_time_100:
|
||||
time_bonus = max(2500 - int(2500.0 * time / map.target_time_100), 0)
|
||||
time_bonus = max(2500 - int(2500.0 * time / map.target_time_100), 0) as int
|
||||
shards_collected[6] = true
|
||||
else:
|
||||
# any% time bonus
|
||||
if time < map.target_time_any:
|
||||
time_bonus = max(2500 - int(2500.0 * time / map.target_time_any), 0)
|
||||
time_bonus = max(2500 - int(2500.0 * time / map.target_time_any), 0) as int
|
||||
shards_collected[6] = true
|
||||
# life bonus
|
||||
if deaths == 0:
|
||||
|
@ -195,10 +195,10 @@ func save():
|
|||
|
||||
# save score and time depending on completion
|
||||
if _get_shards() >= 5 && keys >= 50:
|
||||
save_data.score_100 = max(save_data.score_100, final_score)
|
||||
save_data.score_100 = max(save_data.score_100, final_score) as int
|
||||
save_data.time_100 = min(save_data.time_100, time)
|
||||
else:
|
||||
save_data.score_any = max(save_data.score_any, final_score)
|
||||
save_data.score_any = max(save_data.score_any, final_score) as int
|
||||
save_data.time_any = min(save_data.time_any, time)
|
||||
|
||||
# set shards
|
||||
|
@ -207,7 +207,7 @@ func save():
|
|||
save_data.shards_collected[i] = true
|
||||
|
||||
# set keys
|
||||
save_data.keys_collected = max(save_data.keys_collected, keys)
|
||||
save_data.keys_collected = max(save_data.keys_collected, keys) as int
|
||||
|
||||
# mark as completed
|
||||
save_data.completed = true
|
||||
|
@ -272,9 +272,9 @@ func restart_level():
|
|||
Audio.ac_music.stream_paused = false
|
||||
|
||||
#Freeze frame
|
||||
func freeze_frame(time):
|
||||
func freeze_frame(freeze_time):
|
||||
get_tree().paused = true
|
||||
var timer = get_tree().create_timer(time, true)
|
||||
var timer = get_tree().create_timer(freeze_time, true)
|
||||
timer.connect("timeout", get_tree(), "set_pause", [false])
|
||||
return timer
|
||||
|
||||
|
@ -321,6 +321,6 @@ func _on_player_died() -> void:
|
|||
Audio.play_sound(Audio.a_die, Audio.ac_die)
|
||||
# death score penalty
|
||||
if use_lives == false && lives < 0:
|
||||
score = max(0, score - 500)
|
||||
score = max(0, score - 500) as int
|
||||
# freezeframe
|
||||
Game.freeze_frame(0.3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue