This commit is contained in:
Spencer Killen 2023-11-11 21:25:18 -07:00
parent eb668bfd63
commit 972c374f4e
Signed by: sjkillen
GPG Key ID: 3AF3117BA6FBB75B
6 changed files with 45 additions and 13 deletions

View File

@ -13,3 +13,6 @@ occlussion shader: https://www.reddit.com/r/godot/comments/rww6e9/comment/hrfa51
Sound:
billiard-clack: https://freesound.org/people/Za-Games/sounds/539854/
https://freesound.org/people/original_sound/sounds/372197/

BIN
godot/audio/error.mp3 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bg07vavc0duo5"
path="res://.godot/imported/error.mp3-e904d198a343e1da5de4876587f3ccef.mp3str"
[deps]
source_file="res://audio/error.mp3"
dest_files=["res://.godot/imported/error.mp3-e904d198a343e1da5de4876587f3ccef.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -11,6 +11,7 @@ var camera_tweening = false
func _ready():
set_target(initial_target, false)
camera.set_as_top_level(true)
ControllerEventBus.billiard_touched_billiard.connect(_on_billiard_touched_billiard)
func _on_billiard_touched_billiard(who: Billiard, touched: Billiard):
@ -26,14 +27,17 @@ func get_charge():
func _input(event):
var billiard := target.get_billiard()
if camera_tweening:
if camera_tweening or not MouseControl.mouse_is_locked():
return
if event is InputEventMouseMotion and MouseControl.mouse_is_locked() and get_charge() == 0.0 :
if event is InputEventMouseMotion and get_charge() == 0.0 :
rotate_view(event.relative*sensitivity)
if event.is_action_released("charge") and not billiard.can_hit and charge_tween != null:
release()
if event.is_action_pressed("charge") and billiard.can_hit and charge_tween == null:
if event.is_action_pressed("charge") and charge_tween == null:
if billiard.can_hit:
charge(event.get_action_strength("charge"))
else:
$NoChargesSound.play()
func _process(delta):
transform.origin = target.global_position
@ -41,10 +45,9 @@ func _process(delta):
if not camera_tweening:
camera.global_transform = %camera_spot.global_transform
else:
camera_tweening = false
camera.global_position = lerp(camera.global_position, %camera_spot.global_position, delta)
camera.global_rotation = lerp(camera.global_rotation, %camera_spot.global_rotation, delta)
var epsilon: float = 0.0001
camera.global_position = lerp(camera.global_position, %camera_spot.global_position, 0.5)
camera.global_rotation = lerp(camera.global_rotation, %camera_spot.global_rotation, 0.5)
var epsilon: float = 0.005
if (camera.global_position - %camera_spot.global_position).length() <= epsilon and (camera.global_rotation - %camera_spot.global_rotation).length() <= epsilon:
camera_tweening = false

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=5 format=3 uid="uid://drmb4sitb74fx"]
[gd_scene load_steps=6 format=3 uid="uid://drmb4sitb74fx"]
[ext_resource type="Script" path="res://control_scheme/controller.gd" id="1_h3pjb"]
[ext_resource type="PackedScene" uid="uid://p2n48c8st55d" path="res://control_scheme/radial_ui.tscn" id="2_qidcb"]
[ext_resource type="AudioStream" uid="uid://ckhf7ksthi053" path="res://audio/charge.wav" id="3_exgm6"]
[ext_resource type="AudioStream" uid="uid://c5v6c6x05lqg3" path="res://audio/billiard-clack.wav" id="4_12r5s"]
[ext_resource type="AudioStream" uid="uid://bg07vavc0duo5" path="res://audio/error.mp3" id="5_l6rvw"]
[node name="controller" type="Node3D"]
top_level = true
@ -26,3 +27,6 @@ stream = ExtResource("3_exgm6")
[node name="ChargeReleaseSound" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("4_12r5s")
[node name="NoChargesSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource("5_l6rvw")

View File

@ -19,12 +19,9 @@ environment = SubResource("Environment_f0m14")
transform = Transform3D(1, 0, 0, 0, 0.933762, 0.357895, 0, -0.357895, 0.933762, 0, 1.43864, 1.81738)
[node name="controller" parent="." index="3" node_paths=PackedStringArray("camera", "initial_target") instance=ExtResource("2_dcvuq")]
camera = NodePath("Camera3D")
camera = NodePath("../Camera3D")
initial_target = NodePath("../grape")
[node name="Camera3D" type="Camera3D" parent="controller" index="1"]
current = true
[node name="grape" parent="." index="4" instance=ExtResource("3_gijly")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.56762, 0.385236)
@ -32,3 +29,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.56762, 0.385236)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.115958, 1.77839, -0.189013)
[node name="TAS UI" parent="." index="6" instance=ExtResource("4_8yatx")]
[node name="Camera3D" type="Camera3D" parent="." index="7"]
current = true