A
AwesomeAlvin
Guest
Hello,
This is my code right now to knockback enemies in my top down shooter when using a melee attack:
This is a script that is called in my melee collision event with the enemy, and the arguments is the knockback amount. In my melee, the knockback amount is 40.
I'm fairly new to gamemaker so I don't know many useful functions or how to use them efficiently. I've also followed a lot of tutorials and guides.
So I'm thinking is how can I see if there's an object in where the enemy is about to get knocked back into, and if there is, then subtract the distance between those two to the knockback. Or something like that.
Any help would be appreciated, thanks!
Let me know if there's any other detail I need to provided.
This is my code right now to knockback enemies in my top down shooter when using a melee attack:
Code:
var dir = point_direction(x, y, other.x, other.y);
other.x += lengthdir_x(argument0, dir);
other.y += lengthdir_y(argument0, dir);
I'm fairly new to gamemaker so I don't know many useful functions or how to use them efficiently. I've also followed a lot of tutorials and guides.
So I'm thinking is how can I see if there's an object in where the enemy is about to get knocked back into, and if there is, then subtract the distance between those two to the knockback. Or something like that.
Any help would be appreciated, thanks!
Let me know if there's any other detail I need to provided.