Compare commits

..

3 Commits

17 changed files with 163 additions and 60 deletions

BIN
asset_dev/balls/brick/Brick.png (Stored with Git LFS)

Binary file not shown.

BIN
asset_dev/balls/brick/brick.blend (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
assets/models/balls/brick/Brick.png (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

@ -64,7 +64,7 @@
{
"bufferView":0,
"componentType":5126,
"count":24,
"count":42,
"max":[
0.09207499027252197,
0.05715000629425049,
@ -80,45 +80,45 @@
{
"bufferView":1,
"componentType":5126,
"count":24,
"count":42,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":24,
"count":42,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5123,
"count":36,
"count":72,
"type":"SCALAR"
}
],
"bufferViews":[
{
"buffer":0,
"byteLength":288,
"byteLength":504,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":288,
"byteOffset":288,
"byteLength":504,
"byteOffset":504,
"target":34962
},
{
"buffer":0,
"byteLength":192,
"byteOffset":576,
"byteLength":336,
"byteOffset":1008,
"target":34962
},
{
"buffer":0,
"byteLength":72,
"byteOffset":768,
"byteLength":144,
"byteOffset":1344,
"target":34963
}
],
@ -130,7 +130,7 @@
],
"buffers":[
{
"byteLength":840,
"byteLength":1488,
"uri":"brick.bin"
}
]

View File

@ -17,6 +17,8 @@ SETTINGS_GAME,Game
SETTINGS_GAME_HEADING,"Game Configuration"
SETTINGS_GAME_ACCESSIBILITY_HEADING,Accessibility
SETTINGS_GAME_CAMERA_HEADING,Camera
SETTINGS_GAME_TEXT_HEADING,"In-game Text"
SETTINGS_TEXT_SPEED,"Text Display Speed"
SETTINGS_SCREEN_SHAKE,"Enable Screen Shake"
SETTINGS_HIT_LAG,"Enable Hit Lag Effect"
SETTINGS_GAME_GAMEPLAY_HEADING,Gameplay

1 keys en
17 SETTINGS_GAME_HEADING Game Configuration
18 SETTINGS_GAME_ACCESSIBILITY_HEADING Accessibility
19 SETTINGS_GAME_CAMERA_HEADING Camera
20 SETTINGS_GAME_TEXT_HEADING In-game Text
21 SETTINGS_TEXT_SPEED Text Display Speed
22 SETTINGS_SCREEN_SHAKE Enable Screen Shake
23 SETTINGS_HIT_LAG Enable Hit Lag Effect
24 SETTINGS_GAME_GAMEPLAY_HEADING Gameplay

View File

@ -21,7 +21,6 @@ run/max_fps=60
ClubCatalog="*res://src/equipment/clubs/club_catalog.tscn"
GameSettings="*res://src/game/game_settings.gd"
BindingLoader="*res://src/game/binding_loader.gd"
[debug]
@ -64,6 +63,7 @@ config/accessibility/enable_hit_lag=true
audio/buses/override_bus_layout="user://audio_bus_layout.tres"
config/gameplay/projection/detect_collision=true
config/gameplay/projection/use_local_gravity=true
config/text/default_text_speed=20.0
[global_group]

View File

@ -1,35 +0,0 @@
class_name BindingLoaderType extends Node
## Handles persisting action input bindings.
const BINDINGS_FILE := "user://bindings.tres"
func _ready() -> void:
# Map may not be defined if no keybinds have been written
if FileAccess.file_exists(BINDINGS_FILE):
print_debug("Reading keybinds from ", BINDINGS_FILE)
var map: BindingMap = load(BINDINGS_FILE) as BindingMap
# Overwrite InputMap with loaded bindings
for action: StringName in map.bindings.keys():
# Clear existing bindings
InputMap.action_erase_events(action)
# Apply loaded binding
var event: InputEvent = map.bindings[action]
if event:
InputMap.action_add_event(action, event)
func write() -> void:
# Build map from input actions
var map: BindingMap = BindingMap.new()
for action: StringName in InputMap.get_actions():
var events := InputMap.action_get_events(action)
if events:
map.bindings[action] = events[0]
else:
map.bindings[action] = null
# Write to disk
print_debug("Writing keybinds to ", BINDINGS_FILE)
ResourceSaver.save(map, BINDINGS_FILE)

View File

@ -10,12 +10,15 @@ var y_sensitivity: float
var x_acceleration: float
var y_acceleration: float
var invert_pitch: bool
var enable_screen_shake: bool
var enable_hit_lag: bool
var projection_collisions: bool
var projection_gravity: bool
var default_text_speed: float
func _init() -> void:
ProjectSettings.settings_changed.connect(_read_settings)
@ -46,6 +49,8 @@ func _read_settings() -> void:
"game/config/gameplay/projection/use_local_gravity"
)
default_text_speed = ProjectSettings.get_setting("game/config/text/default_text_speed")
func _load_audio_bus_override() -> void:
# Load override audio bus file

View File

@ -0,0 +1,40 @@
@tool
class_name TypewriterEffect
extends RichTextEffect
## BBCode effect which procedurally shows the text character by character, from start to end.
## Tag params:
## - speed - Speed at which text is displayed, in characters per second.
## - delay - Delay before displaying first character, in seconds.
signal typing
signal on_frame_process_start
# To use this effect:
# - Enable BBCode on a RichTextLabel.
# - Instead of instantiating this effect directly, use a `TypewriterLabel` node.
# - Use [type speed=10.0 delay=0.0]hello[/type] in text.
var bbcode: String = "type"
var _force_visible := false
func _init(force_visible_signal: Signal) -> void:
if force_visible_signal:
force_visible_signal.connect(_set_force_visible)
func _process_custom_fx(char_fx: CharFXTransform) -> bool:
if not _force_visible:
var speed: float = char_fx.env.get("speed", Game.settings.default_text_speed)
var delay: float = char_fx.env.get("delay", 0.0)
char_fx.visible = (char_fx.elapsed_time - delay) * speed >= char_fx.relative_index
if not char_fx.visible:
typing.emit()
return true
func _set_force_visible() -> void:
_force_visible = true

View File

@ -0,0 +1,53 @@
class_name TypewriterLabel extends RichTextLabel
## RichTextLabel with a managed typewriter effect.
## Allows for signal-based monitoring of a typewriter effect's status.
## In most cases you'll want to use this rather than instantiating TypewriterEffect yourself.
## Use `display_text` to set the text for this label.
## Emitted on the first frame that all characters in the typewriter effect are visible.
signal typing_finished
## Emit this to force the typewriter effect to finish on the next update.
## Useful for advancing skippable dialogue boxes.
signal force_visible
var _finished: bool = true
var _typing: bool = false
func _init() -> void:
bbcode_enabled = true
var effect := TypewriterEffect.new(force_visible)
effect.typing.connect(_on_typing)
install_effect(effect)
## Is the typewriter effect finished?
func is_finished() -> bool:
return _finished
## Reset the manager's progress monitor.
## This is called automatically when setting the label text with `set_text`
func reset() -> void:
_finished = false
## Clear the text box and set a new line of text.
## The `finished` signal will be emitted when the text is done displaying.
func display_text(text: String) -> void:
reset()
clear()
append_text(text)
func _process(_delta: float) -> void:
if not _finished:
if not _typing:
_finished = true
typing_finished.emit()
_typing = false
func _on_typing() -> void:
_typing = true

View File

@ -19,6 +19,10 @@ var listening: bool = false:
@onready var button: Button = %Button
func _get_settings_key() -> String:
return "input/%s" % key
func _ready() -> void:
# gdlint:ignore = private-method-call
super._ready()
@ -99,6 +103,12 @@ func rebind(event: InputEvent) -> void:
listening = false
func apply() -> void:
var setting: Dictionary = ProjectSettings.get_setting(_get_settings_key())
setting["events"] = InputMap.action_get_events(key)
ProjectSettings.set_setting(_get_settings_key(), setting)
static func create(_key: StringName) -> ControlBinding:
var instance: ControlBinding = SCENE.instantiate()
instance.key = _key

View File

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/ui/menus/settings_menu/control_binding/control_binding.gd" id="1_7mwhu"]
[node name="ControlBinding" type="PanelContainer"]
[node name="ControlBinding" type="PanelContainer" groups=["ControlBindings"]]
theme_type_variation = &"CheckerContainerOdd"
script = ExtResource("1_7mwhu")

View File

@ -3,6 +3,7 @@ extends MarginContainer
const SETTINGS_GROUP := "Settings"
const VOLUME_GROUP := "VolumeSliders"
const BINDINGS_GROUP := "ControlBindings"
@onready var bus_mixer_list: HBoxContainer = %BusMixerList
@onready var control_binding_list: VBoxContainer = %ControlBindingList
@ -25,6 +26,12 @@ func _get_volume_sliders() -> Array[VolumeSlider]:
return elements
func _get_control_bindings() -> Array[ControlBinding]:
var elements: Array[ControlBinding] = []
elements.assign(get_tree().get_nodes_in_group(BINDINGS_GROUP))
return elements
func populate_control_bindings() -> void:
for action: StringName in InputMap.get_actions():
if not action.begins_with("ui_"):
@ -47,12 +54,13 @@ func apply() -> void:
setting.apply()
for mixer: VolumeSlider in _get_volume_sliders():
mixer.apply()
for binding: ControlBinding in _get_control_bindings():
binding.apply()
## Write all applied settings to disk.
func save_settings() -> void:
Game.settings.write()
BindingLoader.write()
## Apply settings and close menu.

View File

@ -106,6 +106,28 @@ key = &"game/config/gameplay/projection/use_local_gravity"
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity" index="1"]
text = "SETTINGS_PROJECTION_GRAVITY"
[node name="TextHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"]
layout_mode = 2
[node name="Label" type="Label" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextHeading"]
layout_mode = 2
theme_type_variation = &"HeaderMedium"
text = "SETTINGS_GAME_TEXT_HEADING"
[node name="HSeparator" type="HSeparator" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextHeading"]
layout_mode = 2
size_flags_horizontal = 3
[node name="TextSpeed" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("3_jox8e")]
layout_mode = 2
key = &"game/config/text/default_text_speed"
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextSpeed" index="1"]
text = "SETTINGS_TEXT_SPEED"
[node name="SpinBox" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextSpeed/PanelContainer/MarginContainer/NumericSlider" index="1"]
suffix = "char/s"
[node name="CameraHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"]
layout_mode = 2
@ -492,6 +514,8 @@ text = "UI_ACCEPT"
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/HitLag"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionCollision"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextSpeed"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextSpeed/PanelContainer/MarginContainer/NumericSlider"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed/PanelContainer/MarginContainer/NumericSlider"]
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/SensitivityX"]

View File

@ -1,4 +0,0 @@
class_name BindingMap extends Resource
## Serializable action input map. Used by `BindingLoader`.
@export var bindings: Dictionary