fixed several bugs
This commit is contained in:
parent
7a2d2b6493
commit
1c1447d84e
@ -106,6 +106,9 @@ context_menu_enabled = false
|
||||
emoji_menu_enabled = false
|
||||
shortcut_keys_enabled = false
|
||||
middle_mouse_paste_enabled = false
|
||||
deselect_on_focus_loss_enabled = false
|
||||
drag_and_drop_selection_enabled = false
|
||||
flat = true
|
||||
caret_blink = true
|
||||
|
||||
[connection signal="text_submitted" from="UI/PanelContainer/VBoxContainer/HBoxContainer/ANSWER" to="." method="_on_answer_text_submitted"]
|
||||
|
@ -31,7 +31,7 @@ func _physics_process(_delta: float) -> void:
|
||||
is_correct = true if randf() > 0.05 else false
|
||||
else:
|
||||
wait_time = randi_range(60,350)
|
||||
is_correct = true if randf() > 0.1 else false
|
||||
is_correct = true if randf() > 0.15 else false
|
||||
currently_executing = true
|
||||
|
||||
elif clock > wait_time:
|
||||
|
@ -7,12 +7,14 @@ 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
|
||||
@ -20,6 +22,8 @@ func _on_answer_text_submitted(_new_text: String) -> void:
|
||||
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:
|
||||
|
@ -2,7 +2,7 @@ extends Node
|
||||
|
||||
var selected_player:int = 0
|
||||
var seconds_left:float = 0.0
|
||||
var difficulty:int = 1
|
||||
var difficulty:float = 1.0
|
||||
var rotation_paused:bool = false
|
||||
var players_remaining:Array = [0,1,2,3]
|
||||
var current_solution:int
|
||||
|
Reference in New Issue
Block a user