Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added enable Arcade Mode when holding DELETE for 2 seconds #58

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,42 @@
[gd_scene load_steps=3 format=3 uid="uid://qh70swp7jtlo"]
[gd_scene load_steps=4 format=3 uid="uid://qh70swp7jtlo"]

[ext_resource type="AudioStream" uid="uid://cpkewhcblnqj" path="res://sounds/beeep.mp3" id="1_efuup"]

[sub_resource type="GDScript" id="GDScript_bpxmf"]
resource_name = "toggle_element_template"
script/source = "extends ToggleElement

@onready var key_bindings_ref = $\"../SubSectionElements/InputSettings\"
@onready var beep = $\"%Beep\"
@onready var controls = $\"../../../../../..\"

var is_button_pressed = false
var button_hold_time = 0.0
const HOLD_DURATION = 2.0

# Called to apply the setting to the game
func _apply_settings() -> void:
apply_in_game_setting(currentValue)


func _process(delta):# Check if the button is being pressed
if Input.is_key_pressed(KEY_DELETE): # Replace \"ui_accept\" with your desired action
if not is_button_pressed:
is_button_pressed = true
button_hold_time = 0.0 # Reset timer when button is first pressed
else:
button_hold_time += delta # Increment hold time
# Trigger the function if the button has been held long enough
if button_hold_time >= HOLD_DURATION:
toggled(!currentValue)
print(\"Triggering Arcade Mode: \", currentValue)
beep.play()
key_bindings_ref.set_arcade(true)
button_hold_time = 0.0
else:
# Reset when the button is released
is_button_pressed = false
button_hold_time = 0.0

func toggled(state: bool) -> void:
super(state)

Expand All @@ -31,6 +57,7 @@ grow_vertical = 2
script = SubResource("GDScript_bpxmf")
ToggleRef = NodePath("Toggle")
IDENTIFIER = "ArcadeMode"
IS_IN_GAME_SETTING = true

[node name="Label" type="Label" parent="."]
layout_mode = 2
Expand All @@ -44,3 +71,7 @@ layout_mode = 2
size_flags_horizontal = 3
focus_mode = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_drjjf")

[node name="Beep" type="AudioStreamPlayer2D" parent="."]
unique_name_in_owner = true
stream = ExtResource("1_efuup")
1 change: 1 addition & 0 deletions addons/modular-settings-menu/scenes/settings.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ script = ExtResource("1_crapp")

[node name="ShapeCast2D" type="ColorRect" parent="."]
self_modulate = Color(0.0745098, 0.0745098, 0.0745098, 0.290196)
layout_mode = 0
offset_right = 1920.0
offset_bottom = 1080.0

Expand Down
Binary file added sounds/beeep.mp3
Binary file not shown.
19 changes: 19 additions & 0 deletions sounds/beeep.mp3.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="mp3"
type="AudioStreamMP3"
uid="uid://cpkewhcblnqj"
path="res://.godot/imported/beeep.mp3-5b287632d78f7eb77e8a603209eed202.mp3str"

[deps]

source_file="res://sounds/beeep.mp3"
dest_files=["res://.godot/imported/beeep.mp3-5b287632d78f7eb77e8a603209eed202.mp3str"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4