added speed and jump modifiers based on weapon weight
This commit is contained in:
@@ -148,6 +148,9 @@ initial_state = NodePath("On Foot")
|
|||||||
|
|
||||||
[node name="On Foot" type="Node" parent="StateMachine"]
|
[node name="On Foot" type="Node" parent="StateMachine"]
|
||||||
script = ExtResource("3_ib4e7")
|
script = ExtResource("3_ib4e7")
|
||||||
|
move_speed = null
|
||||||
|
move_transition_speed = null
|
||||||
|
can_climb_new_ladder = null
|
||||||
metadata/_custom_type_script = "uid://dk0vg5btak80a"
|
metadata/_custom_type_script = "uid://dk0vg5btak80a"
|
||||||
|
|
||||||
[node name="Crouched" type="Node" parent="StateMachine"]
|
[node name="Crouched" type="Node" parent="StateMachine"]
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ reload_type = 0
|
|||||||
bullet = ExtResource("2_mnla0")
|
bullet = ExtResource("2_mnla0")
|
||||||
fire_mode = 1
|
fire_mode = 1
|
||||||
fov_zoom_amt = 0.98
|
fov_zoom_amt = 0.98
|
||||||
|
player_speed_modifier = 0.75
|
||||||
crosshair_radius = 100
|
crosshair_radius = 100
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ reload_type = 0
|
|||||||
bullet = ExtResource("1_y4ehq")
|
bullet = ExtResource("1_y4ehq")
|
||||||
fire_mode = 0
|
fire_mode = 0
|
||||||
fov_zoom_amt = 0.98
|
fov_zoom_amt = 0.98
|
||||||
|
player_speed_modifier = 0.95
|
||||||
crosshair_radius = 50
|
crosshair_radius = 50
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
recoil_amount = Vector3(0.05, 0.05, 0.05)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ weapon_type = 1
|
|||||||
reload_type = 0
|
reload_type = 0
|
||||||
fire_mode = 1
|
fire_mode = 1
|
||||||
fov_zoom_amt = 0.98
|
fov_zoom_amt = 0.98
|
||||||
|
player_speed_modifier = 0.95
|
||||||
crosshair_radius = 100
|
crosshair_radius = 100
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0, 0.05, 0.05)
|
recoil_amount = Vector3(0, 0.05, 0.05)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ reload_type = 0
|
|||||||
bullet = ExtResource("1_oqs71")
|
bullet = ExtResource("1_oqs71")
|
||||||
fire_mode = 2
|
fire_mode = 2
|
||||||
fov_zoom_amt = 0.98
|
fov_zoom_amt = 0.98
|
||||||
|
player_speed_modifier = 0.95
|
||||||
crosshair_radius = 25
|
crosshair_radius = 25
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0.015, 0.05, 0.05)
|
recoil_amount = Vector3(0.015, 0.05, 0.05)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ reload_type = 1
|
|||||||
bullet = ExtResource("1_gphlx")
|
bullet = ExtResource("1_gphlx")
|
||||||
fire_mode = 1
|
fire_mode = 1
|
||||||
fov_zoom_amt = 0.85
|
fov_zoom_amt = 0.85
|
||||||
|
player_speed_modifier = 0.95
|
||||||
crosshair_radius = 25
|
crosshair_radius = 25
|
||||||
ads = false
|
ads = false
|
||||||
recoil_amount = Vector3(0.2, 0.05, 0.05)
|
recoil_amount = Vector3(0.2, 0.05, 0.05)
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ var move_target
|
|||||||
var look_target
|
var look_target
|
||||||
|
|
||||||
func standard_movement(delta):
|
func standard_movement(delta):
|
||||||
character.velocity.x = lerp(character.velocity.x, character.movement_input().x * move_speed,delta * move_transition_speed)
|
character.velocity.x = lerp(character.velocity.x, character.movement_input().x * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||||
character.velocity.z = lerp(character.velocity.z, character.movement_input().z * move_speed,delta * move_transition_speed)
|
character.velocity.z = lerp(character.velocity.z, character.movement_input().z * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||||
|
|
||||||
|
func standard_jump():
|
||||||
|
return character.JUMP_VELOCITY * character.speed_modifiers()
|
||||||
|
|
||||||
func apply_gravity(delta):
|
func apply_gravity(delta):
|
||||||
character.velocity.y -= 9.8 * 1.25 * delta
|
character.velocity.y -= 9.8 * 1.25 * delta
|
||||||
|
|||||||
@@ -376,6 +376,15 @@ func movement_input():
|
|||||||
|
|
||||||
return direction
|
return direction
|
||||||
|
|
||||||
|
#for every modifier that changes movement, subtract from the speed multiplier
|
||||||
|
func speed_modifiers():
|
||||||
|
var speed_multiplier = 1
|
||||||
|
|
||||||
|
if gun != null:
|
||||||
|
speed_multiplier -= (1 - gun.weapon_info.player_speed_modifier)
|
||||||
|
|
||||||
|
return speed_multiplier
|
||||||
|
|
||||||
func joypad_walk():
|
func joypad_walk():
|
||||||
# Joypad right stick look control
|
# Joypad right stick look control
|
||||||
var dir_out = Vector2(0,0)
|
var dir_out = Vector2(0,0)
|
||||||
|
|||||||
@@ -29,7 +29,5 @@ 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 can_wall_run():
|
if can_wall_run():
|
||||||
start_wall_running()
|
start_wall_running()
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ func Physics_Update(delta):
|
|||||||
|
|
||||||
if Input.is_action_just_pressed("jump"):
|
if Input.is_action_just_pressed("jump"):
|
||||||
character.jumps_remaining -= 1
|
character.jumps_remaining -= 1
|
||||||
character.velocity.y += character.JUMP_VELOCITY
|
character.velocity.y += standard_jump()
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ func wall_jump():
|
|||||||
|
|
||||||
func wall_run_movement(delta):
|
func wall_run_movement(delta):
|
||||||
if Input.is_action_pressed("move_up"):
|
if Input.is_action_pressed("move_up"):
|
||||||
character.velocity.x = lerp(character.velocity.x,character.wall_run_direction.x * move_speed,delta * move_transition_speed)
|
character.velocity.x = lerp(character.velocity.x,character.wall_run_direction.x * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||||
character.velocity.z = lerp(character.velocity.z,character.wall_run_direction.z * move_speed,delta * move_transition_speed)
|
character.velocity.z = lerp(character.velocity.z,character.wall_run_direction.z * move_speed * character.speed_modifiers(),delta * move_transition_speed)
|
||||||
else:
|
else:
|
||||||
Transitioned.emit(self,"in air")
|
Transitioned.emit(self,"in air")
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class_name weapon_resource
|
|||||||
@export var bullet : bullet_resource
|
@export var bullet : bullet_resource
|
||||||
@export_enum("Auto", "Single", "Burst") var fire_mode: int
|
@export_enum("Auto", "Single", "Burst") var fire_mode: int
|
||||||
@export var fov_zoom_amt = .98
|
@export var fov_zoom_amt = .98
|
||||||
|
@export var player_speed_modifier = .95
|
||||||
@export var crosshair_radius = 50
|
@export var crosshair_radius = 50
|
||||||
@export var ads : bool = false
|
@export var ads : bool = false
|
||||||
@export var recoil_amount : Vector3 = Vector3(.05,.05,.05)
|
@export var recoil_amount : Vector3 = Vector3(.05,.05,.05)
|
||||||
|
|||||||
Reference in New Issue
Block a user