Movement modifier has grounded processing directives.
This commit is contained in:
parent
7d7f3dfcd6
commit
b45272934f
|
|
@ -199,8 +199,11 @@ func new_move_actor_as_desired(_delta :float,
|
|||
impulse_applied_dir = sign(move_direction.x)
|
||||
|
||||
|
||||
var modifier_indicator := ''
|
||||
var movement_parameters :MovementParameters = _state.get_movement_parameters()
|
||||
if modifier and modifier.is_active:
|
||||
if !(_state.is_grounded and modifier.only_grounded): # Should we skip
|
||||
modifier_indicator = '*'
|
||||
movement_parameters.apply_state_modifier(modifier, move_direction.x)
|
||||
|
||||
## Inertia only applies if there is a difference between the
|
||||
|
|
@ -331,7 +334,7 @@ func new_move_actor_as_desired(_delta :float,
|
|||
#calc_inertial_dir = Vector2(sign(calc_velocity.x),sign(calc_velocity.y))
|
||||
|
||||
UiManager.debug_text = ( #"H_Speed x Dir: " + str(h_speed) + str('duh') +
|
||||
"H_Speed Fm:{0} To:{1}".format({"0":"%5.2f" % h_speed.x, "1":"%5.2f" % h_speed.y}) +
|
||||
modifier_indicator + "H_Speed Fm:{0} To:{1}".format({"0":"%5.2f" % h_speed.x, "1":"%5.2f" % h_speed.y}) +
|
||||
"\nVelocity_Calc: {0}, {1}".format({"0":"%5.2f" % calc_velocity.x, "1":"%5.2f" % calc_velocity.y}) +
|
||||
"\nInertia_Calc: {0}, {1}".format({"0":"%5.2f" % calc_inertia.x, "1":"%5.2f" % calc_inertia.y}) +
|
||||
"\nVelocity_Real: {0}, {1}".format({"0":"%5.2f" % velocity.x, "1":"%5.2f" % velocity.y}) +
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ export var vertical_speed_offset_acceleration: float = 0
|
|||
## Should this state keep the inertia from previous states
|
||||
export var preserve_inertia :bool = true
|
||||
|
||||
## Whether this state should be considered a grounded state
|
||||
export var is_grounded :bool = true
|
||||
|
||||
## Default state gravity is the project's gravity
|
||||
var gravity: int = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ var gravity: int = 0
|
|||
|
||||
## Processing Directives (help determine how the merge function works)
|
||||
var direction :float = 0.0 # -1, 0, 1
|
||||
var only_grounded :float = false
|
||||
|
||||
enum SUB_TYPE {
|
||||
NONE, # Basic physics modifier just adds numbers
|
||||
|
|
|
|||
|
|
@ -306,6 +306,7 @@ func _state_process_physics_jump():
|
|||
if velocity.y > 0:
|
||||
request_state_change.call_func('fall')
|
||||
move_actor_as_desired()
|
||||
#apply_movement_to_parent(new_move_actor_as_desired( physics_delta , current_state ))
|
||||
|
||||
func _state_process_physics_move():
|
||||
# flip sprite in direction
|
||||
|
|
@ -443,7 +444,6 @@ func _state_process_physics_crouch_move():
|
|||
# print("Movement State Idle State Entered!")
|
||||
|
||||
func _on_state_entered_jump():
|
||||
print ("how many times do I get called?")
|
||||
##TODO: Make this a state export variable
|
||||
# I used to call it 'jump_force' like an idiot.
|
||||
velocity.y = -200
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ func _ready():
|
|||
|
||||
tired_debuff_modifier.setup('so_tired', StateModifierMovement.SUB_TYPE.NEGATIVE_CONSTRAINT)
|
||||
tired_debuff_modifier.horizontal_speed = -40
|
||||
tired_debuff_modifier.only_grounded = true
|
||||
movement_state_machine.push_state_modifier(tired_debuff_modifier)
|
||||
|
||||
#var stamina_recovery :float = 0.0
|
||||
|
|
|
|||
|
|
@ -14,4 +14,10 @@ horizontal_acceleration = 0.0
|
|||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
vertical_speed = 0.0
|
||||
vertical_acceleration = 0.0
|
||||
vertical_speed_offset = 0.0
|
||||
vertical_speed_offset_acceleration = 0.0
|
||||
preserve_inertia = true
|
||||
is_grounded = false
|
||||
animation_sequence = [ "jump" ]
|
||||
|
|
|
|||
|
|
@ -14,4 +14,10 @@ horizontal_acceleration = 0.0
|
|||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
vertical_speed = 0.0
|
||||
vertical_acceleration = 0.0
|
||||
vertical_speed_offset = 0.0
|
||||
vertical_speed_offset_acceleration = 0.0
|
||||
preserve_inertia = true
|
||||
is_grounded = false
|
||||
animation_sequence = [ "jump" ]
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user