小编Nit*_*ain的帖子

这是检测LibGdx中矩形触摸的正确方法吗?似乎不适合我

这是我的游戏屏幕的代码,我想在触摸时爆破我的气球.方向是肖像.但它似乎对我不起作用.

 public class GameScreen implements Screen {
    final BB game;
    private BitmapFont font;
    private static final int no_of_frames = 2;
    Texture ballonFrames;
    TextureRegion[] burstFrames = new TextureRegion[no_of_frames];
    Animation burstAnimation;
    Array<Rectangle> ballons;
    TextureRegion currentFrame;
    long lastBallonTime;
    int ballonBursted;
    OrthographicCamera camera;
    int ballonMissed;

    Sound ballonBursting;

    public GameScreen(final BB gam) {
        this.game = gam;

        ballonFrames = new Texture(Gdx.files.internal("ballon_burst.png"));
        font = new BitmapFont(Gdx.files.internal("font.fnt"), false);
        ballonBursting = Gdx.audio.newSound(Gdx.files
                .internal("BallonBursting.wav"));
        TextureRegion[][] tmp = TextureRegion.split(ballonFrames,
                ballonFrames.getWidth() / 2, ballonFrames.getHeight());
        burstFrames[0] = tmp[0][0];
        burstFrames[1] = tmp[0][1];

        burstAnimation = …
Run Code Online (Sandbox Code Playgroud)

android libgdx

8
推荐指数
1
解决办法
3332
查看次数

标签 统计

android ×1

libgdx ×1