public void setpos(MapView mv, Gob player, Coord sz) {
            long now = System.currentTimeMillis();
            double dt = ((double) (now - last)) / 1000.0;
            last = now;

            if (needreset) {
                needreset = false;
                mv.mc = player.position();
            }

            Coord mc = mv.mc.add(s2m(sz.add(mv.sz.inv()).div(2)));
            Coord sc = m2s(player.position()).add(m2s(mc).inv());
            if (reset) {
                xa = (double) sc.x / (double) sz.x;
                ya = (double) sc.y / (double) sz.y;
                if (xa < -0.25)
                    xa = -0.25;
                if (xa > 0.25)
                    xa = 0.25;
                if (ya < -0.15)
                    ya = -0.15;
                if (ya > 0.25)
                    ya = 0.25;
                reset = false;
            }
            Coord vsz = sz.div(16);
            Coord vc = new Coord((int) (sz.x * xa), (int) (sz.y * ya));
            boolean moved = false;
            if (sc.x < vc.x - vsz.x) {
                if (xa < 0.25)
                    xa += speed * dt;
                moved = true;
                mc = mc.add(s2m(new Coord(sc.x - (vc.x - vsz.x) - 4, 0)));
            }
            if (sc.x > vc.x + vsz.x) {
                if (xa > -0.25)
                    xa -= speed * dt;
                moved = true;
                mc = mc.add(s2m(new Coord(sc.x - (vc.x + vsz.x) + 4, 0)));
            }
            if (sc.y < vc.y - vsz.y) {
                if (ya < 0.25)
                    ya += speed * dt;
                moved = true;
                mc = mc.add(s2m(new Coord(0, sc.y - (vc.y - vsz.y) - 2)));
            }
            if (sc.y > vc.y + vsz.y) {
                if (ya > -0.15)
                    ya -= speed * dt;
                moved = true;
                mc = mc.add(s2m(new Coord(0, sc.y - (vc.y + vsz.y) + 2)));
            }
            if (!moved) {
                sincemove += dt;
                if (sincemove > 1) {
                    if (xa < -0.1)
                        xa += rspeed * dt;
                    if (xa > 0.1)
                        xa -= rspeed * dt;
                    if (ya < -0.1)
                        ya += rspeed * dt;
                    if (ya > 0.1)
                        ya -= rspeed * dt;
                }
            } else {
                sincemove = 0;
            }
            mv.mc = mc.add(s2m(mv.sz.add(sz.inv()).div(2)));
        }