【发布时间】:2014-08-21 21:40:59
【问题描述】:
我目前正在使用 LibGdx 开发一款安卓游戏。我正在尝试让多点触控功能发挥作用,因为游戏要求玩家有一个拇指来控制角色,另一个拇指来点击按钮。
代码:
for (int i = 0; i < 2; i++) {
if (Gdx.input.isTouched(i)) {
final int iX = Gdx.input.getX(i);
if (iX > screenwidth - screenwidth / 14) {
buttontouch = true;
} else {
buttontouch = false;
}
if (iX <= screenwidth - screenwidth / 14) {
playertouch = true;
}else{
playertouch = false;
}
}
}
if (playertouch){
etc...
}
if(buttontouch){
etc...
}
可以移动播放器并按下按钮,但不能同时 :( ...这是我需要的。
任何帮助将不胜感激!提前致谢。
【问题讨论】:
标签: java android libgdx multi-touch