def _get_dir_xy(x1, y1, x2, y2): rads = maths.pdir(x1, y1, x2, y2) dx = round(math.cos(rads)) dy = round(math.sin(rads)) return ( dx, dy, )
def get_direction(self, pc, coords): xf,yf=coords if (pc.x == xf and pc.y == yf): return 0,0 rads=maths.pdir(pc.x,pc.y,xf,yf) dx=round(math.cos(rads)) dy=round(math.sin(rads)) return dx,dy
def get_direction(self, pc, coords): xf, yf = coords pos = rog.world().component_for_entity(pc, cmp.Position) if (pos.x == xf and pos.y == yf): return 0, 0 rads = maths.pdir(pos.x, pos.y, xf, yf) dx = round(math.cos(rads)) dy = round(math.sin(rads)) return dx, dy
def _get_dir_xy(x1, y1, x2, y2): # return the direction from (xf,yf) to (xt,yt) rads = maths.pdir(x1, y1, x2, y2) dx = round(math.cos(rads)) dy = round(math.sin(rads)) return ( dx, dy, )