generated from krampus/template-godot4
Implemented wedge & iron
This commit is contained in:
parent
cd1111d514
commit
ed23981b19
|
@ -10,9 +10,9 @@
|
|||
[ext_resource type="Texture2D" uid="uid://con5a36t6n6sq" path="res://assets/textures/clear_sea_water_2048x2048.png" id="7_t86h2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cy7t2tc4y3b4" path="res://src/player/shot_setup/shot_setup.tscn" id="8_h44v5"]
|
||||
[ext_resource type="Script" path="res://src/world/ball_zone/ball_zone.gd" id="9_jwlau"]
|
||||
[ext_resource type="PackedScene" uid="uid://dagh38vap4t1d" path="res://src/scenery/city/concrete_building_1.tscn" id="10_lf15j"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjubxs7peir5k" path="res://src/scenery/city/kana_signboard.tscn" id="11_evxup"]
|
||||
[ext_resource type="PackedScene" uid="uid://di7aql54lksn7" path="res://src/scenery/trees/palm_tree/palm_tree.tscn" id="12_sswxf"]
|
||||
[ext_resource type="PackedScene" uid="uid://dagh38vap4t1d" path="res://src/props/scenery/city/concrete_building_1.tscn" id="10_lf15j"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjubxs7peir5k" path="res://src/props/scenery/city/kana_signboard.tscn" id="11_evxup"]
|
||||
[ext_resource type="PackedScene" uid="uid://di7aql54lksn7" path="res://src/props/scenery/trees/palm_tree/palm_tree.tscn" id="12_sswxf"]
|
||||
[ext_resource type="PackedScene" uid="uid://c7l58wuuahn7w" path="res://src/props/flag/flag.tscn" id="13_6jtao"]
|
||||
[ext_resource type="Texture2D" uid="uid://dj60e8ri2fco" path="res://assets/models/scenery/city/concrete_building_1/concrete_building_1.png" id="14_y7s2h"]
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ bones/23/scale = Vector3(1, 1, 1)
|
|||
visible = false
|
||||
|
||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"]
|
||||
transform = Transform3D(-0.944824, 0.316851, -0.0831417, -0.326595, -0.930784, 0.164246, -0.0253454, 0.182337, 0.982909, -0.1687, 3.13128, 0.867055)
|
||||
transform = Transform3D(-0.944824, 0.316851, -0.0831417, -0.325647, -0.936013, 0.133541, -0.0355091, 0.153247, 0.98755, -0.1687, 3.15793, 0.845315)
|
||||
bone_name = "Hand.R"
|
||||
bone_idx = 11
|
||||
|
||||
|
|
|
@ -35,7 +35,10 @@ const CAMERA_SNAP_TIME := 0.3
|
|||
@export var base_curve := 0.0
|
||||
|
||||
@export_category("Debug")
|
||||
## When enabled, the game will pause and enter free cam mode when the ball has a collision.
|
||||
@export var debug_ball_impact := false
|
||||
## When enabled, ignore curve meter and hit a perfect shot every time.
|
||||
@export var perfect_aim := false
|
||||
|
||||
var base_speed: float = ProjectSettings.get_setting("game/config/controls/camera/free_camera_speed")
|
||||
|
||||
|
@ -103,9 +106,12 @@ var _tracking_camera: OrbitalCamera
|
|||
|
||||
@onready var drive_ref: RayCast3D = %DriveRef
|
||||
@onready var drive_arrow: Node3D = %DriveArrow
|
||||
@onready var wedge_ref: RayCast3D = %WedgeRef
|
||||
@onready var wedge_arrow: Node3D = %WedgeArrow
|
||||
@onready var iron_ref: RayCast3D = %IronRef
|
||||
@onready var iron_arrow: Node3D = %IronArrow
|
||||
@onready var putt_ref: RayCast3D = %PuttRef
|
||||
@onready var putt_arrow: Node3D = %PuttArrow
|
||||
@onready var wedge_ref: RayCast3D = %WedgeRef
|
||||
|
||||
@onready var club_selector: ClubSelector = %ClubSelector
|
||||
|
||||
|
@ -170,26 +176,23 @@ func get_shot_impulse(meter_pct: float) -> Vector3:
|
|||
|
||||
|
||||
func take_shot() -> void:
|
||||
print("WHACK!")
|
||||
print("Power: ", power_bar.value)
|
||||
print("Curve: ", curve_bar.value)
|
||||
print_debug("WHACK!\nPower: ", power_bar.value, "\nCurve: ", curve_bar.value)
|
||||
|
||||
var impulse := get_shot_impulse(power_bar.value)
|
||||
print("Shot impulse: ", impulse, "; ", impulse.length(), " N*s")
|
||||
print_debug("Shot impulse: ", impulse, "; ", impulse.length(), " N*s")
|
||||
|
||||
ball_impulse_debug.transform = (
|
||||
Transform3D.IDENTITY.scaled(Vector3.ONE * impulse.length()).looking_at(impulse)
|
||||
)
|
||||
|
||||
physics_ball.freeze = false
|
||||
#physics_ball.apply_central_impulse(impulse)
|
||||
physics_ball.apply_impulse(impulse)
|
||||
physics_ball.apply_central_impulse(impulse)
|
||||
|
||||
|
||||
## Make the shot projection widget visible, with animated transition
|
||||
func _show_shot_projection() -> void:
|
||||
shot_projection.initial_speed = 1
|
||||
shot_projection.basis = shot_ref.basis
|
||||
shot_projection.basis = shot_ref.basis.orthonormalized()
|
||||
var shot_speed := get_shot_impulse(1.0).length() / physics_ball.mass
|
||||
var tween := get_tree().create_tween()
|
||||
tween.tween_property(shot_projection, "initial_speed", shot_speed, CAMERA_SNAP_TIME).set_trans(
|
||||
|
@ -263,13 +266,14 @@ func _on_club_change(new_club: Club.Type) -> void:
|
|||
# Hide all arrows
|
||||
# TODO animate?
|
||||
drive_arrow.hide()
|
||||
wedge_arrow.hide()
|
||||
iron_arrow.hide()
|
||||
putt_arrow.hide()
|
||||
club_selector.value = new_club
|
||||
match new_club:
|
||||
Club.Type.DRIVER:
|
||||
shot_ref = drive_ref
|
||||
drive_arrow.show()
|
||||
|
||||
# TODO get this from player loadout
|
||||
# TODO club change animation
|
||||
character.hold_right(Club.catalog.debug_driver.get_model())
|
||||
|
@ -280,12 +284,12 @@ func _on_club_change(new_club: Club.Type) -> void:
|
|||
Club.Type.WEDGE:
|
||||
# TODO
|
||||
shot_ref = wedge_ref
|
||||
drive_arrow.show()
|
||||
wedge_arrow.show()
|
||||
character.hold_right(Club.catalog.debug_wedge.get_model())
|
||||
Club.Type.IRON:
|
||||
# TODO
|
||||
shot_ref = drive_ref
|
||||
drive_arrow.show()
|
||||
shot_ref = iron_ref
|
||||
iron_arrow.show()
|
||||
character.hold_right(Club.catalog.debug_iron.get_model())
|
||||
Club.Type.SPECIAL:
|
||||
# TODO
|
||||
|
@ -448,9 +452,10 @@ func _on_physics_ball_body_entered(_body: Node) -> void:
|
|||
print_debug("BONK!")
|
||||
if debug_ball_impact:
|
||||
get_tree().paused = true
|
||||
_free_camera = FreeCamera.create(
|
||||
(_tracking_camera if _tracking_camera else camera) as Node3D
|
||||
)
|
||||
var snap_point: Node3D = camera
|
||||
if _tracking_camera:
|
||||
snap_point = _tracking_camera
|
||||
_free_camera = FreeCamera.create(snap_point)
|
||||
add_sibling(_free_camera)
|
||||
control_disabled = true
|
||||
camera.current = false
|
||||
|
|
|
@ -673,7 +673,16 @@ debug_shape_thickness = 4
|
|||
|
||||
[node name="WedgeRef" type="RayCast3D" parent="Direction"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.35, -0.606218, 0, 0.606218, 0.35, 0, 0.08, 0)
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.181173, -0.676148, 0, 0.676148, 0.181173, 0, 0.08, 0)
|
||||
enabled = false
|
||||
target_position = Vector3(0, 0, -1)
|
||||
collision_mask = 0
|
||||
collide_with_bodies = false
|
||||
debug_shape_thickness = 4
|
||||
|
||||
[node name="IronRef" type="RayCast3D" parent="Direction"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.494975, -0.494975, 0, 0.494975, 0.494975, 0, 0.08, 0)
|
||||
enabled = false
|
||||
target_position = Vector3(0, 0, -1)
|
||||
collision_mask = 0
|
||||
|
@ -682,7 +691,7 @@ debug_shape_thickness = 4
|
|||
|
||||
[node name="PuttRef" type="RayCast3D" parent="Direction"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.08, 0)
|
||||
transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0.08, 0)
|
||||
enabled = false
|
||||
target_position = Vector3(0, 0, -1)
|
||||
collision_mask = 0
|
||||
|
@ -723,20 +732,38 @@ autoplay = "show"
|
|||
|
||||
[node name="DriveArrow" type="Node3D" parent="ArrowPivot/Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="ArrowPivot/Arrow/DriveArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.4, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
transform = Transform3D(0.2, 0, 0, 0, -1.74846e-08, 0.2, 0, -0.4, -8.74228e-09, 0, 0, -1)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="WedgeArrow" type="Node3D" parent="ArrowPivot/Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.181173, -0.676148, 0, 0.676148, 0.181173, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="ArrowPivot/Arrow/WedgeArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, -1.74846e-08, 0.2, 0, -0.4, -8.74228e-09, 0, 0, -1)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="IronArrow" type="Node3D" parent="ArrowPivot/Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.7, 0, 0, 0, 0.494975, -0.494975, 0, 0.494975, 0.494975, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="ArrowPivot/Arrow/IronArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, -1.74846e-08, 0.2, 0, -0.4, -8.74228e-09, 0, 0, -1)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="PuttArrow" type="Node3D" parent="ArrowPivot/Arrow"]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
|
||||
transform = Transform3D(0.8, 0, 0, 0, 0.8, 0, 0, 0, 0.8, 0, 0, 0)
|
||||
visible = false
|
||||
|
||||
[node name="ArrowMesh" parent="ArrowPivot/Arrow/PuttArrow" instance=ExtResource("2_s70wl")]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.4, 0, 0, 0, 0.2, 0, 1, 0)
|
||||
transform = Transform3D(0.2, 0, 0, 0, -1.74846e-08, 0.2, 0, -0.4, -8.74228e-09, 0, 0, -1)
|
||||
loop_animation = 1
|
||||
|
||||
[node name="ShotProjection" parent="ArrowPivot" node_paths=PackedStringArray("excluded_bodies") instance=ExtResource("4_ry2ho")]
|
||||
|
|
Loading…
Reference in New Issue