Skip to content

Commit

Permalink
Enable Options button on TitleScreen (#562)
Browse files Browse the repository at this point in the history
* Enable Options button on Title Screen

Co-authored-by: captaincolonelfox <lentrog@gmail.com>
  • Loading branch information
duianto and captaincolonelfox authored Jul 26, 2022
1 parent b8a2188 commit 137ab2b
Show file tree
Hide file tree
Showing 16 changed files with 652 additions and 3 deletions.
18 changes: 18 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/resources/BaseInventoryHandle.gd"
}, {
"base": "HBoxContainer",
"class": "BaseOption",
"language": "GDScript",
"path": "res://scenes/title/options/controls/BaseOption.gd"
}, {
"base": "Node2D",
"class": "BouncyMoustache",
"language": "GDScript",
Expand All @@ -59,6 +64,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/CameraLeanAmount.gd"
}, {
"base": "BaseOption",
"class": "CheckboxOption",
"language": "GDScript",
"path": "res://scenes/title/options/controls/CheckboxOption.gd"
}, {
"base": "BaseInventoryHandle",
"class": "CoinInventoryHandle",
"language": "GDScript",
Expand Down Expand Up @@ -209,6 +219,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/ShootAchievement.gd"
}, {
"base": "BaseOption",
"class": "SliderOption",
"language": "GDScript",
"path": "res://scenes/title/options/controls/SliderOption.gd"
}, {
"base": "Node2D",
"class": "SokobanLevel",
"language": "GDScript",
Expand Down Expand Up @@ -266,10 +281,12 @@ _global_script_class_icons={
"BallSpawnPoint": "",
"BaseBox": "",
"BaseInventoryHandle": "",
"BaseOption": "",
"BouncyMoustache": "",
"Bub": "",
"Bus": "",
"CameraLeanAmount": "",
"CheckboxOption": "",
"CoinInventoryHandle": "",
"CoinProjectile": "",
"CoinsAchievement": "",
Expand Down Expand Up @@ -300,6 +317,7 @@ _global_script_class_icons={
"ScreenShake": "",
"ShakingCamera": "",
"ShootAchievement": "",
"SliderOption": "",
"SokobanLevel": "res://sprites/box.png",
"SokobanPlayer": "",
"SpawnPoint": "",
Expand Down
4 changes: 3 additions & 1 deletion scenes/title/TitleMenuButton.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ var unselected_icon = ImageTexture.new()

func _ready():
# Signals can be found here: https://docs.godotengine.org/en/stable/classes/class_basebutton.html
self.connect("mouse_entered", self, "grab_focus")
self.connect("pressed", self, "_on_pressed")
self.connect("focus_entered", self, "_on_focus_entered")
self.connect("focus_exited", self, "_on_focus_exited")
self.connect("mouse_entered", self, "grab_focus")
self.connect("mouse_exited", self, "release_focus")

# Copy of image with transparent color
var img = selected_icon.get_data()
Expand All @@ -37,3 +38,4 @@ func _on_focus_entered():

func _on_focus_exited():
icon = unselected_icon

2 changes: 1 addition & 1 deletion scenes/title/TitleScreen.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ margin_left = 66.0
margin_top = 112.0
margin_right = 184.0
margin_bottom = 164.0
disabled = true
text = "OPTIONS"
redirect_scene = "res://scenes/title/options/OptionsMenu.tscn"

[node name="CreditsButton" parent="VBoxContainer/VBoxContainer" instance=ExtResource( 16 )]
margin_left = 66.0
Expand Down
57 changes: 57 additions & 0 deletions scenes/title/options/OptionsMenu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
extends Control

export (NodePath) onready var game_volume = get_node(game_volume) as BaseOption
export (NodePath) onready var music_volume = get_node(music_volume) as BaseOption
export (NodePath) onready var sfx_volume = get_node(sfx_volume) as BaseOption
export (NodePath) onready var voice_volume = get_node(voice_volume) as BaseOption
export (NodePath) onready var camera_lean = get_node(camera_lean) as BaseOption
export (NodePath) onready var screen_shake = get_node(screen_shake) as BaseOption
export (NodePath) onready var crt_filter = get_node(crt_filter) as BaseOption


func _ready() -> void:
game_volume.value = Settings.volume_game
music_volume.value = Settings.volume_music
sfx_volume.value = Settings.volume_sfx
voice_volume.value = Settings.volume_voice

camera_lean.value = Settings.camera_lean
screen_shake.value = Settings.screen_shake
crt_filter.value = Settings.crt_filter


func _on_GameVolume_value_changed(value) -> void:
Settings.volume_game = value
EventBus.emit_signal("volume_changed", "Master")


func _on_MusicVolume_value_changed(value) -> void:
Settings.volume_music = value
EventBus.emit_signal("volume_changed", "music")


func _on_SFXVolume_value_changed(value) -> void:
Settings.volume_sfx = value
EventBus.emit_signal("volume_changed", "sfx")


func _on_VoiceVolume_value_changed(value) -> void:
Settings.volume_voice = value
EventBus.emit_signal("volume_changed", "voice")


func _on_CameraLean_value_changed(value):
Settings.camera_lean = value


func _on_ScreenShake_value_changed(value):
Settings.screen_shake = value


func _on_CRTFilter_value_changed(value):
Settings.crt_filter = value
EventBus.emit_signal("crt_filter_toggle", Settings.crt_filter)


func _on_BackMenuButton_pressed() -> void:
Settings.save_data()
Loading

0 comments on commit 137ab2b

Please sign in to comment.