I am making a game where, when the player is hit by an enemy’s attack, they jump in the opposite direction while facing the attacking enemy.
Previously, I set attributes based on the direction of the enemy’s attack and used those attributes to determine the direction of the damage animation.
However, this method required preparing separate left and right states for both the attacker and the damage receiver, which tended to bloat the script. Due to the specifications of Action Game Maker, increasing the number of scripts and links degrades performance.
I considered that using the “Knockback” feature added in version 2.0 might simplify the script, but I couldn’t configure it correctly.
If I select “Left/Right” for the Knockback direction, the character moves left and right, but even with the “Perform Jump Action” checkbox enabled in the Action settings, no jump occurs.
I tried transitioning to another state with the “Perform Jump Action” checkbox enabled 0.1 seconds later, but the jump still did not occur.
The first attached image shows the state with Knockback applied, and the second image shows the node that triggers the jump.
I also tried selecting “Launch” for the Knockback direction, but no matter how I configured it, the movement direction and the sprite’s facing direction always remained the same.
Here are the configurations I tried:
Configuration
- Launch: 45°
- Opposite Direction: On
- Face Opposite to Movement Direction: On
Result: Faces the opposite direction of the enemy and moves in the opposite direction
Configuration
- Launch: 45°
- Opposite Direction: On
- Face Opposite to Movement Direction: Off
Result: Faces the enemy and moves toward the enemy
Configuration
- Launch: 45°
- Opposite Direction: Off
- Face Opposite to Movement Direction: On
Result: Faces the opposite direction of the enemy and moves in the opposite direction
Configuration
- Launch: 45°
- Opposite Direction: Off
- Face Opposite to Movement Direction: Off
Result: Faces the opposite direction of the enemy and moves in the opposite direction
Configuration
- Launch: -45°
- Opposite Direction: On
- Face Opposite to Movement Direction: On
Result: Faces the enemy and moves toward the enemy
Configuration
- Launch: -45°
- Opposite Direction: On
- Face Opposite to Movement Direction: Off
Result: Faces the enemy and moves toward the enemy
Configuration
- Launch: -45°
- Opposite Direction: Off
- Face Opposite to Movement Direction: On
Result: Faces the opposite direction of the enemy and moves in the opposite direction
Configuration
- Launch: -45°
- Opposite Direction: Off
- Face Opposite to Movement Direction: Off
Result: Faces the opposite direction of the enemy and moves in the opposite direction
Is it possible to configure “Knockback” so that the character flies backward while facing the attacking enemy?
In the practical examples in the tutorial, the direction was set to “Launch” with distance and time specified, but there is no distance setting for “Launch” (only for Left/Right), so that configuration is not possible. The only options available for Launch are Initial Velocity and Velocity Application Method.







