All Questions


Shawn Hill

Hooking downward bug?

There's a blue platform just above one of the hook targets. If the character jumps straight up while standing on this platform and then quickly hooks to the target directly below it, they land on the platform and is perpetually stuck in the "Hook" state.

Not sure if this was just a bug in my code, I tried it in the final version of the sample code (the project in the "05.spawn-and-death" folder) and was similarly stuck in the hook state.

As a workaround, this I added a check at the end of the physics_process function in the States/ script that transitions to the "Move/Idle" state if the owner is on the floor. Ideally, it'd transition to "Move/Run" if it detected lateral velocity. However, the other states that do this (Run and Air) are children of Move and can call "get_parent().get_move_direction().x", a luxury that the Hook state does not have.

  • Nathan Lovato replied

    True, you can solve this by checking if you touch the floor in the hook state:

    	if owner.is_on_floor():

    I'll add an errata to the lesson.