sorry for not paying attention

edited 1×, last 15.08.22 05:54:05 pm
-- aid = attacker id
-- vid = victim id
dx = player(vid, "x") - player(aid, "x")
dy = player(vid, "y") - player(aid, "y")
-- normalizing
mag = math.sqrt(dx*dx + dy*dy)
dx_norm = dx / mag
dy_norm = dy / mag
-- new position
knockback scaling = 0.05
x_new = player(vid, "x") + dx_normed * knockback scaling
y_new = player(vid, "y") + dy_normed * knockback scaling
x_newand
y_newyou can calculate the new tile, and then check with
tile(tilex_new, tiley_new, "walkable")
if you can go there or not.