generated from krampus/template-godot4
Compare commits
No commits in common. "37257dc3fd9023b9effe65bc0692202d2949f080" and "442c8ef7aab8e854a225d11c703447be36737fd5" have entirely different histories.
37257dc3fd
...
442c8ef7aa
BIN
asset_dev/balls/brick/Brick.png (Stored with Git LFS)
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)
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)
BIN
assets/models/balls/brick/Brick.png (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
|
@ -64,7 +64,7 @@
|
||||||
{
|
{
|
||||||
"bufferView":0,
|
"bufferView":0,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":42,
|
"count":24,
|
||||||
"max":[
|
"max":[
|
||||||
0.09207499027252197,
|
0.09207499027252197,
|
||||||
0.05715000629425049,
|
0.05715000629425049,
|
||||||
|
@ -80,45 +80,45 @@
|
||||||
{
|
{
|
||||||
"bufferView":1,
|
"bufferView":1,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":42,
|
"count":24,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"bufferView":2,
|
"bufferView":2,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":42,
|
"count":24,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"bufferView":3,
|
"bufferView":3,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":72,
|
"count":36,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bufferViews":[
|
"bufferViews":[
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":504,
|
"byteLength":288,
|
||||||
"byteOffset":0,
|
"byteOffset":0,
|
||||||
"target":34962
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":504,
|
"byteLength":288,
|
||||||
"byteOffset":504,
|
"byteOffset":288,
|
||||||
"target":34962
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":336,
|
"byteLength":192,
|
||||||
"byteOffset":1008,
|
"byteOffset":576,
|
||||||
"target":34962
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":144,
|
"byteLength":72,
|
||||||
"byteOffset":1344,
|
"byteOffset":768,
|
||||||
"target":34963
|
"target":34963
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
],
|
],
|
||||||
"buffers":[
|
"buffers":[
|
||||||
{
|
{
|
||||||
"byteLength":1488,
|
"byteLength":840,
|
||||||
"uri":"brick.bin"
|
"uri":"brick.bin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -17,8 +17,6 @@ SETTINGS_GAME,Game
|
||||||
SETTINGS_GAME_HEADING,"Game Configuration"
|
SETTINGS_GAME_HEADING,"Game Configuration"
|
||||||
SETTINGS_GAME_ACCESSIBILITY_HEADING,Accessibility
|
SETTINGS_GAME_ACCESSIBILITY_HEADING,Accessibility
|
||||||
SETTINGS_GAME_CAMERA_HEADING,Camera
|
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_SCREEN_SHAKE,"Enable Screen Shake"
|
||||||
SETTINGS_HIT_LAG,"Enable Hit Lag Effect"
|
SETTINGS_HIT_LAG,"Enable Hit Lag Effect"
|
||||||
SETTINGS_GAME_GAMEPLAY_HEADING,Gameplay
|
SETTINGS_GAME_GAMEPLAY_HEADING,Gameplay
|
||||||
|
|
|
|
@ -21,6 +21,7 @@ run/max_fps=60
|
||||||
|
|
||||||
ClubCatalog="*res://src/equipment/clubs/club_catalog.tscn"
|
ClubCatalog="*res://src/equipment/clubs/club_catalog.tscn"
|
||||||
GameSettings="*res://src/game/game_settings.gd"
|
GameSettings="*res://src/game/game_settings.gd"
|
||||||
|
BindingLoader="*res://src/game/binding_loader.gd"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
|
@ -63,7 +64,6 @@ config/accessibility/enable_hit_lag=true
|
||||||
audio/buses/override_bus_layout="user://audio_bus_layout.tres"
|
audio/buses/override_bus_layout="user://audio_bus_layout.tres"
|
||||||
config/gameplay/projection/detect_collision=true
|
config/gameplay/projection/detect_collision=true
|
||||||
config/gameplay/projection/use_local_gravity=true
|
config/gameplay/projection/use_local_gravity=true
|
||||||
config/text/default_text_speed=20.0
|
|
||||||
|
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
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)
|
|
@ -10,15 +10,12 @@ var y_sensitivity: float
|
||||||
var x_acceleration: float
|
var x_acceleration: float
|
||||||
var y_acceleration: float
|
var y_acceleration: float
|
||||||
var invert_pitch: bool
|
var invert_pitch: bool
|
||||||
|
|
||||||
var enable_screen_shake: bool
|
var enable_screen_shake: bool
|
||||||
var enable_hit_lag: bool
|
var enable_hit_lag: bool
|
||||||
|
|
||||||
var projection_collisions: bool
|
var projection_collisions: bool
|
||||||
var projection_gravity: bool
|
var projection_gravity: bool
|
||||||
|
|
||||||
var default_text_speed: float
|
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
ProjectSettings.settings_changed.connect(_read_settings)
|
ProjectSettings.settings_changed.connect(_read_settings)
|
||||||
|
@ -49,8 +46,6 @@ func _read_settings() -> void:
|
||||||
"game/config/gameplay/projection/use_local_gravity"
|
"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:
|
func _load_audio_bus_override() -> void:
|
||||||
# Load override audio bus file
|
# Load override audio bus file
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
@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
|
|
|
@ -1,53 +0,0 @@
|
||||||
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
|
|
|
@ -19,10 +19,6 @@ var listening: bool = false:
|
||||||
@onready var button: Button = %Button
|
@onready var button: Button = %Button
|
||||||
|
|
||||||
|
|
||||||
func _get_settings_key() -> String:
|
|
||||||
return "input/%s" % key
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
# gdlint:ignore = private-method-call
|
# gdlint:ignore = private-method-call
|
||||||
super._ready()
|
super._ready()
|
||||||
|
@ -103,12 +99,6 @@ func rebind(event: InputEvent) -> void:
|
||||||
listening = false
|
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:
|
static func create(_key: StringName) -> ControlBinding:
|
||||||
var instance: ControlBinding = SCENE.instantiate()
|
var instance: ControlBinding = SCENE.instantiate()
|
||||||
instance.key = _key
|
instance.key = _key
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://src/ui/menus/settings_menu/control_binding/control_binding.gd" id="1_7mwhu"]
|
[ext_resource type="Script" path="res://src/ui/menus/settings_menu/control_binding/control_binding.gd" id="1_7mwhu"]
|
||||||
|
|
||||||
[node name="ControlBinding" type="PanelContainer" groups=["ControlBindings"]]
|
[node name="ControlBinding" type="PanelContainer"]
|
||||||
theme_type_variation = &"CheckerContainerOdd"
|
theme_type_variation = &"CheckerContainerOdd"
|
||||||
script = ExtResource("1_7mwhu")
|
script = ExtResource("1_7mwhu")
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ extends MarginContainer
|
||||||
|
|
||||||
const SETTINGS_GROUP := "Settings"
|
const SETTINGS_GROUP := "Settings"
|
||||||
const VOLUME_GROUP := "VolumeSliders"
|
const VOLUME_GROUP := "VolumeSliders"
|
||||||
const BINDINGS_GROUP := "ControlBindings"
|
|
||||||
|
|
||||||
@onready var bus_mixer_list: HBoxContainer = %BusMixerList
|
@onready var bus_mixer_list: HBoxContainer = %BusMixerList
|
||||||
@onready var control_binding_list: VBoxContainer = %ControlBindingList
|
@onready var control_binding_list: VBoxContainer = %ControlBindingList
|
||||||
|
@ -26,12 +25,6 @@ func _get_volume_sliders() -> Array[VolumeSlider]:
|
||||||
return elements
|
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:
|
func populate_control_bindings() -> void:
|
||||||
for action: StringName in InputMap.get_actions():
|
for action: StringName in InputMap.get_actions():
|
||||||
if not action.begins_with("ui_"):
|
if not action.begins_with("ui_"):
|
||||||
|
@ -54,13 +47,12 @@ func apply() -> void:
|
||||||
setting.apply()
|
setting.apply()
|
||||||
for mixer: VolumeSlider in _get_volume_sliders():
|
for mixer: VolumeSlider in _get_volume_sliders():
|
||||||
mixer.apply()
|
mixer.apply()
|
||||||
for binding: ControlBinding in _get_control_bindings():
|
|
||||||
binding.apply()
|
|
||||||
|
|
||||||
|
|
||||||
## Write all applied settings to disk.
|
## Write all applied settings to disk.
|
||||||
func save_settings() -> void:
|
func save_settings() -> void:
|
||||||
Game.settings.write()
|
Game.settings.write()
|
||||||
|
BindingLoader.write()
|
||||||
|
|
||||||
|
|
||||||
## Apply settings and close menu.
|
## Apply settings and close menu.
|
||||||
|
|
|
@ -106,28 +106,6 @@ key = &"game/config/gameplay/projection/use_local_gravity"
|
||||||
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity" index="1"]
|
[node name="SettingLabel" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity" index="1"]
|
||||||
text = "SETTINGS_PROJECTION_GRAVITY"
|
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"]
|
[node name="CameraHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
@ -514,8 +492,6 @@ text = "UI_ACCEPT"
|
||||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/HitLag"]
|
[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/ProjectionCollision"]
|
||||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/ProjectionGravity"]
|
[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"]
|
||||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed/PanelContainer/MarginContainer/NumericSlider"]
|
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FreeCameraSpeed/PanelContainer/MarginContainer/NumericSlider"]
|
||||||
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/SensitivityX"]
|
[editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/SensitivityX"]
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
class_name BindingMap extends Resource
|
||||||
|
## Serializable action input map. Used by `BindingLoader`.
|
||||||
|
|
||||||
|
@export var bindings: Dictionary
|
Loading…
Reference in New Issue