v1.0 finished

This commit is contained in:
2025-03-22 22:27:56 -04:00
parent f61114dce9
commit 5228b81e8b
19 changed files with 48 additions and 51 deletions

View File

@@ -3,7 +3,7 @@ Attempts to simulate human-esc responses.
green - good at subtraction
red - good at multiplication
blue - good at division
blue - good at addition
'''
extends Node
@@ -24,7 +24,7 @@ func _physics_process(_delta: float) -> void:
elif GLOBALVARS.selected_player == 2:
faster_operand = "*"
elif GLOBALVARS.selected_player == 3:
faster_operand = "/"
faster_operand = "+"
if GLOBALVARS.current_operand == faster_operand:
wait_time = randi_range(45,120)

View File

@@ -8,6 +8,8 @@ func _physics_process(_delta: float) -> void:
Controls where the camera is pointed based on which player is selected
'''
fov = ((20.0 * GLOBALVARS.seconds_left/GLOBALVARS.start_seconds)+20.0)
target_angle = (abs(GLOBALVARS.selected_player) * 90)
if current_angle != target_angle:
current_angle += 0.1*(target_angle-current_angle)

View File

@@ -24,7 +24,9 @@ func _explode():
func _determine_seconds_left() -> float:
var difficulty_calc:float = 20-float(GLOBALVARS.difficulty)
return difficulty_calc if difficulty_calc >= 3.0 else 3.0
difficulty_calc = difficulty_calc if difficulty_calc >= 3.0 else 3.0
GLOBALVARS.start_seconds = difficulty_calc
return difficulty_calc
func _on_answer_text_submitted(_new_text: String) -> void:
if GLOBALVARS.current_solution == (%ANSWER.text).to_int() and (%ANSWER.text).is_valid_int():
@@ -49,41 +51,26 @@ func _generate_question() -> void:
# 0 - add
# 1 - subtract
# 2 - multiply
# 3 - divide
var rand_int:int = randi_range(0,2)
var x:int = randi_range(1,10)
var y:int = randi_range(1,10)
var rand_int:int = randi_range(0,3)
var x:int
var y:int
if rand_int == 0:
x = randi_range(1,50)
y = randi_range(1,20)
GLOBALVARS.current_solution = x+y
GLOBALVARS.current_operand = "+"
elif rand_int == 1:
x = randi_range(1,50)
y = randi_range(1,20)
GLOBALVARS.current_solution = x-y
GLOBALVARS.current_operand = "-"
elif rand_int == 2:
x = randi_range(0,10) # simplify multiplication
y = randi_range(0,10)
x = randi_range(0,12) # simplify multiplication
y = randi_range(0,12)
GLOBALVARS.current_solution = x*y
GLOBALVARS.current_operand = "*"
elif rand_int == 3:
var fail:int = 0
var solution:int
GLOBALVARS.current_operand = "/"
while x%y != 0 and fail < 10000: # keep going til the remainder is 0
x = randi_range(1,10)
y = randi_range(1,10)
@warning_ignore('integer_division')
solution = floor(x/y)
fail+=1
GLOBALVARS.current_solution = solution
if fail >= 10000: # fallback to addition if no division problem can be found in 10000 loops
GLOBALVARS.current_operand = "+"
GLOBALVARS.current_solution = x+y
%QUESTION.text = "%s %s %s = " % [x,GLOBALVARS.current_operand,y]
%QUESTION.visible = true
@@ -103,7 +90,9 @@ func _physics_process(_delta: float) -> void:
if GLOBALVARS.selected_player == 0:
%ANSWER.editable = true
%ANSWER.grab_focus()
%ANSWER.edit()
else:
%ANSWER.release_focus()
%ANSWER.editable = false
if GLOBALVARS.seconds_left <= 0:

View File

@@ -7,10 +7,10 @@ var rotation_paused:bool = false
var players_remaining:Array = [0,1,2,3]
var current_solution:int
var current_operand:String = ""
var start_seconds:float = 0.0
func reset_variables() -> void:
selected_player = 0
seconds_left = 20.0
difficulty = 1
rotation_paused = false
current_operand = ""

View File

@@ -1,7 +1,7 @@
extends Node
func _ready() -> void:
%VERSION.text = ProjectSettings.get_setting("application/config/version")
%VERSION.text = "v" + ProjectSettings.get_setting("application/config/version")
func _on_start_button_pressed() -> void:
GLOBALVARS.reset_variables()