Compare commits

...

10 Commits

Author SHA1 Message Date
3c57f18952 changed stretch mode to allow for scaling and web export 2025-03-23 18:30:04 -04:00
2a177a8cb5 removed other placeholder files 2025-03-23 18:12:09 -04:00
de676d74c2 updated readme, deleted placeholder files 2025-03-23 17:15:27 -04:00
9254ee274e minor change in credits formatting 2025-03-22 22:39:39 -04:00
5228b81e8b v1.0 finished 2025-03-22 22:27:56 -04:00
f61114dce9 fixed some title stuff 2025-03-22 20:15:41 -04:00
bd014b7e1d added win/lose text and fixed several bugs 2025-03-22 20:05:25 -04:00
571197baa7 added scream 2025-03-22 13:41:16 -04:00
8250f073a7 added grab_focus() call 2025-03-21 19:21:26 -04:00
1c1447d84e fixed several bugs 2025-03-21 18:43:29 -04:00
32 changed files with 277 additions and 97 deletions

View File

@@ -8,9 +8,11 @@
- https://freesound.org/people/craigsmith/sounds/483320/ - https://freesound.org/people/craigsmith/sounds/483320/
- https://freesound.org/people/Logicogonist/sounds/685293/ - https://freesound.org/people/Logicogonist/sounds/685293/
- https://www.youtube.com/watch?v=PP7WJL2JtLs (NOT CC0)
- https://www.youtube.com/watch?v=vG2I7r4qlEA (NOT CC0)
# Fonts # Fonts
https://fontlibrary.org/en/font/autobahn (Open Font License) - https://fontlibrary.org/en/font/autobahn (Open Font License)
https://fontlibrary.org/en/font/single-day-regular (Open Font License) - https://fontlibrary.org/en/font/single-day-regular (Open Font License)
https://fontlibrary.org/en/font/lcd (Open Font License) - https://fontlibrary.org/en/font/lcd (Open Font License)

View File

@@ -1,3 +1,29 @@
# VCGJ 2025 # VCGJ 2025
`Theme: Hold It!` `Theme: Hold It!`
# Extremely Intense Mathematics
A simple math game where you have to compete against three other little guys. Be the last player standing to win.
The four players take turn holding what is known as the "rule enforcement device"
The initial time set on the rule enforcement device before it "enforces the rules" decreases each time a question is answered correctly.
Each time a question is answered correctly, the device is handed to the next player and the device has the time reset.
The three other players have their own strengths:
- Green: Good at subtraction
- Red: Good at multiplication
- Blue: Good at addition
# Usage
Everything I have made in this project is CC0 and should be considered public domain. All outside resources are also CC0 with the exception of:
```
https://code.lexza.ch/Lexzach/extremely-intense-mathematics/src/branch/main/godot/assets/sounds/scream_0.wav
https://code.lexza.ch/Lexzach/extremely-intense-mathematics/src/branch/main/godot/assets/sounds/scream_1.wav
https://code.lexza.ch/Lexzach/extremely-intense-mathematics/src/branch/main/godot/assets/fonts/18938.ttf
https://code.lexza.ch/Lexzach/extremely-intense-mathematics/src/branch/main/godot/assets/fonts/autobahn.ttf
https://code.lexza.ch/Lexzach/extremely-intense-mathematics/src/branch/main/godot/assets/fonts/LCD14.otf
```

View File

@@ -1 +0,0 @@

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

BIN
blender/icons/icon.blend Normal file

Binary file not shown.

BIN
blender/icons/icon.blend1 Normal file

Binary file not shown.

