diff --git a/src/Environment/Grass/ShaderGrass.gd b/src/Environment/Grass/ShaderGrass.gd index c730442..18b49e7 100644 --- a/src/Environment/Grass/ShaderGrass.gd +++ b/src/Environment/Grass/ShaderGrass.gd @@ -19,7 +19,10 @@ var is_idle_swinging var start_swing_time := 0.0 var begin_idle var time_since_last_exec := 0.0 +var time_since_last_setting_check := 0.0 +var enabled := true +# TODO accomplish this grouping with a folder instead of hardcoding it here var grass_sounds := ["res://assets/sounds/grass swish 1.ogg","res://assets/sounds/grass swish 2.ogg", "res://assets/sounds/grass swish 3.ogg","res://assets/sounds/grass swish 4.ogg"] # var thread : Thread @@ -29,25 +32,32 @@ var saved_coeff:= 0.0 func _ready(): # TODO This could probably fuck something up later? For other randomness based events randomize() + enabled = GlobalState.get_swaying_grass() # thread = Thread.new() -func _process(delta: float) -> void: +func _physics_process(delta: float) -> void: # TODO This should be in the settings and applied to all shaders time_since_last_exec += delta + time_since_last_setting_check += delta # if thread.is_alive(): # print("was_running") # return # if thread.is_active(): # thread.wait_to_finish() - if time_since_last_exec <= 1.0/fps_limit: - return + if time_since_last_setting_check >= 30/fps_limit: + time_since_last_setting_check = 0.0 + enabled = GlobalState.get_swaying_grass() + + if time_since_last_exec >= 1.0/fps_limit: + time_since_last_exec = 0.0 + if enabled: + grass_wave_update(delta) # thread.start(self, "grass_wave_update", delta) - grass_wave_update(delta) + return func grass_wave_update(delta: float) -> void: - time_since_last_exec = 0.0 var distance: float = abs(global_position.x - blobby.global_position.x + 6) var v_distance: float = abs(global_position.y - blobby.global_position.y + 11) #if (distance > draft_radius * 2 || v_distance > v_radius * 2): @@ -99,6 +109,7 @@ func grass_wave_update(delta: float) -> void: # if(displacement_coeff.x > saved_coeff): # print(displacement_coeff.x) # saved_coeff = displacement_coeff.x + for polygon in get_children(): displacement_coeff.x = clamp(displacement_coeff.x, -max_displacement, max_displacement) if polygon is Polygon2D: @@ -111,6 +122,8 @@ func grass_wave_update(delta: float) -> void: func _on_Area2D_body_entered(body: Node) -> void: + if !enabled: + return var sound_index = round(rand_range(0,grass_sounds.size())) - 1 if(body.is_in_group("player")): GlobalAudio.play_scene_independent(grass_sounds[sound_index], "Effects", -22, true, 0, true, 1) diff --git a/src/UserInterface/Buttons/RetryButton.gd b/src/UserInterface/Buttons/RetryButton.gd index 2a37055..8b07cd7 100644 --- a/src/UserInterface/Buttons/RetryButton.gd +++ b/src/UserInterface/Buttons/RetryButton.gd @@ -2,6 +2,10 @@ extends AudibleButton onready var level_state := get_tree().root.get_child(4).get_node("%LevelState") +func _ready() -> void: + if !GlobalState.get_savepoint(level_state.level_name): + visible = false + func _on_button_up() -> void: get_tree().paused = false get_tree().reload_current_scene() diff --git a/src/UserInterface/Screens/HUD.tscn b/src/UserInterface/Screens/HUD.tscn index 365869a..788e825 100644 --- a/src/UserInterface/Screens/HUD.tscn +++ b/src/UserInterface/Screens/HUD.tscn @@ -124,10 +124,3 @@ margin_top = -21.0 margin_right = 253.0 rect_scale = Vector2( 0.590909, 0.627907 ) text = "Orbs: 100000000000000000" - -[node name="Panel" type="Panel" parent="."] -visible = false -margin_left = 3.0 -margin_top = 291.0 -margin_right = 216.0 -margin_bottom = 354.0 diff --git a/src/UserInterface/Screens/InGameMenu/PauseScreen.gd b/src/UserInterface/Screens/InGameMenu/PauseScreen.gd index 1e6feb1..ff5fdac 100644 --- a/src/UserInterface/Screens/InGameMenu/PauseScreen.gd +++ b/src/UserInterface/Screens/InGameMenu/PauseScreen.gd @@ -17,7 +17,7 @@ func _ready(): $ControlsMenu.set_process_input(false) $AudioMenu.set_process_input(false) signal_manager.connect("game_paused", self, "set_paused") - pass + $"%SwayingGrassCheckbox".pressed = GlobalState.get_swaying_grass() func open_audio_menu(): @@ -69,3 +69,11 @@ func _on_Controls_button_up() -> void: block_ui_cancel = true pause_overlay.visible = false $"%ProfilesMenu".grab_focus() + + +func _on_TextureButton_mouse_entered() -> void: + $"%TrollSound".play() + + +func _on_SwayingGrassCheckbox_toggled(button_pressed: bool) -> void: + GlobalState.set_swaying_grass(button_pressed) diff --git a/src/UserInterface/Screens/InGameMenu/PauseScreen.tscn b/src/UserInterface/Screens/InGameMenu/PauseScreen.tscn index 2c915f1..4f0782e 100644 --- a/src/UserInterface/Screens/InGameMenu/PauseScreen.tscn +++ b/src/UserInterface/Screens/InGameMenu/PauseScreen.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=45 format=2] +[gd_scene load_steps=48 format=2] [ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=1] [ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=2] @@ -30,6 +30,8 @@ [ext_resource path="res://src/UserInterface/Screens/MainMenu/AudioSlider.gd" type="Script" id=28] [ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=29] [ext_resource path="res://src/UserInterface/Buttons/RetryCompleteButton.tscn" type="PackedScene" id=30] +[ext_resource path="res://assets/sounds/im-a-gnome-meme-sound-effect-woo.mp3" type="AudioStream" id=31] +[ext_resource path="res://src/UserInterface/Buttons/AudibleCheckbox.gd" type="Script" id=32] [sub_resource type="Gradient" id=17] interpolation_mode = 2 @@ -52,6 +54,10 @@ font_data = ExtResource( 22 ) shader = ExtResource( 7 ) shader_param/transparency = 0.1 +[sub_resource type="ShaderMaterial" id=20] +shader = ExtResource( 7 ) +shader_param/transparency = 0.1 + [sub_resource type="DynamicFont" id=10] size = 9 font_data = ExtResource( 18 ) @@ -146,6 +152,30 @@ margin_bottom = 265.0 rect_scale = Vector2( 0.0627026, 0.0522158 ) texture = ExtResource( 21 ) +[node name="TextureButton" type="TextureButton" parent="ControlsMenu/Titel"] +margin_left = -150.0 +margin_right = -110.0 +margin_bottom = 40.0 + +[node name="TextureRect" type="TextureRect" parent="ControlsMenu/Titel/TextureButton"] +material = SubResource( 20 ) +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = 261.0 +margin_top = 3.0 +margin_right = 551.0 +margin_bottom = 271.0 +rect_scale = Vector2( 0.0627026, 0.0522158 ) +texture = ExtResource( 21 ) + +[node name="TrollSound" type="AudioStreamPlayer" parent="ControlsMenu/Titel/TextureButton"] +unique_name_in_owner = true +stream = ExtResource( 31 ) +volume_db = -14.01 +bus = "Effects" + [node name="Panel" type="Panel" parent="ControlsMenu"] anchor_left = 0.5 anchor_top = 0.5 @@ -931,10 +961,28 @@ theme = ExtResource( 2 ) custom_fonts/font = SubResource( 9 ) text = "Paused" +[node name="SwayingGrassCheckbox" type="CheckBox" parent="PauseOverlay"] +unique_name_in_owner = true +margin_left = 16.0 +margin_top = 331.0 +margin_right = 284.0 +margin_bottom = 355.0 +theme = ExtResource( 2 ) +custom_colors/font_color_disabled = Color( 1, 1, 1, 1 ) +custom_colors/font_color_focus = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover_pressed = Color( 1, 1, 1, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover = Color( 1, 1, 1, 1 ) +custom_colors/font_color_pressed = Color( 1, 1, 1, 1 ) +text = "fancy swaying grass +( diasabling can fix browser performance)" +script = ExtResource( 32 ) + [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource( 24 ) volume_db = -10.0 +[connection signal="mouse_entered" from="ControlsMenu/Titel/TextureButton" to="." method="_on_TextureButton_mouse_entered"] [connection signal="focus_entered" from="ControlsMenu/Panel/KeymapViewer/ScrollContainer" to="ControlsMenu/Panel/KeymapViewer/ScrollContainer" method="_on_focus_entered"] [connection signal="button_up" from="ControlsMenu/Panel/Back" to="ControlsMenu/Panel/Back" method="_on_button_up"] [connection signal="button_up" from="ControlsMenu/Panel/Reset" to="ControlsMenu/Panel/Reset" method="_on_button_up"] @@ -950,3 +998,4 @@ volume_db = -10.0 [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Continue" to="PauseOverlay/Panel/VBoxContainer/Continue" method="_on_button_up"] [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Controls" to="." method="_on_Controls_button_up"] [connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Audio" to="." method="open_audio_menu"] +[connection signal="toggled" from="PauseOverlay/SwayingGrassCheckbox" to="." method="_on_SwayingGrassCheckbox_toggled"] diff --git a/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.gd b/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.gd index 210d068..1977b98 100644 --- a/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.gd +++ b/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.gd @@ -128,3 +128,7 @@ func swap_buttons(action1, action2, old_event, new_event) -> void: if $InputMapper.change_action_key(action2, old_event, new_event): input_line2.update_key(old_event) + + +func _on_TextureButton_mouse_entered() -> void: + $"%TrollSound".play() diff --git a/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.tscn b/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.tscn index 7539b6e..009a545 100644 --- a/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.tscn +++ b/src/UserInterface/Screens/MainMenu/ControlsMenu/ControlsMenu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=31 format=2] +[gd_scene load_steps=32 format=2] [ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/SaveButton.gd" type="Script" id=1] [ext_resource path="res://src/UserInterface/Screens/MainMenu/ControlsMenu/SavedCheckBackButton.gd" type="Script" id=2] @@ -24,6 +24,7 @@ [ext_resource path="res://assets/ui/fonts/kenny_thick.tres" type="DynamicFont" id=22] [ext_resource path="res://addons/controller_icons/objects/Button.gd" type="Script" id=23] [ext_resource path="res://addons/controller_icons/assets/key/arrow_down.png" type="Texture" id=24] +[ext_resource path="res://assets/sounds/im-a-gnome-meme-sound-effect-woo.mp3" type="AudioStream" id=25] [sub_resource type="DynamicFont" id=1] size = 42 @@ -94,19 +95,30 @@ text = "Controlls Menu" align = 1 valign = 1 -[node name="TextureRect" type="TextureRect" parent="Titel"] +[node name="TextureButton" type="TextureButton" parent="Titel"] +margin_left = -150.0 +margin_right = -110.0 +margin_bottom = 40.0 + +[node name="TextureRect" type="TextureRect" parent="Titel/TextureButton"] material = SubResource( 6 ) anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -39.0 -margin_top = -3.0 -margin_right = 251.0 -margin_bottom = 265.0 +margin_left = 261.0 +margin_top = 3.0 +margin_right = 551.0 +margin_bottom = 271.0 rect_scale = Vector2( 0.0627026, 0.0522158 ) texture = ExtResource( 12 ) +[node name="TrollSound" type="AudioStreamPlayer" parent="Titel/TextureButton"] +unique_name_in_owner = true +stream = ExtResource( 25 ) +volume_db = -14.01 +bus = "Effects" + [node name="Panel" type="Panel" parent="."] anchor_left = 0.5 anchor_top = 0.5 @@ -257,8 +269,6 @@ follow_focus = true [node name="ActionKeyList" type="VBoxContainer" parent="Panel/KeymapViewer/ScrollContainer"] unique_name_in_owner = true -margin_right = 600.0 -margin_bottom = 189.0 size_flags_horizontal = 3 size_flags_vertical = 3 script = ExtResource( 14 ) @@ -559,6 +569,7 @@ focus_neighbour_bottom = NodePath("../Yes") text = "NO" script = ExtResource( 8 ) +[connection signal="mouse_entered" from="Titel/TextureButton" to="." method="_on_TextureButton_mouse_entered"] [connection signal="button_up" from="Panel/Back" to="Panel/Back" method="_on_button_up"] [connection signal="button_up" from="Panel/Reset" to="Panel/Reset" method="_on_button_up"] [connection signal="button_up" from="Panel/Save" to="Panel/Save" method="_on_button_up"] diff --git a/src/UserInterface/Screens/MainMenu/MainScreen.gd b/src/UserInterface/Screens/MainMenu/MainScreen.gd index 43a5c0c..4c454b7 100644 --- a/src/UserInterface/Screens/MainMenu/MainScreen.gd +++ b/src/UserInterface/Screens/MainMenu/MainScreen.gd @@ -5,3 +5,8 @@ func _ready() -> void: get_tree().paused = false $"%PlayButton".grab_focus() GlobalAudio.play_scene_independent("res://assets/music/Shopping For The Future (LOOP).wav","Music", -17, true) + $"%SwayingGrassCheckbox".pressed = GlobalState.get_swaying_grass() + + +func _on_SwayingGrassCheckbox_toggled(button_pressed: bool) -> void: + GlobalState.set_swaying_grass(button_pressed) diff --git a/src/UserInterface/Screens/MainMenu/MainScreen.tscn b/src/UserInterface/Screens/MainMenu/MainScreen.tscn index 985c832..c4ca455 100644 --- a/src/UserInterface/Screens/MainMenu/MainScreen.tscn +++ b/src/UserInterface/Screens/MainMenu/MainScreen.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=2] +[gd_scene load_steps=22 format=2] [ext_resource path="res://src/UserInterface/Buttons/QuitButton.tscn" type="PackedScene" id=1] [ext_resource path="res://src/UserInterface/Titel.tscn" type="PackedScene" id=2] @@ -6,7 +6,7 @@ [ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=4] [ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5] [ext_resource path="res://assets/environment/background/Spaceship-Wall-Menu.png" type="Texture" id=6] -[ext_resource path="res://assets/environment/background/starry-space.png" type="Texture" id=7] +[ext_resource path="res://assets/environment/background/space.png" type="Texture" id=7] [ext_resource path="res://src/UserInterface/Buttons/PlayButton.gd" type="Script" id=8] [ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelSelectButtonGroup.tres" type="ButtonGroup" id=9] [ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=10] @@ -14,6 +14,8 @@ [ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=12] [ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=13] [ext_resource path="res://src/UserInterface/Screens/MainMenu/MainScreen.gd" type="Script" id=14] +[ext_resource path="res://src/UserInterface/Buttons/AudibleCheckbox.gd" type="Script" id=15] +[ext_resource path="res://promotional/pxArt.png" type="Texture" id=16] [sub_resource type="Gradient" id=6] interpolation_mode = 2 @@ -105,6 +107,43 @@ texture = SubResource( 3 ) expand = true stretch_mode = 1 +[node name="MarginContainer2" type="MarginContainer" parent="."] +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +margin_left = -151.0 +margin_top = -36.0 +margin_right = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="SwayingGrassCheckbox" type="CheckBox" parent="MarginContainer2"] +unique_name_in_owner = true +margin_right = 312.0 +margin_bottom = 36.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme = ExtResource( 13 ) +custom_colors/font_color_disabled = Color( 1, 1, 1, 1 ) +custom_colors/font_color_focus = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover_pressed = Color( 1, 1, 1, 1 ) +custom_colors/font_color = Color( 1, 1, 1, 1 ) +custom_colors/font_color_hover = Color( 1, 1, 1, 1 ) +custom_colors/font_color_pressed = Color( 1, 1, 1, 1 ) +text = "fancy swaying grass +( diasabling can fix browser performance)" +flat = true +clip_text = true +align = 1 +icon_align = 1 +script = ExtResource( 15 ) +__meta__ = { +"_edit_use_anchors_": true +} + [node name="MarginContainer" type="MarginContainer" parent="."] anchor_left = 0.5 anchor_top = 0.02 @@ -113,6 +152,10 @@ anchor_bottom = 0.02 margin_left = -130.0 margin_right = 130.0 margin_bottom = 85.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 theme = ExtResource( 13 ) [node name="Panel" type="Panel" parent="MarginContainer"] @@ -125,7 +168,20 @@ size_flags_vertical = 3 theme = ExtResource( 13 ) theme_type_variation = "Panel2" +[node name="TextureRect" type="TextureRect" parent="MarginContainer/Panel"] +margin_left = 20.0 +margin_top = 15.8 +margin_right = 240.0 +margin_bottom = 68.8 +rect_min_size = Vector2( 220, 53 ) +size_flags_horizontal = 3 +size_flags_vertical = 3 +texture = ExtResource( 16 ) +expand = true +stretch_mode = 1 + [node name="Titel" parent="MarginContainer" instance=ExtResource( 2 )] +visible = false margin_right = 260.0 margin_bottom = 85.0 grow_horizontal = 2 @@ -226,7 +282,8 @@ scroll_horizontal_enabled = false script = ExtResource( 11 ) [node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/Panel/LevelList"] -margin_right = 119.0 +margin_right = 123.0 +margin_bottom = 102.0 grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 3 @@ -244,4 +301,5 @@ size_flags_horizontal = 3 size_flags_vertical = 3 group = ExtResource( 9 ) +[connection signal="toggled" from="MarginContainer2/SwayingGrassCheckbox" to="." method="_on_SwayingGrassCheckbox_toggled"] [connection signal="button_up" from="MenuContainer/Buttons/PlayButton" to="MenuContainer/Buttons/PlayButton" method="_on_button_up"]