通过触摸屏设置位置x

时间:2018-06-27 02:19:57

标签: java android libgdx

downBlocks=new Arraylist<Rectangle>;
    for (DownBlocks downBlocks:getBlocks()){
            if(Gdx.input.isTouched()) {

                Vector3 touchPos = new Vector3();

                touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
                camera.unproject(touchPos);



                    downBlocks.x = (int) touchPos.x - downBlocks.x;


            }}

我想制作这些块(并非所有块都在相同的x位置,并且我需要将它们保持在相同的形状),所以我必须减小它们的x位置以发挥作用,但是当我运行此代码时似乎它可以快速移动到拖曳位置(正确的药水和其他我看不到的地方)

0 个答案:

没有答案