Compare commits
No commits in common. "8c1b431f84966040208f715d92003311640c255f" and "5f6e7a3e8ec68af5b790bf226e62cd0257f36290" have entirely different histories.
8c1b431f84
...
5f6e7a3e8e
|
@ -8,8 +8,4 @@ CMKY: https://www.shadertoy.com/view/MltBW4
|
|||
Fresnel: https://godotshaders.com/snippet/fresnel/
|
||||
|
||||
Code:
|
||||
occlussion shader: https://www.reddit.com/r/godot/comments/rww6e9/comment/hrfa51g/?utm_source=share&utm_medium=web2x&context=3
|
||||
|
||||
|
||||
Sound:
|
||||
billiard-clack: https://freesound.org/people/Za-Games/sounds/539854/
|
||||
occlussion shader: https://www.reddit.com/r/godot/comments/rww6e9/comment/hrfa51g/?utm_source=share&utm_medium=web2x&context=3
|
Binary file not shown.
|
@ -1,24 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://c5v6c6x05lqg3"
|
||||
path="res://.godot/imported/billiard-clack.wav-3f99ec74be11d1cb465d3dc06a94b10f.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://audio/billiard-clack.wav"
|
||||
dest_files=["res://.godot/imported/billiard-clack.wav-3f99ec74be11d1cb465d3dc06a94b10f.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
|
@ -4,8 +4,7 @@ extends Node3D
|
|||
@export var initial_target: Node3D
|
||||
var target: Targetable = null
|
||||
@export var sensitivity := 0.01
|
||||
@export var charge_time := 1.7
|
||||
@export var min_charge := 0.2
|
||||
@export var charge_time := 2
|
||||
|
||||
func _ready():
|
||||
set_target(initial_target)
|
||||
|
@ -14,53 +13,26 @@ func get_charge():
|
|||
return %radial_ui.charge_amount
|
||||
|
||||
func _input(event):
|
||||
var billiard := target.get_billiard()
|
||||
if event is InputEventMouseMotion and MouseControl.mouse_is_locked() 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("charge"):
|
||||
charge(event.get_action_strength("charge"))
|
||||
|
||||
func _process(_delta):
|
||||
transform.origin = target.global_position
|
||||
camera.global_position = %camera_spot.global_position
|
||||
camera.look_at(target.global_position)
|
||||
if get_charge() >= 1.0:
|
||||
cancel_charge()
|
||||
|
||||
func cancel_charge():
|
||||
%radial_ui.set_charge(0.0)
|
||||
%ChargeSound.stop()
|
||||
if charge_tween != null:
|
||||
charge_tween.kill()
|
||||
charge_tween = null
|
||||
var billiard := target.get_billiard()
|
||||
billiard.can_hit = true
|
||||
|
||||
func release():
|
||||
if get_charge() <= min_charge:
|
||||
cancel_charge()
|
||||
return
|
||||
%ChargeReleaseSound.volume_db = get_charge() * 12
|
||||
%ChargeReleaseSound.play()
|
||||
var billiard := target.get_billiard()
|
||||
billiard.hit((target.global_position - %camera_spot.global_position).normalized())
|
||||
%radial_ui.set_charge(0.0)
|
||||
%ChargeSound.stop()
|
||||
if charge_tween != null:
|
||||
charge_tween.kill()
|
||||
charge_tween = null
|
||||
|
||||
var charge_tween: Tween = null
|
||||
func charge(_amount: float):
|
||||
var billiard := target.get_billiard()
|
||||
billiard.can_hit = false
|
||||
func charge(amount: float):
|
||||
if charge_tween != null:
|
||||
charge_tween.kill()
|
||||
if amount == 0.0:
|
||||
%radial_ui.set_charge(0.0)
|
||||
$AudioStreamPlayer.stop()
|
||||
return
|
||||
charge_tween = create_tween()
|
||||
charge_tween.tween_method(%radial_ui.set_charge, 0.0, 1.0, charge_time)
|
||||
%ChargeSound.play()
|
||||
$AudioStreamPlayer.play()
|
||||
|
||||
func rotate_view(amount: Vector2):
|
||||
rotate_y(-amount.x)
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://drmb4sitb74fx"]
|
||||
[gd_scene load_steps=4 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"]
|
||||
|
||||
[node name="controller" type="Node3D"]
|
||||
top_level = true
|
||||
|
@ -19,10 +18,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0)
|
|||
[node name="radial_ui" parent="." instance=ExtResource("2_qidcb")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="ChargeSound" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_exgm6")
|
||||
|
||||
[node name="ChargeReleaseSound" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("4_12r5s")
|
||||
|
|
|
@ -6,9 +6,6 @@ class_name Targetable
|
|||
static func is_targetable(node: Node3D) -> Targetable:
|
||||
return node.get_node_or_null("is_targetable")
|
||||
|
||||
func get_billiard() -> Billiard:
|
||||
return get_parent()
|
||||
|
||||
func make_target():
|
||||
walk_meshes_post_order(self.get_parent(), change_all_materials)
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ _subresources={
|
|||
"PATH:grape2": {
|
||||
"generate/physics": true,
|
||||
"physics/body_type": 1,
|
||||
"physics/shape_type": 4,
|
||||
"primitive/radius": 0.03
|
||||
"physics/shape_type": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1 @@
|
|||
extends RigidBody3D
|
||||
class_name Billiard
|
||||
|
||||
var can_hit = true
|
||||
|
||||
func hit(impulse: Vector3):
|
||||
apply_central_impulse(impulse)
|
||||
|
|
|
@ -22,10 +22,11 @@ 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")]
|
||||
[node name="billiard" parent="." index="4" instance=ExtResource("3_gijly")]
|
||||
|
||||
[node name="grape" parent="." index="5" instance=ExtResource("3_gijly")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.56762, 0.385236)
|
||||
|
||||
[node name="grape2" parent="." index="5" instance=ExtResource("3_gijly")]
|
||||
[node name="grape2" parent="." index="6" instance=ExtResource("3_gijly")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.60495, 0)
|
||||
|
|
Loading…
Reference in New Issue