1
0
This repository has been archived on 2025-06-02. You can view files and clone it, but cannot push or open issues or pull requests.
2025-03-21 18:43:29 -04:00

47 lines
1.2 KiB
GDScript

'''
Attempts to simulate human-esc responses.
green - good at subtraction
red - good at multiplication
blue - good at division
'''
extends Node
var currently_executing:bool = false
var faster_operand:String = ""
var wait_time:int
var is_correct:bool
var clock:int
func _physics_process(_delta: float) -> void:
if GLOBALVARS.selected_player != 0:
if not currently_executing:
clock = 0
if GLOBALVARS.selected_player == 1:
faster_operand = "-"
elif GLOBALVARS.selected_player == 2:
faster_operand = "*"
elif GLOBALVARS.selected_player == 3:
faster_operand = "/"
if GLOBALVARS.current_operand == faster_operand:
wait_time = randi_range(50,120)
is_correct = true if randf() > 0.05 else false
else:
wait_time = randi_range(60,350)
is_correct = true if randf() > 0.15 else false
currently_executing = true
elif clock > wait_time:
if %ANSWER.text == "":
%ANSWER.text = str(GLOBALVARS.current_solution) if is_correct else str(GLOBALVARS.current_solution+randi_range(-10,10))
elif clock > wait_time + 30:
%ANSWER.emit_signal("text_submitted",%ANSWER.text)
currently_executing = false
else:
clock+=1
else:
clock+=1