[英]LibGdx 2 half screen “buttons”
(Android)因此,我是LibGdx的新手,我正在尝试编写此chrome dino迷你游戏。.我想在用户触摸屏幕左侧时进行操作1,而在用户触摸右侧时进行操作2屏幕的手侧,我该怎么办?
You can detect the side being touched by using the following code somewhere inside your game loop: 您可以在游戏循环内的某处使用以下代码来检测被触摸的一侧:
if (Gdx.input.isTouched()) {
if (Gdx.input.getX() > Gdx.graphics.getWidth() / 2){
//touched right
} else {
//touchde left
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.