1
0

fixed several bugs

This commit is contained in:
Lexzach 2025-03-21 18:43:29 -04:00
parent 7a2d2b6493
commit 1c1447d84e
Signed by: Lexzach
GPG Key ID: 10A6FD067E6060A8
4 changed files with 16 additions and 8 deletions

View File

@ -106,6 +106,9 @@ context_menu_enabled = false
emoji_menu_enabled = false emoji_menu_enabled = false
shortcut_keys_enabled = false shortcut_keys_enabled = false
middle_mouse_paste_enabled = false middle_mouse_paste_enabled = false
deselect_on_focus_loss_enabled = false
drag_and_drop_selection_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"] [connection signal="text_submitted" from="UI/PanelContainer/VBoxContainer/HBoxContainer/ANSWER" to="." method="_on_answer_text_submitted"]

View File

@ -31,7 +31,7 @@ func _physics_process(_delta: float) -> void:
is_correct = true if randf() > 0.05 else false is_correct = true if randf() > 0.05 else false
else: else:
wait_time = randi_range(60,350) 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 currently_executing = true
elif clock > wait_time: elif clock > wait_time:

View File

@ -7,12 +7,14 @@ func _determine_seconds_left() -> float:
return difficulty_calc if difficulty_calc >= 3.0 else 3.0 return difficulty_calc if difficulty_calc >= 3.0 else 3.0
func _on_answer_text_submitted(_new_text: String) -> void: 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.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() GLOBALVARS.seconds_left = _determine_seconds_left()
_generate_question() _generate_question()
%ANSWER.text = ""
else: else:
%RULE_ENFORCEMENT.explode() %RULE_ENFORCEMENT.explode()
cooldown = 60 cooldown = 60
@ -20,6 +22,8 @@ func _on_answer_text_submitted(_new_text: String) -> void:
GLOBALVARS.players_remaining.erase(GLOBALVARS.selected_player) GLOBALVARS.players_remaining.erase(GLOBALVARS.selected_player)
get_node("players/player_%s" % GLOBALVARS.selected_player).queue_free() get_node("players/player_%s" % GLOBALVARS.selected_player).queue_free()
%ANSWER.text = ""
func _generate_question() -> void: func _generate_question() -> void:
# 0 - add # 0 - add
# 1 - subtract # 1 - subtract
@ -48,7 +52,7 @@ func _generate_question() -> void:
y = randi_range(1,100) y = randi_range(1,100)
@warning_ignore('integer_division') @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] %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: if len(GLOBALVARS.players_remaining) > 1 and 0 in GLOBALVARS.players_remaining:
while GLOBALVARS.selected_player not in GLOBALVARS.players_remaining: while GLOBALVARS.selected_player not in GLOBALVARS.players_remaining:
GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4 GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4
_generate_question()
_generate_question()
elif 0 in GLOBALVARS.players_remaining: elif 0 in GLOBALVARS.players_remaining:
pass # WIN CONDITION pass # WIN CONDITION
else: else:

View File

@ -2,7 +2,7 @@ extends Node
var selected_player:int = 0 var selected_player:int = 0
var seconds_left:float = 0.0 var seconds_left:float = 0.0
var difficulty:int = 1 var difficulty:float = 1.0
var rotation_paused:bool = false var rotation_paused:bool = false
var players_remaining:Array = [0,1,2,3] var players_remaining:Array = [0,1,2,3]
var current_solution:int var current_solution:int