tweaked and maybe broke ledge grab
This commit is contained in:
@@ -12,7 +12,7 @@ config_version=5
|
|||||||
|
|
||||||
config/name="First Person Test"
|
config/name="First Person Test"
|
||||||
config/tags=PackedStringArray("fps")
|
config/tags=PackedStringArray("fps")
|
||||||
run/main_scene="uid://b55ukxds1s7ih"
|
run/main_scene="uid://dsw00ml8rv6xo"
|
||||||
config/features=PackedStringArray("4.4", "Forward Plus")
|
config/features=PackedStringArray("4.4", "Forward Plus")
|
||||||
config/icon="uid://6svuq1l83al5"
|
config/icon="uid://6svuq1l83al5"
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ func standard_jump():
|
|||||||
if character.jumps_remaining > 0:
|
if character.jumps_remaining > 0:
|
||||||
character.jumps_remaining -= 1
|
character.jumps_remaining -= 1
|
||||||
jump_with_weight_mod()
|
jump_with_weight_mod()
|
||||||
|
elif is_grabbing_ledge():
|
||||||
|
jump_with_weight_mod()
|
||||||
|
|
||||||
func apply_gravity(delta):
|
func apply_gravity(delta):
|
||||||
character.velocity.y -= 9.8 * 1.25 * delta
|
character.velocity.y -= 9.8 * 1.25 * delta
|
||||||
|
|||||||
@@ -3,39 +3,16 @@ class_name PlayerClamber
|
|||||||
|
|
||||||
var clamber_point
|
var clamber_point
|
||||||
|
|
||||||
const CLAMBER_Y_OFFSET = .4
|
|
||||||
|
|
||||||
func Enter():
|
|
||||||
clamber_point = character.get_clamber_point()
|
|
||||||
character.velocity = Vector3.ZERO
|
|
||||||
|
|
||||||
func Physics_Update(delta):
|
func Physics_Update(delta):
|
||||||
character.global_position.y = lerp(character.global_position.y,clamber_point.y - CLAMBER_Y_OFFSET,delta * 2)
|
apply_gravity(delta)
|
||||||
|
|
||||||
if !is_still_on_ledge():
|
|
||||||
Transitioned.emit(self,"in air")
|
|
||||||
|
|
||||||
if Input.is_action_just_pressed("jump"):
|
if Input.is_action_just_pressed("jump"):
|
||||||
jump_with_weight_mod()
|
jump_with_weight_mod()
|
||||||
Transitioned.emit(self,"in air")
|
Transitioned.emit(self,"in air")
|
||||||
|
|
||||||
if Input.is_action_just_pressed("crouch"):
|
|
||||||
Transitioned.emit(self,"in air")
|
|
||||||
|
|
||||||
ledge_movement(delta)
|
|
||||||
|
|
||||||
func is_still_on_ledge():
|
|
||||||
if character.clamber_point_ray.is_colliding():
|
|
||||||
return true
|
|
||||||
else:
|
|
||||||
return false
|
|
||||||
|
|
||||||
func ledge_movement(delta):
|
func ledge_movement(delta):
|
||||||
var direction = character.movement_input()
|
var direction = character.movement_input()
|
||||||
character.velocity.x = lerp(character.velocity.x,direction.x * move_speed,delta * move_transition_speed)
|
character.velocity.x = lerp(character.velocity.x,direction.x * move_speed,delta * move_transition_speed)
|
||||||
#if direction.x < 0:
|
|
||||||
#if character.ledge_l_ray.is_colliding():
|
func Exit():
|
||||||
#character.velocity.x += direction.x * delta * move_speed
|
character.ledge_collision.disabled = true
|
||||||
#if direction.x > 0:
|
|
||||||
#if character.ledge_r_ray.is_colliding():
|
|
||||||
#character.velocity.x += direction.x * delta * move_speed
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ func Physics_Update(delta):
|
|||||||
standard_movement(delta)
|
standard_movement(delta)
|
||||||
apply_gravity(delta)
|
apply_gravity(delta)
|
||||||
|
|
||||||
if character.is_on_floor() and !is_grabbing_ledge():
|
if character.is_on_floor():
|
||||||
Transitioned.emit(self,"on foot")
|
Transitioned.emit(self,"on foot")
|
||||||
|
|
||||||
if Input.is_action_just_pressed("sprint") and air_dash_left > 0:
|
if Input.is_action_just_pressed("sprint") and air_dash_left > 0:
|
||||||
@@ -23,13 +23,18 @@ func Physics_Update(delta):
|
|||||||
if Input.is_action_just_pressed("crouch"):
|
if Input.is_action_just_pressed("crouch"):
|
||||||
Transitioned.emit(self,"ground pound")
|
Transitioned.emit(self,"ground pound")
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("interact"):
|
||||||
|
character.ledge_collision.disabled = false
|
||||||
|
Transitioned.emit(self,"ledge grab")
|
||||||
|
|
||||||
enable_wall_rays()
|
enable_wall_rays()
|
||||||
|
|
||||||
if can_wall_run():
|
if can_wall_run():
|
||||||
start_wall_running()
|
start_wall_running()
|
||||||
|
|
||||||
standard_jump()
|
standard_jump()
|
||||||
ledge_grab()
|
|
||||||
|
|
||||||
|
|
||||||
func Exit():
|
func Exit():
|
||||||
character.ledge_collision.disabled = true
|
character.ledge_collision.disabled = true
|
||||||
|
|||||||
Reference in New Issue
Block a user