fixed several bugs
This commit is contained in:
@@ -7,19 +7,23 @@ func _determine_seconds_left() -> float:
|
||||
return difficulty_calc if difficulty_calc >= 3.0 else 3.0
|
||||
|
||||
func _on_answer_text_submitted(_new_text: String) -> void:
|
||||
if GLOBALVARS.current_solution == (%ANSWER.text).to_int():
|
||||
if GLOBALVARS.current_solution == (%ANSWER.text).to_int() and (%ANSWER.text).is_valid_int():
|
||||
GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4
|
||||
GLOBALVARS.difficulty+=1
|
||||
while GLOBALVARS.selected_player not in GLOBALVARS.players_remaining:
|
||||
GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4
|
||||
|
||||
GLOBALVARS.difficulty+=.5
|
||||
GLOBALVARS.seconds_left = _determine_seconds_left()
|
||||
_generate_question()
|
||||
%ANSWER.text = ""
|
||||
else:
|
||||
%RULE_ENFORCEMENT.explode()
|
||||
cooldown = 60
|
||||
GLOBALVARS.rotation_paused = true
|
||||
GLOBALVARS.players_remaining.erase(GLOBALVARS.selected_player)
|
||||
get_node("players/player_%s" % GLOBALVARS.selected_player).queue_free()
|
||||
|
||||
|
||||
%ANSWER.text = ""
|
||||
|
||||
func _generate_question() -> void:
|
||||
# 0 - add
|
||||
# 1 - subtract
|
||||
@@ -48,7 +52,7 @@ func _generate_question() -> void:
|
||||
y = randi_range(1,100)
|
||||
|
||||
@warning_ignore('integer_division')
|
||||
GLOBALVARS.current_solution = x/y
|
||||
GLOBALVARS.current_solution = int(x/y)
|
||||
|
||||
%QUESTION.text = "%s %s %s = " % [x,GLOBALVARS.current_operand,y]
|
||||
|
||||
@@ -77,7 +81,8 @@ func _physics_process(_delta: float) -> void:
|
||||
if len(GLOBALVARS.players_remaining) > 1 and 0 in GLOBALVARS.players_remaining:
|
||||
while GLOBALVARS.selected_player not in GLOBALVARS.players_remaining:
|
||||
GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4
|
||||
_generate_question()
|
||||
|
||||
_generate_question()
|
||||
elif 0 in GLOBALVARS.players_remaining:
|
||||
pass # WIN CONDITION
|
||||
else:
|
||||
|
Reference in New Issue
Block a user