Bear, level selector (to be removed), new matador spawn, new bear level, saving config updates source files
This commit is contained in:
+67
-6
@@ -190,13 +190,74 @@ func _process(_delta: float) -> void:
|
||||
play_button.anchor_bottom = cape.y
|
||||
|
||||
|
||||
# Player-facing option toggles, seated above the rebind list in the Options panel:
|
||||
# the master screen-shake switch and the gore toggle (both persisted via Settings).
|
||||
# Player-facing option toggles and audio sliders, seated above the rebind list.
|
||||
func _build_options_toggles() -> void:
|
||||
var scroll_idx := options_scroll.get_index()
|
||||
# Insert in reverse so both land directly above the rebind scroll, in listed order.
|
||||
_add_toggle_row("Blood & Gore", Settings.gore, Settings.set_gore, scroll_idx)
|
||||
_add_toggle_row("Screen Shake", Settings.screen_shake, Settings.set_screen_shake, scroll_idx)
|
||||
var idx := options_scroll.get_index()
|
||||
_add_section_label("── Audio ──", idx); idx += 1
|
||||
_add_slider_row("Master Volume", Settings.volume_master, Settings.set_volume_master, idx); idx += 1
|
||||
_add_slider_row("Ambient Volume", Settings.volume_ambient, Settings.set_volume_ambient, idx); idx += 1
|
||||
_add_slider_row("Effects Volume", Settings.volume_effects, Settings.set_volume_effects, idx); idx += 1
|
||||
_add_toggle_row("Mute All", Settings.mute_all, Settings.set_mute_all, idx); idx += 1
|
||||
_add_section_label("── Gameplay ──", idx); idx += 1
|
||||
_add_toggle_row("Screen Shake", Settings.screen_shake, Settings.set_screen_shake, idx); idx += 1
|
||||
_add_toggle_row("Blood & Gore", Settings.gore, Settings.set_gore, idx); idx += 1
|
||||
_add_section_label("── Controls ──", idx)
|
||||
|
||||
|
||||
func _add_section_label(text: String, at_index: int) -> void:
|
||||
var lbl := Label.new()
|
||||
lbl.text = text
|
||||
lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
lbl.add_theme_font_override("font", UiFonts.title())
|
||||
lbl.add_theme_font_size_override("font_size", 18)
|
||||
lbl.add_theme_color_override("font_color", MENU_GOLD)
|
||||
lbl.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
lbl.add_theme_constant_override("outline_size", 4)
|
||||
options_vbox.add_child(lbl)
|
||||
options_vbox.move_child(lbl, at_index)
|
||||
|
||||
|
||||
func _add_slider_row(label_text: String, value: float, setter: Callable, at_index: int) -> void:
|
||||
var row := HBoxContainer.new()
|
||||
row.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
|
||||
var name_label := Label.new()
|
||||
name_label.text = label_text
|
||||
name_label.custom_minimum_size = Vector2(160, 0)
|
||||
name_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
name_label.add_theme_font_override("font", UiFonts.body())
|
||||
name_label.add_theme_font_size_override("font_size", 20)
|
||||
name_label.add_theme_color_override("font_color", MENU_CREAM)
|
||||
name_label.add_theme_color_override("font_outline_color", Color.BLACK)
|
||||
name_label.add_theme_constant_override("outline_size", 5)
|
||||
row.add_child(name_label)
|
||||
|
||||
var slider := HSlider.new()
|
||||
slider.min_value = 0.0
|
||||
slider.max_value = 1.0
|
||||
slider.step = 0.01
|
||||
slider.value = value
|
||||
slider.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
slider.custom_minimum_size = Vector2(0, 28)
|
||||
row.add_child(slider)
|
||||
|
||||
var pct_label := Label.new()
|
||||
pct_label.text = "%d%%" % roundi(value * 100.0)
|
||||
pct_label.custom_minimum_size = Vector2(46, 0)
|
||||
pct_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
|
||||
pct_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
pct_label.add_theme_font_override("font", UiFonts.body())
|
||||
pct_label.add_theme_font_size_override("font_size", 18)
|
||||
pct_label.add_theme_color_override("font_color", MENU_GOLD)
|
||||
row.add_child(pct_label)
|
||||
|
||||
slider.value_changed.connect(func(v: float) -> void:
|
||||
setter.call(v)
|
||||
pct_label.text = "%d%%" % roundi(v * 100.0))
|
||||
|
||||
options_vbox.add_child(row)
|
||||
options_vbox.move_child(row, at_index)
|
||||
|
||||
|
||||
func _add_toggle_row(label_text: String, value: bool, setter: Callable, at_index: int) -> void:
|
||||
|
||||
Reference in New Issue
Block a user