generated from krampus/template-godot4
Compare commits
No commits in common. "b633ceb0c4adef28065017ba21f1187f1746204a" and "0fc25d753f5193c69300e30271678608c80fcfbd" have entirely different histories.
b633ceb0c4
...
0fc25d753f
|
@ -187,22 +187,22 @@ select_putter={
|
||||||
}
|
}
|
||||||
club_next={
|
club_next={
|
||||||
"deadzone": 0.5,
|
"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":4194306,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(105, 13),"global_position":Vector2(114, 59),"factor":1.0,"button_index":8,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
club_previous={
|
club_previous={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194306,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(277, 2),"global_position":Vector2(286, 48),"factor":1.0,"button_index":9,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ball_next={
|
ball_next={
|
||||||
"deadzone": 0.5,
|
"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":71,"key_label":0,"unicode":103,"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":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ball_previous={
|
ball_previous={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":71,"key_label":0,"unicode":71,"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":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194306,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
pause={
|
pause={
|
||||||
|
|
|
@ -53,10 +53,6 @@ const NICE_THRESHOLD := 0.2
|
||||||
## Force by which explosions knock the ball away
|
## Force by which explosions knock the ball away
|
||||||
const EXPLOSIVE_FORCE_FACTOR := 0.12
|
const EXPLOSIVE_FORCE_FACTOR := 0.12
|
||||||
|
|
||||||
const CLUB_SELECT_ORDER: Array[Club.Type] = [
|
|
||||||
Club.Type.DRIVER, Club.Type.IRON, Club.Type.WEDGE, Club.Type.SPECIAL, Club.Type.PUTTER
|
|
||||||
]
|
|
||||||
|
|
||||||
## 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
|
||||||
|
|
||||||
|
@ -538,21 +534,7 @@ func _on_game_ball_changed(ball: GameBall) -> void:
|
||||||
player_offset.position.z = z_offset
|
player_offset.position.z = z_offset
|
||||||
|
|
||||||
|
|
||||||
func _get_relative_club(delta: int, from: int = -1) -> Club.Type:
|
func _process(delta: float) -> void:
|
||||||
from = from if from != -1 else club_type
|
|
||||||
var old_idx := CLUB_SELECT_ORDER.find(from)
|
|
||||||
var new_idx := wrapi(old_idx + delta, 0, len(CLUB_SELECT_ORDER))
|
|
||||||
var new_club := CLUB_SELECT_ORDER[new_idx]
|
|
||||||
|
|
||||||
# UX behavior: if there is not club in the next slot, get the NEXT next slot, etc etc
|
|
||||||
# NOTE: this will enter a loop if the player has no clubs!
|
|
||||||
if not player.get_club(new_club):
|
|
||||||
return _get_relative_club(delta, new_club)
|
|
||||||
|
|
||||||
return new_club
|
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
|
||||||
# REMOVEME
|
# REMOVEME
|
||||||
if Input.is_action_just_pressed("ui_menu"):
|
if Input.is_action_just_pressed("ui_menu"):
|
||||||
print("Debugging...")
|
print("Debugging...")
|
||||||
|
@ -562,24 +544,24 @@ func _process(_delta: float) -> void:
|
||||||
## Visual updates
|
## Visual updates
|
||||||
# Rotation
|
# Rotation
|
||||||
direction.rotation.y = lerp_angle(
|
direction.rotation.y = lerp_angle(
|
||||||
direction.rotation.y, _target_rotation.y, Game.settings.x_acceleration / 60.0
|
direction.rotation.y, _target_rotation.y, delta * Game.settings.x_acceleration
|
||||||
)
|
)
|
||||||
pitch.rotation.x = lerp_angle(
|
pitch.rotation.x = lerp_angle(
|
||||||
pitch.rotation.x, _target_rotation.x, Game.settings.y_acceleration / 60.0
|
pitch.rotation.x, _target_rotation.x, delta * Game.settings.y_acceleration
|
||||||
)
|
)
|
||||||
|
|
||||||
# Arrow lags behind camera control
|
# Arrow lags behind camera control
|
||||||
arrow_pivot.rotation.y = lerp_angle(
|
arrow_pivot.rotation.y = lerp_angle(
|
||||||
arrow_pivot.rotation.y, _target_rotation.y, ARROW_ACCELERATION / 60.0
|
arrow_pivot.rotation.y, _target_rotation.y, delta * ARROW_ACCELERATION
|
||||||
)
|
)
|
||||||
# Player lags further behind
|
# Player lags further behind
|
||||||
player_pivot.rotation.y = lerp_angle(
|
player_pivot.rotation.y = lerp_angle(
|
||||||
player_pivot.rotation.y, _target_rotation.y, PLAYER_ACCELERATION / 60.0
|
player_pivot.rotation.y, _target_rotation.y, delta * PLAYER_ACCELERATION
|
||||||
)
|
)
|
||||||
|
|
||||||
## Input Handling
|
## Input Handling
|
||||||
if control_disabled:
|
if control_disabled:
|
||||||
if Input.is_action_just_pressed("camera_cancel", true):
|
if Input.is_action_just_pressed("camera_cancel"):
|
||||||
if is_instance_valid(_free_camera) and not _returning_free_camera:
|
if is_instance_valid(_free_camera) and not _returning_free_camera:
|
||||||
_returning_free_camera = true
|
_returning_free_camera = true
|
||||||
var tween := get_tree().create_tween()
|
var tween := get_tree().create_tween()
|
||||||
|
@ -599,76 +581,72 @@ func _process(_delta: float) -> void:
|
||||||
match phase:
|
match phase:
|
||||||
Phase.AIM:
|
Phase.AIM:
|
||||||
# Camera zoom
|
# Camera zoom
|
||||||
if Input.is_action_just_pressed("shot_zoom_in", true):
|
if Input.is_action_just_pressed("shot_zoom_in"):
|
||||||
camera_distance = max(camera_distance - 1.0, ZOOM_MIN)
|
camera_distance = max(camera_distance - 1.0, ZOOM_MIN)
|
||||||
if Input.is_action_just_pressed("shot_zoom_out", true):
|
if Input.is_action_just_pressed("shot_zoom_out"):
|
||||||
camera_distance = min(camera_distance + 1.0, ZOOM_MAX)
|
camera_distance = min(camera_distance + 1.0, ZOOM_MAX)
|
||||||
|
|
||||||
# Club select
|
# Club select
|
||||||
if Input.is_action_just_pressed("club_next", true):
|
if Input.is_action_just_pressed("select_driver"):
|
||||||
club_type = _get_relative_club(1)
|
|
||||||
if Input.is_action_just_pressed("club_previous", true):
|
|
||||||
club_type = _get_relative_club(-1)
|
|
||||||
if Input.is_action_just_pressed("select_driver", true):
|
|
||||||
club_type = Club.Type.DRIVER
|
club_type = Club.Type.DRIVER
|
||||||
if Input.is_action_just_pressed("select_iron", true):
|
if Input.is_action_just_pressed("select_iron"):
|
||||||
club_type = Club.Type.IRON
|
club_type = Club.Type.IRON
|
||||||
if Input.is_action_just_pressed("select_wedge", true):
|
if Input.is_action_just_pressed("select_wedge"):
|
||||||
club_type = Club.Type.WEDGE
|
club_type = Club.Type.WEDGE
|
||||||
if Input.is_action_just_pressed("select_special", true):
|
if Input.is_action_just_pressed("select_special"):
|
||||||
club_type = Club.Type.SPECIAL
|
club_type = Club.Type.SPECIAL
|
||||||
if Input.is_action_just_pressed("select_putter", true):
|
if Input.is_action_just_pressed("select_putter"):
|
||||||
club_type = Club.Type.PUTTER
|
club_type = Club.Type.PUTTER
|
||||||
|
|
||||||
# Ball select
|
# Ball select
|
||||||
if Input.is_action_just_pressed("ball_next", true):
|
if Input.is_action_just_pressed("ball_next"):
|
||||||
ball_type = player.next_ball(ball_type)
|
ball_type = player.next_ball(ball_type)
|
||||||
if Input.is_action_just_pressed("ball_previous", true):
|
if Input.is_action_just_pressed("ball_previous"):
|
||||||
ball_type = player.prev_ball(ball_type)
|
ball_type = player.prev_ball(ball_type)
|
||||||
|
|
||||||
# Switch to free cam
|
# Switch to free cam
|
||||||
if (
|
if (
|
||||||
Input.is_action_just_pressed("camera_back", true)
|
Input.is_action_just_pressed("camera_back")
|
||||||
or Input.is_action_just_pressed("camera_forward", true)
|
or Input.is_action_just_pressed("camera_forward")
|
||||||
or Input.is_action_just_pressed("camera_left", true)
|
or Input.is_action_just_pressed("camera_left")
|
||||||
or Input.is_action_just_pressed("camera_right", true)
|
or Input.is_action_just_pressed("camera_right")
|
||||||
):
|
):
|
||||||
insert_free_cam()
|
insert_free_cam()
|
||||||
|
|
||||||
# Advance to next phase
|
# Advance to next phase
|
||||||
if Input.is_action_just_pressed("shot_accept", true):
|
if Input.is_action_just_pressed("shot_accept"):
|
||||||
if player.get_balls(ball_type) != 0:
|
if player.get_balls(ball_type) != 0:
|
||||||
# Check that player has enough of the selected ball (<0 means unlimited)
|
# Check that player has enough of the selected ball (<0 means unlimited)
|
||||||
phase = Phase.POWER_ADJUST
|
phase = Phase.POWER_ADJUST
|
||||||
# TODO play UI bonk if player doesn't have balls (lmao)
|
# TODO play UI bonk if player doesn't have balls (lmao)
|
||||||
Phase.POWER_ADJUST:
|
Phase.POWER_ADJUST:
|
||||||
if Input.is_action_just_pressed("shot_accept", true):
|
if Input.is_action_just_pressed("shot_accept"):
|
||||||
# TODO set power gauge parameters if needed
|
# TODO set power gauge parameters if needed
|
||||||
character.start_upswing()
|
character.start_upswing()
|
||||||
hud.start_power_bar()
|
hud.start_power_bar()
|
||||||
if Input.is_action_just_pressed("shot_cancel", true):
|
if Input.is_action_just_pressed("shot_cancel"):
|
||||||
hud.reset_power_bar()
|
hud.reset_power_bar()
|
||||||
phase = Phase.AIM
|
phase = Phase.AIM
|
||||||
if Input.is_action_just_released("shot_accept", true) and shot_power > 0:
|
if Input.is_action_just_released("shot_accept") and shot_power > 0:
|
||||||
hud.stop_power_bar()
|
hud.stop_power_bar()
|
||||||
phase = Phase.CURVE_ADJUST
|
phase = Phase.CURVE_ADJUST
|
||||||
Phase.CURVE_ADJUST:
|
Phase.CURVE_ADJUST:
|
||||||
if Input.is_action_just_pressed("shot_cancel", true):
|
if Input.is_action_just_pressed("shot_cancel"):
|
||||||
hud.reset_curve_bar()
|
hud.reset_curve_bar()
|
||||||
phase = Phase.POWER_ADJUST
|
phase = Phase.POWER_ADJUST
|
||||||
if Input.is_action_just_pressed("shot_accept", true):
|
if Input.is_action_just_pressed("shot_accept"):
|
||||||
hud.stop_curve_bar()
|
hud.stop_curve_bar()
|
||||||
phase = Phase.DOWNSWING
|
phase = Phase.DOWNSWING
|
||||||
Phase.SHOT:
|
Phase.SHOT:
|
||||||
if reset_enabled and Input.is_action_just_pressed("shot_reset", true):
|
if reset_enabled and Input.is_action_just_pressed("shot_reset"):
|
||||||
phase = Phase.SHOT_RESET
|
phase = Phase.SHOT_RESET
|
||||||
reset_enabled = false
|
reset_enabled = false
|
||||||
return_ball()
|
return_ball()
|
||||||
|
|
||||||
if Input.is_action_just_pressed("activate_ball", true):
|
if Input.is_action_just_pressed("activate_ball"):
|
||||||
game_ball.activate_ability()
|
game_ball.activate_ability()
|
||||||
|
|
||||||
if driving_range and Input.is_action_just_pressed("shot_accept", true):
|
if driving_range and Input.is_action_just_pressed("shot_accept"):
|
||||||
phase = Phase.AIM
|
phase = Phase.AIM
|
||||||
return_ball()
|
return_ball()
|
||||||
Phase.FINISHED:
|
Phase.FINISHED:
|
||||||
|
|
|
@ -31,10 +31,10 @@ func camera_motion(motion: Vector2) -> void:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
# Rotation
|
# Rotation
|
||||||
rotation.y = lerp_angle(rotation.y, _target.y, Game.settings.x_acceleration / 60.0)
|
rotation.y = lerp_angle(rotation.y, _target.y, delta * Game.settings.x_acceleration)
|
||||||
rotation.x = lerp_angle(rotation.x, _target.x, Game.settings.y_acceleration / 60.0)
|
rotation.x = lerp_angle(rotation.x, _target.x, delta * Game.settings.y_acceleration)
|
||||||
|
|
||||||
# Handle spatial movement
|
# Handle spatial movement
|
||||||
var xz_input := Input.get_vector("camera_left", "camera_right", "camera_forward", "camera_back")
|
var xz_input := Input.get_vector("camera_left", "camera_right", "camera_forward", "camera_back")
|
||||||
|
@ -42,7 +42,7 @@ func _physics_process(_delta: float) -> void:
|
||||||
var direction := (transform.basis * Vector3(xz_input.x, y_input.y, xz_input.y)).normalized()
|
var direction := (transform.basis * Vector3(xz_input.x, y_input.y, xz_input.y)).normalized()
|
||||||
|
|
||||||
var speed := Game.settings.free_camera_speed
|
var speed := Game.settings.free_camera_speed
|
||||||
if Input.is_action_pressed("camera_sprint", true):
|
if Input.is_action_pressed("camera_sprint"):
|
||||||
speed *= SPRINT_MULT
|
speed *= SPRINT_MULT
|
||||||
|
|
||||||
if direction:
|
if direction:
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="PressStart" type="Label" parent="Menu"]
|
[node name="PressStart" type="Label" parent="Menu"]
|
||||||
modulate = Color(1, 1, 1, 0.899996)
|
modulate = Color(1, 1, 1, 0.98649)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
|
Loading…
Reference in New Issue