java如何从纹理下删除上面的纹理?
我正在制作一个scratchcard迷你游戏,我想让scratchcard纹理可以与其他纹理一起擦除,我有scratchcard纹理(彩色)和一个面具纹理(圆形),我正在尝试制作,所以当面具纹理在scratchcard纹理上时,它会变成一个“洞”,你可以通过它看到背景
我试过用混合的方法做
这是我在stackoverflow上从另一个主题中找到的代码,我试图修改它,但它似乎不起作用
// draw our destination image
super.draw(batch, parentAlpha);
batch.end();
// remember SpriteBatch's current functions
int srcFunc = batch.getBlendSrcFunc();
int dstFunc = batch.getBlendDstFunc();
// Let's enable blending
batch.enableBlending();
batch.begin();
// blend them
batch.setBlendFunction(GL20.GL_ZERO, GL20.GL_ONE_MINUS_DST_ALPHA);
image.setPosition(Gdx.input.getX() - (image.getWidth() / 2), -Gdx.input.getY() + (1280 * GambleRPG.SCALE_Y) - (image.getHeight() / 2));
image.draw(batch, parentAlpha);
// Reset
batch.end();
batch.begin();
batch.setBlendFunction(srcFunc, dstFunc);
共 (0) 个答案