Compare commits

..

No commits in common. "96c73c5587fad53583752d5112d557248f1697d3" and "358d7c2eb44a6c12e43c7b5a6dc891293b1d0218" have entirely different histories.

26 changed files with 21 additions and 758 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/ui/gauge_patch.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5812y3pmmgg5"
path="res://.godot/imported/gauge_patch.png-b06ef6737fda05dbce8a7a52b995acf4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/gauge_patch.png"
dest_files=["res://.godot/imported/gauge_patch.png-b06ef6737fda05dbce8a7a52b995acf4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/ui/lifebar_fill_grey.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dtdqninlnu10o"
path="res://.godot/imported/lifebar_fill_grey.png-c028996d6e86e26137270a39216a5fd3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/lifebar_fill_grey.png"
dest_files=["res://.godot/imported/lifebar_fill_grey.png-c028996d6e86e26137270a39216a5fd3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/ui/lifebar_patch.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bvwh0yunmvirp"
path="res://.godot/imported/lifebar_patch.png-768842f340e38f78b7b90bbcd2d8dff9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/lifebar_patch.png"
dest_files=["res://.godot/imported/lifebar_patch.png-768842f340e38f78b7b90bbcd2d8dff9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/ui/power_gauge_fill.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://76fjx2ukavqe"
path="res://.godot/imported/power_gauge_fill.png-b7c279ae4fc601ab214f21b9b72d50c3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/power_gauge_fill.png"
dest_files=["res://.godot/imported/power_gauge_fill.png-b7c279ae4fc601ab214f21b9b72d50c3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
assets/ui/power_gauge_tab.png (Stored with Git LFS)

Binary file not shown.

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://4a8tvjgwegv3"
path="res://.godot/imported/power_gauge_tab.png-7979d59b50c40895525fdf1648e50b30.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ui/power_gauge_tab.png"
dest_files=["res://.godot/imported/power_gauge_tab.png-7979d59b50c40895525fdf1648e50b30.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -12,7 +12,7 @@ config_version=5
config/name="GFOLF 2" config/name="GFOLF 2"
config/description="GFOLF: Combat Golf Action" config/description="GFOLF: Combat Golf Action"
run/main_scene="res://src/game/game.tscn" run/main_scene="res://src/world/world.tscn"
config/features=PackedStringArray("4.3", "Forward Plus") config/features=PackedStringArray("4.3", "Forward Plus")
run/max_fps=60 run/max_fps=60
@ -55,13 +55,10 @@ config/controls/camera/y_axis_sensitivity=0.45
config/controls/camera/x_axis_acceleration=30.0 config/controls/camera/x_axis_acceleration=30.0
config/controls/camera/y_axis_acceleration=30.0 config/controls/camera/y_axis_acceleration=30.0
config/controls/camera/invert_pitch=false config/controls/camera/invert_pitch=false
config/accessibility/enable_screen_shake=true
config/accessibility/enable_hit_lag=true
[global_group] [global_group]
WorldGroup="Singleton group for the active world instance, if any." WorldGroup="Singleton group for the active world instance, if any."
GameGroup="Singleton group for the active game instance, if any."
[gui] [gui]
@ -149,26 +146,6 @@ select_putter={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":53,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
] ]
} }
debug_1={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
debug_2={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
debug_3={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194334,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
debug_4={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194335,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]
@ -186,3 +163,6 @@ jolt_3d/limits/max_temporary_memory=64
[rendering] [rendering]
textures/canvas_textures/default_texture_filter=0 textures/canvas_textures/default_texture_filter=0
anti_aliasing/quality/msaa_3d=3
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_debanding=true

View File

@ -169,7 +169,7 @@ bones/23/scale = Vector3(1, 1, 1)
visible = false visible = false
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"] [node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"]
transform = Transform3D(-0.0322545, -0.997872, -0.0566733, 0.99947, -0.0324594, 0.00269896, -0.00453261, -0.0565562, 0.998389, -2.5177, 5.22011, -0.516371) transform = Transform3D(-0.947388, 0.307308, -0.089546, -0.319114, -0.928605, 0.189367, -0.0249588, 0.207979, 0.977815, -0.157835, 3.16355, 0.865627)
bone_name = "Hand.R" bone_name = "Hand.R"
bone_idx = 11 bone_idx = 11

View File

@ -1,110 +0,0 @@
class_name Game extends Node
## Wrapper for the game application
@export var start_scene: String = "res://src/world/world.tscn"
var _loading_resources := {}
@onready var viewport: GameViewportContainer = %ViewportContainer
@onready var content: Node = %Content
@onready var loader_transition: AnimationPlayer = %LoaderTransition
@onready var loading_screen: Control = %LoadingScreen
static var group := "GameGroup" # hey i'm group
class Promise:
var _callbacks: Array[Callable] = []
var _end_callbacks: Array[Callable] = []
func then(fn: Callable) -> Promise:
_callbacks.push_back(fn)
return self
func finally(fn: Callable) -> Promise:
_end_callbacks.push_back(fn)
return self
func resolve(res: Variant) -> void:
for fn: Callable in _callbacks + _end_callbacks:
fn.call(res)
class ScenePromise:
extends Promise
func resolve(res: Variant) -> void:
var instance: Node = (res as PackedScene).instantiate()
super.resolve(instance)
func _initial_load() -> void:
queue_scene(start_scene)
func _ready() -> void:
call_deferred("_initial_load")
## Unload the running scene & queue up a new scene to be loaded in the background.
##
## The loading screen will be shown until the scene is loaded.
func queue_scene(path: String) -> Promise:
if not loading_screen.visible:
loading_screen.show()
loading_screen.modulate = Color.WHITE
for child: Node in content.get_children():
child.queue_free()
return queue_load(path, ScenePromise.new()).finally(_finish_scene_load)
## Queue a resource to be loaded in the background.
##
## Returns a `Promise` which can be used to attach callbacks
## which will be called with the resource after it is loaded.
func queue_load(path: String, promise: Promise = null) -> Promise:
if not promise:
promise = Promise.new()
_loading_resources[path] = promise
ResourceLoader.load_threaded_request(path)
return promise
func _finish_scene_load(instance: Node) -> void:
content.add_child(instance)
instance.reparent(content)
func _process(_delta: float) -> void:
# REMOVEME
if Input.is_action_just_pressed("debug_1"):
viewport.hit_lag(1)
if Input.is_action_just_pressed("debug_2"):
viewport.hit_lag_small()
if Input.is_action_just_pressed("debug_3"):
viewport.hit_lag_big()
if Input.is_action_just_pressed("debug_4"):
viewport.hit_lag_huge()
if _loading_resources and not loading_screen.visible:
loader_transition.play("fade_in")
for key: String in _loading_resources.keys():
match ResourceLoader.load_threaded_get_status(key):
ResourceLoader.THREAD_LOAD_LOADED:
@warning_ignore("unsafe_cast")
(_loading_resources[key] as Promise).resolve(ResourceLoader.load_threaded_get(key))
_loading_resources.erase(key)
ResourceLoader.THREAD_LOAD_FAILED:
assert(false, "Failed loading resource: " + key)
ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
assert(false, "Can't load invalid resource: " + key)
_:
# Continue loading
pass
if not _loading_resources and loading_screen.visible:
loader_transition.play("fade_out")

View File

@ -1,196 +0,0 @@
[gd_scene load_steps=9 format=3 uid="uid://cefit4bc8akbb"]
[ext_resource type="Script" path="res://src/game/game.gd" id="1_4qa87"]
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_y3adf"]
[ext_resource type="Script" path="res://src/ui/decorations/rumbler.gd" id="3_3vfdb"]
[ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"]
[sub_resource type="Animation" id="Animation_c3dlb"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_2c1ud"]
resource_name = "fade_in"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_xbqy2"]
resource_name = "fade_out"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1s0w0"]
_data = {
"RESET": SubResource("Animation_c3dlb"),
"fade_in": SubResource("Animation_2c1ud"),
"fade_out": SubResource("Animation_xbqy2")
}
[node name="Game" type="Node" groups=["GameGroup"]]
process_mode = 3
script = ExtResource("1_4qa87")
[node name="RootControl" type="Control" parent="."]
unique_name_in_owner = true
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="LoadingScreen" type="Control" parent="RootControl"]
unique_name_in_owner = true
z_index = 128
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="ColorRect" type="ColorRect" parent="RootControl/LoadingScreen"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 1)
[node name="MarginContainer" type="MarginContainer" parent="RootControl/LoadingScreen"]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -1.0
offset_top = -42.0
grow_horizontal = 0
grow_vertical = 0
theme_override_constants/margin_right = 64
theme_override_constants/margin_bottom = 32
[node name="RichTextLabel" type="RichTextLabel" parent="RootControl/LoadingScreen/MarginContainer"]
custom_minimum_size = Vector2(160, 0)
layout_mode = 2
mouse_filter = 2
theme_override_colors/default_color = Color(1, 0.75, 0.75, 1)
theme_override_fonts/normal_font = ExtResource("2_y3adf")
theme_override_font_sizes/normal_font_size = 32
bbcode_enabled = true
text = "[wave]LOADING...[/wave]"
fit_content = true
[node name="LoaderTransition" type="AnimationPlayer" parent="RootControl/LoadingScreen"]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_1s0w0")
}
[node name="Rumbler" type="Control" parent="RootControl"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("3_3vfdb")
[node name="ViewportContainer" type="SubViewportContainer" parent="RootControl/Rumbler"]
unique_name_in_owner = true
process_mode = 3
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
stretch = true
script = ExtResource("3_rmm5i")
[node name="Viewport" type="SubViewport" parent="RootControl/Rumbler/ViewportContainer"]
handle_input_locally = false
msaa_2d = 3
msaa_3d = 3
screen_space_aa = 1
use_taa = true
size = Vector2i(1280, 720)
render_target_update_mode = 4
[node name="Content" type="Node" parent="RootControl/Rumbler/ViewportContainer/Viewport"]
unique_name_in_owner = true
process_mode = 1

View File

@ -9,7 +9,6 @@
[resource] [resource]
script = ExtResource("4_8ybyj") script = ExtResource("4_8ybyj")
name = "DEBUG Gfolfer" name = "DEBUG Gfolfer"
life = 100.0
driver = ExtResource("1_sn8fd") driver = ExtResource("1_sn8fd")
iron = ExtResource("2_piku2") iron = ExtResource("2_piku2")
wedge = ExtResource("5_wm4ae") wedge = ExtResource("5_wm4ae")

View File

@ -28,9 +28,6 @@ const CAMERA_SNAP_TIME := 0.3
const WASTED_BALL_RETURN_DELAY := 3.5 const WASTED_BALL_RETURN_DELAY := 3.5
## Shots above this threshold trigger a "big power" effect
const BIG_POWER_THRESHOLD := 0.7
## In Driving Range mode, the ball can be retrieved in the shot phase. ## In Driving Range mode, the ball can be retrieved in the shot phase.
@export var driving_range := false @export var driving_range := false
@ -145,7 +142,6 @@ var _tracking_camera: OrbitalCamera
@onready var phys_ball_scene := preload("res://src/equipment/balls/physics_ball/physics_ball.tscn") @onready var phys_ball_scene := preload("res://src/equipment/balls/physics_ball/physics_ball.tscn")
@onready var world: World = get_tree().get_first_node_in_group(World.group) @onready var world: World = get_tree().get_first_node_in_group(World.group)
@onready var game: Game = get_tree().get_first_node_in_group(Game.group)
@onready var _target_rotation := Vector2(pitch.rotation.x, direction.rotation.y) @onready var _target_rotation := Vector2(pitch.rotation.x, direction.rotation.y)
@ -210,17 +206,6 @@ func get_shot_impulse(meter_pct: float) -> Vector3:
func take_shot() -> void: func take_shot() -> void:
# Impact screenshake & hitlag
if game:
if shot_power > BIG_POWER_THRESHOLD:
game.viewport.hit_lag_big()
var shake_intensity: float = (
10.0 * (shot_power - BIG_POWER_THRESHOLD) / (1.0 - BIG_POWER_THRESHOLD)
)
game.viewport.screen_shake(shake_intensity, 1.0)
else:
game.viewport.hit_lag_small()
print_debug("WHACK!\nPower: ", shot_power, "\nCurve: ", shot_curve) print_debug("WHACK!\nPower: ", shot_power, "\nCurve: ", shot_curve)
var impulse := get_shot_impulse(shot_power) var impulse := get_shot_impulse(shot_power)

View File

@ -179,7 +179,7 @@ tracks/2/keys = {
[sub_resource type="Animation" id="Animation_u8k07"] [sub_resource type="Animation" id="Animation_u8k07"]
resource_name = "swing_delay" resource_name = "swing_delay"
length = 0.0667 length = 0.2
step = 0.01 step = 0.01
tracks/0/type = "method" tracks/0/type = "method"
tracks/0/imported = false tracks/0/imported = false
@ -188,7 +188,7 @@ tracks/0/path = NodePath("%Direction/..")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0.0667), "times": PackedFloat32Array(0.18),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"values": [{ "values": [{
"args": [], "args": [],

View File

@ -1,18 +1,8 @@
class_name WorldPlayer extends Resource class_name WorldPlayer extends Resource
## Container for the state of the player within the world. ## Container for the state of the player within the world.
signal on_life_changed(new_value: float)
@export_range(0, 100) var life: float = 100.0:
set(value):
if value != life:
life = value
on_life_changed.emit(value)
@export_category("Profile")
# TODO character select # TODO character select
@export var name: String = "Gfolfer" @export var name: String = "Gfolfer"
@export var color: Color = Color("ff7070")
@export_category("Equipment") @export_category("Equipment")
@export var driver: Club @export var driver: Club

View File

@ -1,15 +0,0 @@
@tool
class_name Rumbler extends Control
## Rumbles children.
const EPSILON := 1e-6
@export var intensity := 0.0
func _process(_delta: float) -> void:
if intensity > EPSILON:
position.x = randfn(0, intensity)
position.y = randfn(0, intensity)
else:
position = Vector2.ZERO

View File

@ -1,71 +0,0 @@
class_name GameViewportContainer extends SubViewportContainer
## SubViewportContainer with game-specific special effects
const SMALL_HIT_LAG_FRAMES := 5
const BIG_HIT_LAG_FRAMES := 10
const HUGE_HIT_LAG_FRAMES := 20
var _hit_lag_frames := -1
@onready var content: Node = %Content
@onready var rumbler: Rumbler = %Rumbler
## Start playing a screen shake effect.
func screen_shake(intensity: float, duration: float = 0.2) -> void:
if not ProjectSettings.get_setting("game/config/accessibility/enable_screen_shake"):
return
var tween := get_tree().create_tween()
rumbler.intensity = intensity
tween.tween_property(rumbler, "intensity", 0.0, duration).set_trans(Tween.TRANS_CUBIC)
tween.tween_callback(_reset_position)
## Rumble the screen indefinitely.
func set_rumble(intensity: float) -> void:
if not ProjectSettings.get_setting("game/config/accessibility/enable_screen_shake"):
return
rumbler.intensity = intensity
## Stop rumbling the screen.
func stop_rumble() -> void:
set_rumble(0)
## Hit lag for a small impact.
func hit_lag_small() -> void:
hit_lag(SMALL_HIT_LAG_FRAMES)
## Hit lag for a big impact.
func hit_lag_big() -> void:
hit_lag(BIG_HIT_LAG_FRAMES)
## Hit lag for a huge impact.
func hit_lag_huge() -> void:
hit_lag(HUGE_HIT_LAG_FRAMES)
## Stop processing for some number of frames.
func hit_lag(frames: int = 1) -> void:
if not ProjectSettings.get_setting("game/config/accessibility/enable_hit_lag"):
return
_hit_lag_frames = frames
func _reset_position() -> void:
position = Vector2.ZERO
func _process(_delta: float) -> void:
if _hit_lag_frames >= 0:
if _hit_lag_frames == 0:
content.process_mode = Node.PROCESS_MODE_INHERIT
else:
content.process_mode = Node.PROCESS_MODE_DISABLED
_hit_lag_frames -= 1

View File

@ -1,9 +1,8 @@
class_name ShotHUD extends Control class_name ShotHUD extends Control
## HUD for main gameplay loop ## HUD for main gameplay loop
@onready var power_bar: TextureProgressBar = %PowerBar @onready var power_bar: ProgressBar = %PowerBar
@onready var curve_bar: ProgressBar = %CurveBar @onready var curve_bar: ProgressBar = %CurveBar
@onready var life_bar: TextureProgressBar = %LifeBar
@onready var club_selector: ClubSelector = %ClubSelector @onready var club_selector: ClubSelector = %ClubSelector
@ -15,8 +14,6 @@ class_name ShotHUD extends Control
@onready var _nice_animation: AnimationPlayer = %NiceAnimation @onready var _nice_animation: AnimationPlayer = %NiceAnimation
@onready var _wasted_animation: AnimationPlayer = %WastedAnimation @onready var _wasted_animation: AnimationPlayer = %WastedAnimation
@onready var _player_name: Label = %PlayerName
@onready var _state: AnimationNodeStateMachinePlayback = hud_state_machine["parameters/playback"] @onready var _state: AnimationNodeStateMachinePlayback = hud_state_machine["parameters/playback"]
@ -24,10 +21,7 @@ class_name ShotHUD extends Control
func set_state_for_player(player: WorldPlayer) -> void: func set_state_for_player(player: WorldPlayer) -> void:
print_debug("Setting HUD for player ", player.name) print_debug("Setting HUD for player ", player.name)
club_selector.set_state_for_player(player) club_selector.set_state_for_player(player)
_player_name.text = player.name # TODO life
# TODO animate on life loss?
life_bar.value = player.life
life_bar.tint_progress = player.color
# TODO special equipment # TODO special equipment
# TODO abilities # TODO abilities

View File

@ -1,15 +1,8 @@
[gd_scene load_steps=34 format=3 uid="uid://c4ifdiohng830"] [gd_scene load_steps=27 format=3 uid="uid://c4ifdiohng830"]
[ext_resource type="Script" path="res://src/ui/shot_hud/shot_hud.gd" id="1_x5b4c"] [ext_resource type="Script" path="res://src/ui/shot_hud/shot_hud.gd" id="1_x5b4c"]
[ext_resource type="Shader" path="res://src/shaders/canvas_retro.gdshader" id="1_ybxxp"] [ext_resource type="Shader" path="res://src/shaders/canvas_retro.gdshader" id="1_ybxxp"]
[ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/ui/shot_hud/club_selector/club_selector.tscn" id="2_1hdub"] [ext_resource type="PackedScene" uid="uid://445qd7m4qe2j" path="res://src/ui/shot_hud/club_selector/club_selector.tscn" id="2_1hdub"]
[ext_resource type="Script" path="res://src/ui/decorations/rumbler.gd" id="3_6groq"]
[ext_resource type="Texture2D" uid="uid://b5812y3pmmgg5" path="res://assets/ui/gauge_patch.png" id="4_5kcpe"]
[ext_resource type="Texture2D" uid="uid://76fjx2ukavqe" path="res://assets/ui/power_gauge_fill.png" id="5_3i1yq"]
[ext_resource type="Texture2D" uid="uid://4a8tvjgwegv3" path="res://assets/ui/power_gauge_tab.png" id="6_sw48q"]
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="8_bejx4"]
[ext_resource type="Texture2D" uid="uid://bvwh0yunmvirp" path="res://assets/ui/lifebar_patch.png" id="9_4f1d7"]
[ext_resource type="Texture2D" uid="uid://dtdqninlnu10o" path="res://assets/ui/lifebar_fill_grey.png" id="10_130v7"]
[sub_resource type="Animation" id="Animation_3xds6"] [sub_resource type="Animation" id="Animation_3xds6"]
resource_name = "RESET" resource_name = "RESET"
@ -287,7 +280,7 @@ length = 0.001
tracks/0/type = "bezier" tracks/0/type = "bezier"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("../Rumbler/PowerBar:value") tracks/0/path = NodePath(".:value")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
@ -295,18 +288,6 @@ tracks/0/keys = {
"points": PackedFloat32Array(0, -0.25, 0, 0.25, 0), "points": PackedFloat32Array(0, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0) "times": PackedFloat32Array(0)
} }
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../Rumbler:intensity")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_67gmp"] [sub_resource type="Animation" id="Animation_67gmp"]
resource_name = "fill" resource_name = "fill"
@ -314,26 +295,14 @@ length = 1.618
tracks/0/type = "bezier" tracks/0/type = "bezier"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("../Rumbler/PowerBar:value") tracks/0/path = NodePath(".:value")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"handle_modes": PackedInt32Array(0, 0), "handle_modes": PackedInt32Array(0, 0),
"points": PackedFloat32Array(0, -0.25, 0, 0.233333, 0.598765, 1, -0.351333, -0.246032, 0.25, 0), "points": PackedFloat32Array(0, -0.25, 0, 0.233333, 0.0884774, 1, -0.267469, -0.483539, 0.25, 0),
"times": PackedFloat32Array(0, 1.618) "times": PackedFloat32Array(0, 1.618)
} }
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../Rumbler:intensity")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(1.06667, 1.618),
"transitions": PackedFloat32Array(2.618, 1),
"update": 0,
"values": [0.0, 2.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_coah5"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_coah5"]
_data = { _data = {
@ -557,53 +526,26 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
mouse_filter = 1 mouse_filter = 1
[node name="Rumbler" type="Control" parent="ShotGauges/PowerGauge"] [node name="PowerBar" type="ProgressBar" parent="ShotGauges/PowerGauge"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(30, 0)
layout_mode = 1 layout_mode = 1
anchors_preset = 13 anchors_preset = 13
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -2.0
offset_right = 2.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("3_6groq") mouse_filter = 1
[node name="PowerBar" type="TextureProgressBar" parent="ShotGauges/PowerGauge/Rumbler"]
unique_name_in_owner = true
visible = false
texture_filter = 5
custom_minimum_size = Vector2(64, 0)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
max_value = 1.0 max_value = 1.0
step = 0.01
fill_mode = 2 fill_mode = 2
nine_patch_stretch = true
stretch_margin_left = 16
stretch_margin_top = 16
stretch_margin_right = 16
stretch_margin_bottom = 16
texture_under = ExtResource("4_5kcpe")
texture_progress = ExtResource("5_3i1yq")
[node name="TitleTab" type="TextureRect" parent="ShotGauges/PowerGauge/Rumbler/PowerBar"]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -8.0
offset_right = 19.0
offset_bottom = 48.0
grow_horizontal = 0
texture = ExtResource("6_sw48q")
stretch_mode = 2
[node name="PowerAnimation" type="AnimationPlayer" parent="ShotGauges/PowerGauge"] [node name="PowerAnimation" type="AnimationPlayer" parent="ShotGauges/PowerGauge"]
unique_name_in_owner = true unique_name_in_owner = true
root_node = NodePath(".") root_node = NodePath("../PowerBar")
libraries = { libraries = {
"": SubResource("AnimationLibrary_coah5") "": SubResource("AnimationLibrary_coah5")
} }
@ -661,53 +603,3 @@ unique_name_in_owner = true
root_node = NodePath("%HUDStateMachine/..") root_node = NodePath("%HUDStateMachine/..")
tree_root = SubResource("AnimationNodeStateMachine_osrbp") tree_root = SubResource("AnimationNodeStateMachine_osrbp")
anim_player = NodePath("../HUDAnimation") anim_player = NodePath("../HUDAnimation")
[node name="SouthWest" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_top = 1.0
anchor_right = 0.333
anchor_bottom = 1.0
offset_top = -40.0
offset_right = 40.0
grow_vertical = 0
theme_override_constants/margin_left = 16
theme_override_constants/margin_bottom = 16
[node name="VBoxContainer" type="VBoxContainer" parent="SouthWest"]
layout_mode = 2
theme_override_constants/separation = -8
[node name="HBoxContainer" type="HBoxContainer" parent="SouthWest/VBoxContainer"]
layout_mode = 2
[node name="Spacer" type="Control" parent="SouthWest/VBoxContainer/HBoxContainer"]
custom_minimum_size = Vector2(24, 0)
layout_mode = 2
[node name="PlayerName" type="Label" parent="SouthWest/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 3
theme_override_constants/shadow_offset_y = 0
theme_override_constants/outline_size = 2
theme_override_constants/shadow_outline_size = 2
theme_override_fonts/font = ExtResource("8_bejx4")
theme_override_font_sizes/font_size = 32
text = "PLAYER NAME"
[node name="LifeBar" type="TextureProgressBar" parent="SouthWest/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 48)
layout_mode = 2
min_value = -4.0
step = 0.01
nine_patch_stretch = true
stretch_margin_left = 32
stretch_margin_top = 16
stretch_margin_right = 32
stretch_margin_bottom = 16
texture_under = ExtResource("9_4f1d7")
texture_progress = ExtResource("10_130v7")