BIN
blender/icons/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
blender/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@@ -1 +0,0 @@

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cue207ror7nu1"
path="res://.godot/imported/scream_0.wav-02df26ebad5a19c7729367e401d0d455.sample"
[deps]
source_file="res://assets/sounds/scream_0.wav"
dest_files=["res://.godot/imported/scream_0.wav-02df26ebad5a19c7729367e401d0d455.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bpwo61rj7l875"
path="res://.godot/imported/scream_1.wav-31f38f99f8e9098584bf4fec372c5d41.sample"
[deps]
source_file="res://assets/sounds/scream_1.wav"
dest_files=["res://.godot/imported/scream_1.wav-31f38f99f8e9098584bf4fec372c5d41.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

BIN
godot/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

BIN
godot/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View File

@@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://c1pb0yn1ehxho" uid="uid://c7q670yi3gsgk"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://icon.svg" source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
[params] [params]
@@ -32,6 +32,3 @@ process/hdr_as_srgb=false
process/hdr_clamp_exposure=false process/hdr_clamp_exposure=false
process/size_limit=0 process/size_limit=0
detect_3d/compress_to=1 detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

Before

Width:  |  Height:  |  Size: 994 B

View File

@@ -61,29 +61,32 @@ transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0,
[node name="player_3" parent="players" instance=ExtResource("6_8vhnl")] [node name="player_3" parent="players" instance=ExtResource("6_8vhnl")]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 4, 0, 0) transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 4, 0, 0)
[node name="Camera3D" type="Camera3D" parent="."] [node name="CAMERA" type="Camera3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.910084, 0.414423, 0, -0.414423, 0.910084, 0, 3.4199, 0) transform = Transform3D(1, 0, 0, 0, 0.910084, 0.414423, 0, -0.414423, 0.910084, 0, 3.4199, 0)
fov = 60.0 fov = 41.4
size = 0.013
script = ExtResource("2_joe7c") script = ExtResource("2_joe7c")
[node name="RULE_ENFORCEMENT" parent="Camera3D" instance=ExtResource("7_0rqic")] [node name="RULE_ENFORCEMENT" parent="CAMERA" instance=ExtResource("7_0rqic")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(-0.0475354, -0.0535728, 0.270738, 0.266451, 0.0626881, 0.0591871, -0.0719257, 0.267636, 0.0403304, 0.0257539, -0.692888, -4.06508) transform = Transform3D(-0.0475354, -0.0535728, 0.270738, 0.266451, 0.0626881, 0.0591871, -0.0719257, 0.267636, 0.0403304, 0.0257539, -0.692888, -4.06508)
[node name="UI" type="Control" parent="."] [node name="UI" type="MarginContainer" parent="."]
layout_mode = 3 anchors_preset = 15
anchors_preset = 0 anchor_right = 1.0
offset_right = 40.0 anchor_bottom = 1.0
offset_bottom = 40.0 grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="PanelContainer" type="PanelContainer" parent="UI"] [node name="PanelContainer" type="PanelContainer" parent="UI"]
layout_mode = 0 layout_mode = 2
offset_right = 40.0
offset_bottom = 40.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_sp4xh") theme_override_styles/panel = SubResource("StyleBoxEmpty_sp4xh")
[node name="VBoxContainer" type="VBoxContainer" parent="UI/PanelContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="UI/PanelContainer"]
layout_mode = 2 layout_mode = 2
alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="UI/PanelContainer/VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="UI/PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
@@ -106,6 +109,27 @@ 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
[node name="CenterContainer" type="CenterContainer" parent="UI"]
layout_mode = 2
mouse_filter = 2
[node name="WINLOSE" type="Label" parent="UI/CenterContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme_override_fonts/font = ExtResource("9_im5ls")
theme_override_font_sizes/font_size = 200
text = "TEST"
horizontal_alignment = 1
vertical_alignment = 1
[node name="SCREAM" type="AudioStreamPlayer3D" parent="."]
unique_name_in_owner = true
panning_strength = 0.0
[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

@@ -1,62 +1,88 @@
[gd_scene load_steps=6 format=3 uid="uid://v7vh1typhj0k"] [gd_scene load_steps=5 format=3 uid="uid://v7vh1typhj0k"]
[ext_resource type="FontFile" uid="uid://crvjehkpjh5r4" path="res://assets/fonts/autobahn.ttf" id="1_38vls"] [ext_resource type="FontFile" uid="uid://crvjehkpjh5r4" path="res://assets/fonts/autobahn.ttf" id="1_38vls"]
[ext_resource type="Script" uid="uid://xilsm8v1rt1t" path="res://scripts/menu.gd" id="1_f5540"] [ext_resource type="Script" uid="uid://xilsm8v1rt1t" path="res://scripts/menu.gd" id="1_f5540"]
[ext_resource type="FontFile" uid="uid://byv0ntqpvosrc" path="res://assets/fonts/18938.ttf" id="2_1xsbm"] [ext_resource type="FontFile" uid="uid://byv0ntqpvosrc" path="res://assets/fonts/18938.ttf" id="2_1xsbm"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1xsbm"]
content_margin_left = 40.0
content_margin_top = 40.0
content_margin_right = 40.0
content_margin_bottom = 40.0
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_38vls"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_38vls"]
[node name="Menu" type="Control"] [node name="Menu" type="MarginContainer"]
layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme_override_constants/margin_left = 40
theme_override_constants/margin_top = 40
theme_override_constants/margin_right = 40
theme_override_constants/margin_bottom = 40
script = ExtResource("1_f5540") script = ExtResource("1_f5540")
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_1xsbm")
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer"]
layout_mode = 2 layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/HBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="title" type="Label" parent="PanelContainer/HBoxContainer/VBoxContainer"] [node name="title" type="Label" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_fonts/font = ExtResource("1_38vls") theme_override_fonts/font = ExtResource("1_38vls")
theme_override_font_sizes/font_size = 120 theme_override_font_sizes/font_size = 120
text = "Extreme Mathematics" text = "Extremely Intense Mathematics"
[node name="author" type="Label" parent="PanelContainer/HBoxContainer/VBoxContainer"] [node name="HSeparator" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme_override_fonts/font = ExtResource("2_1xsbm") theme_override_constants/separation = 105
theme_override_font_sizes/font_size = 50
text = "Made by Lexzach (Zach Bowden)"
[node name="HSeparator" type="HSeparator" parent="PanelContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 180
theme_override_styles/separator = SubResource("StyleBoxEmpty_38vls") theme_override_styles/separator = SubResource("StyleBoxEmpty_38vls")
[node name="start_button" type="Button" parent="PanelContainer/HBoxContainer/VBoxContainer"] [node name="start_button" type="Button" parent="HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 0) custom_minimum_size = Vector2(400, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 4 size_flags_horizontal = 0
size_flags_vertical = 4
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
theme_override_fonts/font = ExtResource("1_38vls") theme_override_fonts/font = ExtResource("1_38vls")
theme_override_font_sizes/font_size = 96 theme_override_font_sizes/font_size = 96
text = "Play" text = "Play"
[connection signal="pressed" from="PanelContainer/HBoxContainer/VBoxContainer/start_button" to="." method="_on_start_button_pressed"] [node name="HSeparator2" type="HSeparator" parent="HBoxContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 45
theme_override_styles/separator = SubResource("StyleBoxEmpty_38vls")
[node name="quit_button" type="Button" parent="HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(400, 0)
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 4
mouse_default_cursor_shape = 2
theme_override_fonts/font = ExtResource("1_38vls")
theme_override_font_sizes/font_size = 96
text = "Quit"
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
mouse_filter = 2
alignment = 2
[node name="VERSION" type="Label" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("2_1xsbm")
theme_override_font_sizes/font_size = 50
text = "Version"
[node name="author" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_1xsbm")
theme_override_font_sizes/font_size = 50
text = "Made by Lexzach (Zach Bowden)"
[node name="about" type="Label" parent="VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("2_1xsbm")
theme_override_font_sizes/font_size = 50
text = "Created for the Virginia Collegiate Game Jam 2025"
[connection signal="pressed" from="HBoxContainer/VBoxContainer/start_button" to="." method="_on_start_button_pressed"]
[connection signal="pressed" from="HBoxContainer/VBoxContainer/quit_button" to="." method="_on_quit_button_pressed"]

View File

@@ -10,10 +10,15 @@ config_version=5
[application] [application]
config/name="Extremely Intense Math" config/name="Extremely Intense Mathematics"
config/version="1.1"
run/main_scene="uid://v7vh1typhj0k" run/main_scene="uid://v7vh1typhj0k"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg" boot_splash/bg_color=Color(0, 0, 0, 1)
boot_splash/show_image=false
boot_splash/fullsize=false
config/icon="uid://c7q670yi3gsgk"
config/windows_native_icon="res://icon.ico"
[autoload] [autoload]
@@ -23,6 +28,7 @@ GLOBALVARS="*res://scripts/globalvars.gd"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/stretch/mode="viewport"
[input] [input]

View File

@@ -3,7 +3,7 @@ Attempts to simulate human-esc responses.
green - good at subtraction green - good at subtraction
red - good at multiplication red - good at multiplication
blue - good at division blue - good at addition
''' '''
extends Node extends Node
@@ -12,35 +12,39 @@ var currently_executing:bool = false
var faster_operand:String = "" var faster_operand:String = ""
var wait_time:int var wait_time:int
var is_correct:bool var is_correct:bool
var last_executed_player:int
var clock:int var clock:int = 0
func _physics_process(_delta: float) -> void: func _physics_process(_delta: float) -> void:
if GLOBALVARS.selected_player != 0: if GLOBALVARS.selected_player != 0:
if not currently_executing: if not currently_executing and GLOBALVARS.selected_player != last_executed_player:
clock = 0
if GLOBALVARS.selected_player == 1: if GLOBALVARS.selected_player == 1:
faster_operand = "-" faster_operand = "-"
elif GLOBALVARS.selected_player == 2: elif GLOBALVARS.selected_player == 2:
faster_operand = "*" faster_operand = "*"
elif GLOBALVARS.selected_player == 3: elif GLOBALVARS.selected_player == 3:
faster_operand = "/" faster_operand = "+"
if GLOBALVARS.current_operand == faster_operand: if GLOBALVARS.current_operand == faster_operand:
wait_time = randi_range(50,120) wait_time = randi_range(45,120)
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
last_executed_player = GLOBALVARS.selected_player
elif clock > wait_time: elif clock > wait_time and currently_executing:
if %ANSWER.text == "": if %ANSWER.text == "":
%ANSWER.text = str(GLOBALVARS.current_solution) if is_correct else str(GLOBALVARS.current_solution+randi_range(-10,10)) %ANSWER.text = str(GLOBALVARS.current_solution) if is_correct else str(GLOBALVARS.current_solution+(1 if randf() > .5 else -1))
elif clock > wait_time + 30: elif clock > wait_time + 30:
%ANSWER.emit_signal("text_submitted",%ANSWER.text) %ANSWER.emit_signal("text_submitted",%ANSWER.text)
currently_executing = false currently_executing = false
clock = 0
else: else:
clock+=1 clock+=1
else: else:
clock+=1 clock+=1
else:
last_executed_player = 0

View File

@@ -8,6 +8,8 @@ func _physics_process(_delta: float) -> void:
Controls where the camera is pointed based on which player is selected 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) target_angle = (abs(GLOBALVARS.selected_player) * 90)
if current_angle != target_angle: if current_angle != target_angle:
current_angle += 0.1*(target_angle-current_angle) current_angle += 0.1*(target_angle-current_angle)

View File

@@ -1,58 +1,86 @@
extends Node extends Node
var cooldown:int = 0 var cooldown:int = 0
static var SCREAM_ARRAY:Array = [0,1]
func _explode():
%SCREAM.stream = load("res://assets/sounds/scream_%s.wav" % SCREAM_ARRAY.pick_random())
%SCREAM.play()
%RULE_ENFORCEMENT.explode()
%QUESTION.visible = false
%ANSWER.visible = false
cooldown = 180
if GLOBALVARS.selected_player == 0:
%WINLOSE.visible = true
%WINLOSE.self_modulate = Color(1,0,0)
%WINLOSE.text = ":("
elif GLOBALVARS.players_remaining == [0]:
%WINLOSE.visible = true
%WINLOSE.self_modulate = Color(0,1,0)
%WINLOSE.text = "You Win! :)"
else:
cooldown = 60
func _determine_seconds_left() -> float: func _determine_seconds_left() -> float:
var difficulty_calc:float = 20-float(GLOBALVARS.difficulty) 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: 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() GLOBALVARS.seconds_left = _determine_seconds_left()
cooldown = 60
GLOBALVARS.rotation_paused = true GLOBALVARS.rotation_paused = true
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()
_explode()
%ANSWER.text = ""
func _generate_question() -> void: func _generate_question() -> void:
# 0 - add # 0 - add
# 1 - subtract # 1 - subtract
# 2 - multiply # 2 - multiply
# 3 - divide var rand_int:int = randi_range(0,2)
var x:int = randi_range(1,100) var x:int
var y:int = randi_range(1,100) var y:int
var rand_int:int = randi_range(0,3)
if rand_int == 0: if rand_int == 0:
x = randi_range(1,50)
y = randi_range(1,20)
GLOBALVARS.current_solution = x+y GLOBALVARS.current_solution = x+y
GLOBALVARS.current_operand = "+" GLOBALVARS.current_operand = "+"
elif rand_int == 1: elif rand_int == 1:
x = randi_range(1,50)
y = randi_range(1,20)
GLOBALVARS.current_solution = x-y GLOBALVARS.current_solution = x-y
GLOBALVARS.current_operand = "-" GLOBALVARS.current_operand = "-"
elif rand_int == 2: elif rand_int == 2:
x = randi_range(0,10) # simplify multiplication x = randi_range(0,12) # simplify multiplication
y = randi_range(0,10) y = randi_range(0,12)
GLOBALVARS.current_solution = x*y GLOBALVARS.current_solution = x*y
GLOBALVARS.current_operand = "*" GLOBALVARS.current_operand = "*"
elif rand_int == 3:
GLOBALVARS.current_operand = "/"
while x%y != 0: # keep going til the remainder is 0
x = randi_range(0,100)
y = randi_range(1,100)
@warning_ignore('integer_division')
GLOBALVARS.current_solution = x/y
%QUESTION.text = "%s %s %s = " % [x,GLOBALVARS.current_operand,y] %QUESTION.text = "%s %s %s = " % [x,GLOBALVARS.current_operand,y]
%QUESTION.visible = true
%ANSWER.visible = true
func _ready() -> void: func _ready() -> void:
%QUESTION.visible = true
%ANSWER.visible = true
%WINLOSE.visible = false
%WINLOSE.text = ""
GLOBALVARS.seconds_left = _determine_seconds_left() GLOBALVARS.seconds_left = _determine_seconds_left()
_generate_question() _generate_question()
@@ -61,30 +89,31 @@ func _physics_process(_delta: float) -> void:
GLOBALVARS.seconds_left -= 0.01666666667 GLOBALVARS.seconds_left -= 0.01666666667
if GLOBALVARS.selected_player == 0: if GLOBALVARS.selected_player == 0:
%ANSWER.editable = true %ANSWER.editable = true
%ANSWER.grab_focus()
%ANSWER.edit()
else: else:
%ANSWER.release_focus()
%ANSWER.editable = false %ANSWER.editable = false
if GLOBALVARS.seconds_left <= 0: if GLOBALVARS.seconds_left <= 0:
%RULE_ENFORCEMENT.explode()
cooldown = 60
GLOBALVARS.seconds_left = _determine_seconds_left() GLOBALVARS.seconds_left = _determine_seconds_left()
GLOBALVARS.rotation_paused = true GLOBALVARS.rotation_paused = true
if GLOBALVARS.selected_player in GLOBALVARS.players_remaining: if GLOBALVARS.selected_player in GLOBALVARS.players_remaining:
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()
_explode()
if cooldown <= 0 and GLOBALVARS.rotation_paused: if cooldown <= 0 and GLOBALVARS.rotation_paused:
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()
elif 0 in GLOBALVARS.players_remaining: _generate_question()
pass # WIN CONDITION %RULE_ENFORCEMENT.reset_rule_enforcement_device()
GLOBALVARS.rotation_paused = false
else: else:
get_tree().change_scene_to_file("res://main_scenes/menu.tscn") 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: elif GLOBALVARS.rotation_paused:
cooldown -= 1 cooldown -= 1

View File

@@ -2,15 +2,15 @@ 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
var current_operand:String = "" var current_operand:String = ""
var start_seconds:float = 0.0
func reset_variables() -> void: func reset_variables() -> void:
selected_player = 0 selected_player = 0
seconds_left = 20.0
difficulty = 1 difficulty = 1
rotation_paused = false rotation_paused = false
current_operand = "" current_operand = ""

View File

@@ -1,6 +1,11 @@
extends Node extends Node
func _ready() -> void:
%VERSION.text = "v" + ProjectSettings.get_setting("application/config/version")
func _on_start_button_pressed() -> void: func _on_start_button_pressed() -> void:
GLOBALVARS.reset_variables() GLOBALVARS.reset_variables()
get_tree().change_scene_to_file("res://main_scenes/game.tscn") get_tree().change_scene_to_file("res://main_scenes/game.tscn")
func _on_quit_button_pressed() -> void:
get_tree().quit(0)

View File

@@ -2,13 +2,17 @@ extends Node3D
static var FUSE_SOUND:AudioStream = preload("res://assets/sounds/fuse.ogg") static var FUSE_SOUND:AudioStream = preload("res://assets/sounds/fuse.ogg")
static var EXPLOSION_SOUND:AudioStream = preload("res://assets/sounds/explode.wav") static var EXPLOSION_SOUND:AudioStream = preload("res://assets/sounds/explode.wav")
static var JITTER_AMOUNT:int = 10
static var ENFORCEMENT_DEVICE_JITTER_AMOUNT:float = 0.005
var grow_explosion:bool = false var grow_explosion:bool = false
var original_position:Vector3
func reset_rule_enforcement_device() -> void: func reset_rule_enforcement_device() -> void:
''' '''
Start the fuse sound Start the fuse sound
''' '''
%SOUNDS.stream = FUSE_SOUND %SOUNDS.stream = FUSE_SOUND
%SOUNDS.volume_db = -10 %SOUNDS.volume_db = -10
%SOUNDS.play() %SOUNDS.play()
@@ -29,12 +33,23 @@ func explode() -> void:
%EXPLOSION.visible = true %EXPLOSION.visible = true
func _ready() -> void: func _ready() -> void:
original_position = position
reset_rule_enforcement_device() reset_rule_enforcement_device()
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
%TIME_LEFT.text = ("%.02f" % GLOBALVARS.seconds_left).replace(".",":") %TIME_LEFT.text = ("%.02f" % GLOBALVARS.seconds_left).replace(".",":")
position = original_position + Vector3(
randf_range(-ENFORCEMENT_DEVICE_JITTER_AMOUNT,ENFORCEMENT_DEVICE_JITTER_AMOUNT),
randf_range(-ENFORCEMENT_DEVICE_JITTER_AMOUNT,ENFORCEMENT_DEVICE_JITTER_AMOUNT),
randf_range(-ENFORCEMENT_DEVICE_JITTER_AMOUNT,ENFORCEMENT_DEVICE_JITTER_AMOUNT)
)
if grow_explosion and %EXPLOSION.scale < Vector3(3,3,3): if grow_explosion and %EXPLOSION.scale < Vector3(3,3,3):
%EXPLOSION.scale += Vector3(0.2,0.2,0.2) %EXPLOSION.scale += Vector3(0.25,0.25,0.25)
%EXPLOSION.rotation_degrees += Vector3(
randf_range(-JITTER_AMOUNT,JITTER_AMOUNT),
randf_range(-JITTER_AMOUNT,JITTER_AMOUNT),
randf_range(-JITTER_AMOUNT,JITTER_AMOUNT)
)
elif grow_explosion: elif grow_explosion:
%EXPLOSION.visible = false %EXPLOSION.visible = false
visible = false visible = false

View File

@@ -1 +0,0 @@

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 KiB