core game logic done
This commit is contained in:
@@ -1 +1,46 @@
|
||||
'''
|
||||
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.1 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
|
||||
|
Reference in New Issue
Block a user