Legacy GM Knockback in platformer/arena game


Hello all! I'm making a 2d platformer-esque/arena type game that is, in hindsight, kind of similar to Towerfall Acsension. But instead of bow and arrows, the character is using a melee attacks.

I can't for the life of me figure out how to get the spawning enemies to get knocked back after getting hit by my hitbox. I'm trying to make the enemies get destroyed after
1. being knocked into solid objects
2. one or two seconds after being hit by the hitbox, so that they'll be destroyed eventually if they don't collide with any solid objects

So far, I just have this place holder code below. All it does is destroy the enemy when they hit the hitbox.

location: objects > hitbox > end step > script

with (obEnemy1) {
// kill enemy
if (!(bbox_left > other.bboxright || bbox_right < other.bboxleft || bbox_top > other.bboxbottom || bbox_bottom < other.bboxtop)) {

Any ideas on how to modify this?


It doesn't phase the enemy. I should've mentioned that they are chasing the player with


in a step event. The only events that the enemies respond to are the ones that have them destroyed or deactivated, so the constant pursuing is probably cancelling out all other codes and actions that deals with movement.
Last edited:


Do this:
if !(knock_back) {
} else {
//Knock back movement
So whenever the enemy receives knockback, movement will be disabled and knockback will commence ;)


It just crashes the game, saying !(knock_back) wasn't set before reading it

Edit: Oh nevermind, I got it working. Thanks for the replies!
Last edited: