added scream

This commit is contained in:
2025-03-22 13:41:16 -04:00
parent 8250f073a7
commit 571197baa7
8 changed files with 76 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
extends Node
var cooldown:int = 0
static var SCREAM_ARRAY:Array = [0,1]
func _determine_seconds_left() -> float:
var difficulty_calc:float = 20-float(GLOBALVARS.difficulty)
@@ -16,6 +17,8 @@ func _on_answer_text_submitted(_new_text: String) -> void:
GLOBALVARS.seconds_left = _determine_seconds_left()
_generate_question()
else:
%SCREAM.stream = load("res://assets/sounds/scream_%s.wav" % SCREAM_ARRAY.pick_random())
%SCREAM.play()
%RULE_ENFORCEMENT.explode()
cooldown = 60
GLOBALVARS.rotation_paused = true
@@ -41,8 +44,8 @@ func _generate_question() -> void:
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,15) # simplify multiplication
y = randi_range(0,15)
GLOBALVARS.current_solution = x*y
GLOBALVARS.current_operand = "*"
elif rand_int == 3:
@@ -84,13 +87,14 @@ func _physics_process(_delta: float) -> void:
GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4
_generate_question()
%RULE_ENFORCEMENT.reset_rule_enforcement_device()
GLOBALVARS.rotation_paused = false
elif 0 in GLOBALVARS.players_remaining:
pass # WIN CONDITION
get_tree().change_scene_to_file("res://main_scenes/menu.tscn")
else:
get_tree().change_scene_to_file("res://main_scenes/menu.tscn")
GLOBALVARS.rotation_paused = false
%RULE_ENFORCEMENT.reset_rule_enforcement_device()
elif GLOBALVARS.rotation_paused:
cooldown -= 1