diff --git a/CREDITS.md b/CREDITS.md index a6bcdb7..4e54a64 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,4 +1,4 @@ -**ALL ARE CC0** +**ALL ARE CC0 UNLESS OTHERWISE STATED** # Materials @@ -7,4 +7,10 @@ # Sounds - https://freesound.org/people/craigsmith/sounds/483320/ -- https://freesound.org/people/Logicogonist/sounds/685293/ \ No newline at end of file +- https://freesound.org/people/Logicogonist/sounds/685293/ + +# Fonts + +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/lcd (Open Font License) \ No newline at end of file diff --git a/godot/assets/fonts/18938.ttf b/godot/assets/fonts/18938.ttf new file mode 100644 index 0000000..e870674 Binary files /dev/null and b/godot/assets/fonts/18938.ttf differ diff --git a/godot/assets/fonts/18938.ttf.import b/godot/assets/fonts/18938.ttf.import new file mode 100644 index 0000000..5cf167b --- /dev/null +++ b/godot/assets/fonts/18938.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://byv0ntqpvosrc" +path="res://.godot/imported/18938.ttf-44c65153f68ba2b236637f69f1aa270d.fontdata" + +[deps] + +source_file="res://assets/fonts/18938.ttf" +dest_files=["res://.godot/imported/18938.ttf-44c65153f68ba2b236637f69f1aa270d.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/godot/assets/fonts/LCD14.otf b/godot/assets/fonts/LCD14.otf new file mode 100644 index 0000000..e9dabdc Binary files /dev/null and b/godot/assets/fonts/LCD14.otf differ diff --git a/godot/assets/fonts/LCD14.otf.import b/godot/assets/fonts/LCD14.otf.import new file mode 100644 index 0000000..364adca --- /dev/null +++ b/godot/assets/fonts/LCD14.otf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bwpewensb1s18" +path="res://.godot/imported/LCD14.otf-225040cfb523215ca25efb48df7ebbfd.fontdata" + +[deps] + +source_file="res://assets/fonts/LCD14.otf" +dest_files=["res://.godot/imported/LCD14.otf-225040cfb523215ca25efb48df7ebbfd.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/godot/assets/fonts/autobahn.ttf b/godot/assets/fonts/autobahn.ttf new file mode 100644 index 0000000..6585f36 Binary files /dev/null and b/godot/assets/fonts/autobahn.ttf differ diff --git a/godot/assets/fonts/autobahn.ttf.import b/godot/assets/fonts/autobahn.ttf.import new file mode 100644 index 0000000..029c50f --- /dev/null +++ b/godot/assets/fonts/autobahn.ttf.import @@ -0,0 +1,35 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://crvjehkpjh5r4" +path="res://.godot/imported/autobahn.ttf-03d79109ada487313d12a9234c665de8.fontdata" + +[deps] + +source_file="res://assets/fonts/autobahn.ttf" +dest_files=["res://.godot/imported/autobahn.ttf-03d79109ada487313d12a9234c665de8.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=4 +keep_rounding_remainders=true +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/godot/assets/sounds/fuse.ogg.import b/godot/assets/sounds/fuse.ogg.import index b8cbd3b..f109ee6 100644 --- a/godot/assets/sounds/fuse.ogg.import +++ b/godot/assets/sounds/fuse.ogg.import @@ -12,8 +12,8 @@ dest_files=["res://.godot/imported/fuse.ogg-7d54465464d7b04057a763fb3998cd58.ogg [params] -loop=false -loop_offset=0 -bpm=0 +loop=true +loop_offset=0.0 +bpm=0.0 beat_count=0 bar_beats=4 diff --git a/godot/main_scenes/game.tscn b/godot/main_scenes/game.tscn index 157f657..aef6039 100644 --- a/godot/main_scenes/game.tscn +++ b/godot/main_scenes/game.tscn @@ -1,16 +1,26 @@ -[gd_scene load_steps=8 format=3 uid="uid://bqokbcqplgrgp"] +[gd_scene load_steps=12 format=3 uid="uid://bqokbcqplgrgp"] +[ext_resource type="Script" uid="uid://clwubcfa7jndm" path="res://scripts/gamemaster.gd" id="1_sp4xh"] [ext_resource type="PackedScene" uid="uid://bovc5oog85hic" path="res://assets/models/room/room.glb" id="1_wwb56"] [ext_resource type="Script" uid="uid://doxajvf15fv27" path="res://scripts/camera.gd" id="2_joe7c"] [ext_resource type="PackedScene" uid="uid://bw8hdj4fbkpbs" path="res://assets/models/players/player_0.glb" id="3_ofkbr"] [ext_resource type="PackedScene" uid="uid://b4gm46vd64nt2" path="res://assets/models/players/player_1.glb" id="4_is35i"] [ext_resource type="PackedScene" uid="uid://cvvi0laaw1yf" path="res://assets/models/players/player_2.glb" id="5_8vhnl"] [ext_resource type="PackedScene" uid="uid://giuhccerhqit" path="res://assets/models/players/player_3.glb" id="6_8vhnl"] +[ext_resource type="PackedScene" uid="uid://bqo5ur0ipndvs" path="res://sub_scenes/rule_enforcement.tscn" id="7_0rqic"] +[ext_resource type="FontFile" uid="uid://byv0ntqpvosrc" path="res://assets/fonts/18938.ttf" id="9_im5ls"] [sub_resource type="Environment" id="Environment_wwb56"] background_mode = 1 +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_sp4xh"] +content_margin_left = 30.0 +content_margin_top = 30.0 +content_margin_right = 30.0 +content_margin_bottom = 30.0 + [node name="Game" type="Node3D"] +script = ExtResource("1_sp4xh") [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_wwb56") @@ -53,3 +63,37 @@ transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 4, 0, transform = Transform3D(1, 0, 0, 0, 0.910084, 0.414423, 0, -0.414423, 0.910084, 0, 3.4199, 0) fov = 60.0 script = ExtResource("2_joe7c") + +[node name="RULE_ENFORCEMENT" parent="Camera3D" instance=ExtResource("7_0rqic")] +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) + +[node name="UI" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="PanelContainer" type="PanelContainer" parent="UI"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +theme_override_styles/panel = SubResource("StyleBoxEmpty_sp4xh") + +[node name="VBoxContainer" type="VBoxContainer" parent="UI/PanelContainer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="UI/PanelContainer/VBoxContainer"] +layout_mode = 2 + +[node name="question" type="Label" parent="UI/PanelContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("9_im5ls") +theme_override_font_sizes/font_size = 100 +text = "x * y = " + +[node name="answer" type="LineEdit" parent="UI/PanelContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("9_im5ls") +theme_override_font_sizes/font_size = 100 +max_length = 5 diff --git a/godot/main_scenes/menu.tscn b/godot/main_scenes/menu.tscn index b3a5012..5941033 100644 --- a/godot/main_scenes/menu.tscn +++ b/godot/main_scenes/menu.tscn @@ -1,3 +1,62 @@ -[gd_scene format=3 uid="uid://v7vh1typhj0k"] +[gd_scene load_steps=6 format=3 uid="uid://v7vh1typhj0k"] -[node name="Menu" type="Node3D"] +[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="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"] + +[node name="Menu" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_f5540") + +[node name="PanelContainer" type="PanelContainer" 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 + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/HBoxContainer"] +layout_mode = 2 + +[node name="title" type="Label" parent="PanelContainer/HBoxContainer/VBoxContainer"] +layout_mode = 2 +theme_override_fonts/font = ExtResource("1_38vls") +theme_override_font_sizes/font_size = 120 +text = "Extreme Mathematics" + +[node name="author" type="Label" parent="PanelContainer/HBoxContainer/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="HSeparator" type="HSeparator" parent="PanelContainer/HBoxContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 180 +theme_override_styles/separator = SubResource("StyleBoxEmpty_38vls") + +[node name="start_button" type="Button" parent="PanelContainer/HBoxContainer/VBoxContainer"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +size_flags_horizontal = 4 +mouse_default_cursor_shape = 2 +theme_override_fonts/font = ExtResource("1_38vls") +theme_override_font_sizes/font_size = 96 +text = "Play" + +[connection signal="pressed" from="PanelContainer/HBoxContainer/VBoxContainer/start_button" to="." method="_on_start_button_pressed"] diff --git a/godot/project.godot b/godot/project.godot index 6af61ce..8f33e92 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -23,3 +23,15 @@ GLOBALVARS="*res://scripts/globalvars.gd" window/size/viewport_width=1920 window/size/viewport_height=1080 + +[input] + +enter={ +"deadzone": 0.2, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} + +[rendering] + +environment/defaults/default_clear_color=Color(0, 0, 0, 1) diff --git a/godot/scripts/camera.gd b/godot/scripts/camera.gd index 833f074..c4ff4b6 100644 --- a/godot/scripts/camera.gd +++ b/godot/scripts/camera.gd @@ -8,7 +8,7 @@ func _physics_process(_delta: float) -> void: Controls where the camera is pointed based on which player is selected ''' - target_angle = abs(GLOBALVARS.selected_player) * 90 + target_angle = (abs(GLOBALVARS.selected_player) * 90) if current_angle != target_angle: current_angle += 0.1*(target_angle-current_angle) diff --git a/godot/scripts/gamemaster.gd b/godot/scripts/gamemaster.gd new file mode 100644 index 0000000..ec88331 --- /dev/null +++ b/godot/scripts/gamemaster.gd @@ -0,0 +1,40 @@ +extends Node + +var cooldown:int = 0 + +func _determine_seconds_left() -> float: + var difficulty_calc:float = 20/float(GLOBALVARS.difficulty) + return difficulty_calc if difficulty_calc >= 3.0 else 3.0 + +func _unhandled_key_input(event: InputEvent) -> void: + if event.is_action_pressed("enter"): + if GLOBALVARS.selected_player == 0: + pass # SUBMIT ANSWER + +func _physics_process(_delta: float) -> void: + if not GLOBALVARS.rotation_paused: + GLOBALVARS.seconds_left -= 0.01666666667 + + if GLOBALVARS.seconds_left <= 0: + %RULE_ENFORCEMENT.explode() + cooldown = 60 + GLOBALVARS.seconds_left = _determine_seconds_left() + GLOBALVARS.rotation_paused = true + if GLOBALVARS.selected_player in GLOBALVARS.players_remaining: + GLOBALVARS.players_remaining.erase(GLOBALVARS.selected_player) + get_node("players/player_%s" % GLOBALVARS.selected_player).queue_free() + + if cooldown <= 0 and GLOBALVARS.rotation_paused: + if len(GLOBALVARS.players_remaining) > 1 and 0 in GLOBALVARS.players_remaining: + while GLOBALVARS.selected_player not in GLOBALVARS.players_remaining: + GLOBALVARS.selected_player = (GLOBALVARS.selected_player+1)%4 + elif 0 in GLOBALVARS.players_remaining: + pass # WIN CONDITION + else: + pass # LOSE CONDITION + + GLOBALVARS.rotation_paused = false + %RULE_ENFORCEMENT.reset_rule_enforcement_device() + + elif GLOBALVARS.rotation_paused: + cooldown -= 1 diff --git a/godot/scripts/gamemaster.gd.uid b/godot/scripts/gamemaster.gd.uid new file mode 100644 index 0000000..d985897 --- /dev/null +++ b/godot/scripts/gamemaster.gd.uid @@ -0,0 +1 @@ +uid://clwubcfa7jndm diff --git a/godot/scripts/globalvars.gd b/godot/scripts/globalvars.gd index 78ee99b..f522a46 100644 --- a/godot/scripts/globalvars.gd +++ b/godot/scripts/globalvars.gd @@ -1,3 +1,14 @@ extends Node var selected_player:int = 0 +var seconds_left:float = 0.0 +var difficulty:int = 1 +var rotation_paused:bool = false +var players_remaining:Array = [0,1,2,3] + +func reset_variables() -> void: + selected_player = 0 + seconds_left = 5.0 + difficulty = 1 + rotation_paused = false + players_remaining = [0,1,2,3] diff --git a/godot/scripts/menu.gd b/godot/scripts/menu.gd index 61510e1..cdf3445 100644 --- a/godot/scripts/menu.gd +++ b/godot/scripts/menu.gd @@ -1 +1,6 @@ extends Node + + +func _on_start_button_pressed() -> void: + GLOBALVARS.reset_variables() + get_tree().change_scene_to_file("res://main_scenes/game.tscn") diff --git a/godot/scripts/rule_enforcement_device.gd b/godot/scripts/rule_enforcement_device.gd new file mode 100644 index 0000000..747546a --- /dev/null +++ b/godot/scripts/rule_enforcement_device.gd @@ -0,0 +1,40 @@ +extends Node3D + +static var FUSE_SOUND:AudioStream = preload("res://assets/sounds/fuse.ogg") +static var EXPLOSION_SOUND:AudioStream = preload("res://assets/sounds/explode.wav") + +var grow_explosion:bool = false + +func reset_rule_enforcement_device() -> void: + ''' + Start the fuse sound + ''' + %SOUNDS.stream = FUSE_SOUND + %SOUNDS.volume_db = -10 + %SOUNDS.play() + visible = true + %EXPLOSION.visible = false + grow_explosion = false + %EXPLOSION.scale = Vector3(0.355,0.355,0.355) + +func explode() -> void: + ''' + Make the rule enforcement device go boom + ''' + + %SOUNDS.stream = EXPLOSION_SOUND + %SOUNDS.volume_db = 0 + %SOUNDS.play() + grow_explosion = true + %EXPLOSION.visible = true + +func _ready() -> void: + reset_rule_enforcement_device() + +func _process(_delta: float) -> void: + %TIME_LEFT.text = ("%.02f" % GLOBALVARS.seconds_left).replace(".",":") + if grow_explosion and %EXPLOSION.scale < Vector3(3,3,3): + %EXPLOSION.scale += Vector3(0.2,0.2,0.2) + elif grow_explosion: + %EXPLOSION.visible = false + visible = false diff --git a/godot/scripts/rule_enforcement_device.gd.uid b/godot/scripts/rule_enforcement_device.gd.uid new file mode 100644 index 0000000..d6eeced --- /dev/null +++ b/godot/scripts/rule_enforcement_device.gd.uid @@ -0,0 +1 @@ +uid://cs6veeykw6tfv diff --git a/godot/sub_scenes/rule_enforcement.tscn b/godot/sub_scenes/rule_enforcement.tscn new file mode 100644 index 0000000..23f0a82 --- /dev/null +++ b/godot/sub_scenes/rule_enforcement.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3 uid="uid://bqo5ur0ipndvs"] + +[ext_resource type="Script" uid="uid://cs6veeykw6tfv" path="res://scripts/rule_enforcement_device.gd" id="1_ihbyf"] +[ext_resource type="PackedScene" uid="uid://df6ukbu84pa8x" path="res://assets/models/rule_enforcement_device/rule_enforcement.glb" id="1_v583i"] +[ext_resource type="FontFile" uid="uid://bwpewensb1s18" path="res://assets/fonts/LCD14.otf" id="3_ihxkj"] +[ext_resource type="PackedScene" uid="uid://cubknyjl31o2m" path="res://assets/models/explosion/explosion.glb" id="4_octtn"] + +[node name="RuleEnforcement" type="Node3D"] +script = ExtResource("1_ihbyf") + +[node name="rule_enforcement" parent="." instance=ExtResource("1_v583i")] + +[node name="SOUNDS" type="AudioStreamPlayer3D" parent="."] +unique_name_in_owner = true + +[node name="TIME_LEFT" type="Label3D" parent="."] +unique_name_in_owner = true +transform = Transform3D(-8.08661e-09, 0.185, 8.08661e-09, 0, -8.08661e-09, 0.185, 0.185, 8.08661e-09, 3.53477e-16, -0.0497415, 0.978825, 0) +modulate = Color(1, 0, 0, 1) +text = "00:00" +font = ExtResource("3_ihxkj") +font_size = 527 + +[node name="EXPLOSION" parent="." instance=ExtResource("4_octtn")] +unique_name_in_owner = true +transform = Transform3D(0.355092, 0, 0, 0, 0.355092, 0, 0, 0, 0.355092, 0, 0, 0) +visible = false