Fall and attack state improvements. Speed modifier now in move_as_desired function.

This commit is contained in:
Nitsud Yarg 2024-06-19 23:20:27 -07:00
parent 0686e8e8b0
commit cb851e694a
5 changed files with 43 additions and 1 deletions

View File

@ -203,3 +203,28 @@ permissions/write_sms=false
permissions/write_social_stream=false permissions/write_social_stream=false
permissions/write_sync_settings=false permissions/write_sync_settings=false
permissions/write_user_dictionary=false permissions/write_user_dictionary=false
[preset.1]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/linux/.x86_64"
script_export_mode=1
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
binary_format/64_bits=true
binary_format/embed_pck=false
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true

View File

@ -45,7 +45,7 @@ func enter() -> void:
previous_state_frame_number, " ", previous_state_name) previous_state_frame_number, " ", previous_state_name)
match previous_animation_name: match previous_animation_name:
"idle": "idle":
animations.play("_shoot") animations.play("idle_shoot")
"run": "run":
animations.play("run_shoot") animations.play("run_shoot")
animations.frame = previous_state_frame_number animations.frame = previous_state_frame_number

View File

@ -7,6 +7,10 @@ onready var idle_state: State = get_node(idle_node)
onready var landing_mod: StateModifier = get_node(landing_node) onready var landing_mod: StateModifier = get_node(landing_node)
func enter() -> void: func enter() -> void:
var landing_mod_index = modifier_stack_ref.rfind(landing_mod)
if landing_mod_index != -1:
#print("You're Supposed to be dead!?: ", landing_mod_index)
modifier_stack_ref.remove(landing_mod_index)
.enter() .enter()
# Jump to fall frame # Jump to fall frame
animations.frame = 5 animations.frame = 5

View File

@ -23,6 +23,8 @@ func enter() -> void:
.enter() .enter()
if previous_speed_multiplier > 1.0: if previous_speed_multiplier > 1.0:
speed_multiplier = previous_speed_multiplier speed_multiplier = previous_speed_multiplier
else:
speed_multiplier = 1.0
# Apply initial jump velocity on state enter # Apply initial jump velocity on state enter
move_component.velocity.y = -jump_force move_component.velocity.y = -jump_force

View File

@ -190,6 +190,17 @@ func process_physics(_delta: float) -> State:
func move_actor_as_desired(delta: float): func move_actor_as_desired(delta: float):
var new_speed = move_speed * speed_multiplier var new_speed = move_speed * speed_multiplier
if speed_multiplier > 1.0:
speed_multiplier -= delta * speed_multiplier
#speed_decay_rate += delta * speed_decay_rate
elif speed_multiplier < 1.0:
speed_multiplier += delta * speed_multiplier
#speed_decay_rate += delta * speed_decay_rate
# Deadzone
if speed_multiplier < 1.1 and speed_multiplier > 0.9:
speed_multiplier = 1.0
# if (new_speed > move_speed): # if (new_speed > move_speed):
# print("Go Faster Booooy! ", move_speed) # print("Go Faster Booooy! ", move_speed)
move_component.velocity.y += gravity * delta move_component.velocity.y += gravity * delta