generated from krampus/template-godot4
The rumblerrrrrrrrr
This commit is contained in:
parent
479efd9c28
commit
2b1aabd808
|
@ -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.60239, -0.744503, 0.28782, 0.687246, 0.667162, 0.287382, -0.405979, 0.0246872, 0.913549, -1.05514, 5.19617, 0.0989584)
|
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)
|
||||||
bone_name = "Hand.R"
|
bone_name = "Hand.R"
|
||||||
bone_idx = 11
|
bone_idx = 11
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://cefit4bc8akbb"]
|
[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="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="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"]
|
[ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_c3dlb"]
|
[sub_resource type="Animation" id="Animation_c3dlb"]
|
||||||
|
@ -159,7 +160,17 @@ libraries = {
|
||||||
"": SubResource("AnimationLibrary_1s0w0")
|
"": SubResource("AnimationLibrary_1s0w0")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ViewportContainer" type="SubViewportContainer" parent="RootControl"]
|
[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
|
unique_name_in_owner = true
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@ -171,7 +182,7 @@ grow_vertical = 2
|
||||||
stretch = true
|
stretch = true
|
||||||
script = ExtResource("3_rmm5i")
|
script = ExtResource("3_rmm5i")
|
||||||
|
|
||||||
[node name="Viewport" type="SubViewport" parent="RootControl/ViewportContainer"]
|
[node name="Viewport" type="SubViewport" parent="RootControl/Rumbler/ViewportContainer"]
|
||||||
handle_input_locally = false
|
handle_input_locally = false
|
||||||
msaa_2d = 3
|
msaa_2d = 3
|
||||||
msaa_3d = 3
|
msaa_3d = 3
|
||||||
|
@ -180,6 +191,6 @@ use_taa = true
|
||||||
size = Vector2i(1280, 720)
|
size = Vector2i(1280, 720)
|
||||||
render_target_update_mode = 4
|
render_target_update_mode = 4
|
||||||
|
|
||||||
[node name="Content" type="Node" parent="RootControl/ViewportContainer/Viewport"]
|
[node name="Content" type="Node" parent="RootControl/Rumbler/ViewportContainer/Viewport"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
|
|
|
@ -28,6 +28,7 @@ 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
|
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.
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
@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
|
|
@ -5,11 +5,10 @@ const SMALL_HIT_LAG_FRAMES := 5
|
||||||
const BIG_HIT_LAG_FRAMES := 10
|
const BIG_HIT_LAG_FRAMES := 10
|
||||||
const HUGE_HIT_LAG_FRAMES := 20
|
const HUGE_HIT_LAG_FRAMES := 20
|
||||||
|
|
||||||
var _screen_shake_intensity := 0.0
|
|
||||||
var _hit_lag_frames := -1
|
var _hit_lag_frames := -1
|
||||||
|
|
||||||
@onready var root_control: Control = %RootControl
|
|
||||||
@onready var content: Node = %Content
|
@onready var content: Node = %Content
|
||||||
|
@onready var rumbler: Rumbler = %Rumbler
|
||||||
|
|
||||||
|
|
||||||
## Start playing a screen shake effect.
|
## Start playing a screen shake effect.
|
||||||
|
@ -18,13 +17,24 @@ func screen_shake(intensity: float, duration: float = 0.2) -> void:
|
||||||
return
|
return
|
||||||
|
|
||||||
var tween := get_tree().create_tween()
|
var tween := get_tree().create_tween()
|
||||||
_screen_shake_intensity = intensity
|
rumbler.intensity = intensity
|
||||||
tween.tween_property(self, "_screen_shake_intensity", 0.0, duration).set_trans(
|
tween.tween_property(rumbler, "intensity", 0.0, duration).set_trans(Tween.TRANS_CUBIC)
|
||||||
Tween.TRANS_CUBIC
|
|
||||||
)
|
|
||||||
tween.tween_callback(_reset_position)
|
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.
|
## Hit lag for a small impact.
|
||||||
func hit_lag_small() -> void:
|
func hit_lag_small() -> void:
|
||||||
hit_lag(SMALL_HIT_LAG_FRAMES)
|
hit_lag(SMALL_HIT_LAG_FRAMES)
|
||||||
|
@ -53,10 +63,6 @@ func _reset_position() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if _screen_shake_intensity > 0:
|
|
||||||
position.x = randfn(0, _screen_shake_intensity)
|
|
||||||
position.y = randfn(0, _screen_shake_intensity)
|
|
||||||
|
|
||||||
if _hit_lag_frames >= 0:
|
if _hit_lag_frames >= 0:
|
||||||
if _hit_lag_frames == 0:
|
if _hit_lag_frames == 0:
|
||||||
content.process_mode = Node.PROCESS_MODE_INHERIT
|
content.process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=27 format=3 uid="uid://c4ifdiohng830"]
|
[gd_scene load_steps=28 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"]
|
||||||
|
|
||||||
[sub_resource type="Animation" id="Animation_3xds6"]
|
[sub_resource type="Animation" id="Animation_3xds6"]
|
||||||
resource_name = "RESET"
|
resource_name = "RESET"
|
||||||
|
@ -288,6 +289,18 @@ 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("%PowerBar/..: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"
|
||||||
|
@ -303,6 +316,18 @@ tracks/0/keys = {
|
||||||
"points": PackedFloat32Array(0, -0.25, 0, 0.233333, 0.0884774, 1, -0.267469, -0.483539, 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("%PowerBar/..: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 = {
|
||||||
|
@ -526,17 +551,23 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="PowerBar" type="ProgressBar" parent="ShotGauges/PowerGauge"]
|
[node name="Rumbler" type="Control" 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
|
grow_horizontal = 2
|
||||||
offset_right = 2.0
|
grow_vertical = 2
|
||||||
|
script = ExtResource("3_6groq")
|
||||||
|
|
||||||
|
[node name="PowerBar" type="ProgressBar" parent="ShotGauges/PowerGauge/Rumbler"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(30, 0)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
@ -545,7 +576,7 @@ fill_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("../PowerBar")
|
root_node = NodePath("../Rumbler/PowerBar")
|
||||||
libraries = {
|
libraries = {
|
||||||
"": SubResource("AnimationLibrary_coah5")
|
"": SubResource("AnimationLibrary_coah5")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue