//Movement functions public void f_translate(PlayerUnit unit, PlayerMap pMap, int displaceX, int displaceY) { //moves a playerunit to a new location. displaceX,Y are how far the unit is move in those directions. pMap.remove_unit(unit); //pMap.restore_old_tile(unit.get_x(), unit.get_y()); unit.set_x(Math.Max(Math.Min(unit.get_x() + displaceX, 4), 0)); //must be between 0 and 4, inclusive unit.set_y(Math.Max(Math.Min(unit.get_y() + displaceY, 3), 0)); //must be between 0 and 3, inclusive pMap.place_unit(unit); //pMap.select_move_highlight(unit.get_x(), unit.get_y()); //<--highlights new tile correctly. unit.status.trigger_move(unit); }