Troubleshooting falling.

This commit is contained in:
Dustin 2025-03-18 19:58:39 -07:00
parent 6b1efd27e3
commit ae24288db3
6 changed files with 16 additions and 9 deletions

View File

@ -116,7 +116,7 @@ animations = [ {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
"loop": false,
"name": "jump",
"speed": 10.0
"speed": 2.0
}, {
"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 14 ), SubResource( 15 ), SubResource( 15 ), SubResource( 16 ), SubResource( 16 ), SubResource( 17 ), SubResource( 17 ) ],
"loop": false,

View File

@ -216,7 +216,7 @@ func set_previous_animation( old_state: StateAnimatedActor, new_state: StateAnim
# Handle state change from subscribed state machine.
#From signal state_changed(old_state_name, new_state)
func _on_state_change(old_state_name:String, new_state :State):
print ("got the state change signal ", new_state.name)
print ("1? got the state change signal ", new_state.name)
# set current state to new_state
#TODO: Confirm that this is a reference to the state in the
###### State machine

View File

@ -67,6 +67,8 @@ func process(delta):
# For event based input polling (Hadouken?)
func process_input(event: InputEvent):
# Reset desired movement vector
desired_movement_vector = Vector2(0,0)
if has_method('_state_process_input_' + current_state.name):
call('_state_process_input_' + current_state.name)

View File

@ -247,6 +247,11 @@ dash_1={
common/enable_pause_aware_picking=true
2d/default_gravity=600
[physics]
2d/default_gravity=200
common/physics_interpolation=true
[rendering]
quality/driver/driver_name="GLES2"

View File

@ -23,6 +23,6 @@ func _ready():
# print("Anim Knows Idle State Entered!")
func _on_state_entered_fall():
print("Anim Knows Fall State Entered!")
print ("2? got the state change signal ", current_state.name)
frame = 2
stop()

View File

@ -63,8 +63,8 @@ func _state_process_physics_idle():
request_state_change.call_func('fall')
func _state_process_physics_fall():
if get_movement_direction() != 0.0:
parent.transform.x.x = get_movement_direction()
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if parent.is_on_floor():
#modifier.reference()
@ -72,8 +72,8 @@ func _state_process_physics_fall():
request_state_change.call_func('idle')
func _state_process_physics_jump():
if get_movement_direction() != 0.0:
parent.transform.x.x = get_movement_direction()
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if velocity.y > 0:
request_state_change.call_func('fall')
@ -84,8 +84,8 @@ func _state_process_physics_jump():
func _state_process_physics_move():
# flip sprite in direction
if get_movement_direction() != 0.0:
parent.transform.x.x = get_movement_direction()
if desired_movement_vector.x != 0.0:
parent.transform.x.x = desired_movement_vector.x
if desired_movement_vector.x == 0:
request_state_change.call_func('idle')