I'm trying to add knock back to my engine so that when Link gets hit by an enemy or projectile, he gets pushed back 2 or 3 pixels. I have a terrible excuse for one implemented right now, but it's not accurate at all :/
Right now I only have 1 enemy in my engine, an octorock, and want Link to be pushed back when the rock hits him. I have this code in the rock object to detect what direction it should move:
link_pos = point_direction(objOctorok.x,objOctorok.y,objLink.x+1,objLink.y+20)
This works great. I was using kind of the same method to figure out which direction Link should be knocked back, but it doesnt take into consideration negative x and y values :/ Help anyone?