11-22-2014, 03:22 PM
You don't need an extension, just put the code I gave you into a code action. It'll work just fine. I dunno why you're using the action icons anyway; they only slow down editing events.
As for the knockback, this is what I use:
I removed the code involving state and sprite changes, because I don't know what you're using. Anyway, this code will check which side of the player the enemy is on, and then knock them in the opposite direction.
As for the knockback, this is what I use:
Code:
if(state != hurt && !blinking && !attacking && other.state != hurt){ //This is just to make sure the player can be hurt. Chance it to whatever you need.
if(x != other.x) facing = -((x - other.x) / abs(x - other.x));
xSpeed = -3 * facing;
ySpeed = -3;
};
I removed the code involving state and sprite changes, because I don't know what you're using. Anyway, this code will check which side of the player the enemy is on, and then knock them in the opposite direction.