Add mobile bridge belt controls

This commit is contained in:
sigonasr2 2020-09-05 11:20:04 +09:00
parent e1c006da3f
commit a3b2061743

11
game.js
View File

@ -844,6 +844,17 @@ function clickEvent(e) {
for (var button of MENU.buttons) { for (var button of MENU.buttons) {
if (ButtonIsUnlocked(button)) { if (ButtonIsUnlocked(button)) {
if (mouseOverButton(canvas,e,button)) { if (mouseOverButton(canvas,e,button)) {
if (MOBILE&&button===CONVEYOR_BUILD_BUTTON) {
setTimeout(()=>{
if (!MOUSEDOWN&&
LAST_MOUSE_X>=CONVEYOR_BUILD_BUTTON.x&&
LAST_MOUSE_X<=CONVEYOR_BUILD_BUTTON.x+CONVEYOR_BUILD_BUTTON.w&&
LAST_MOUSE_Y>=CONVEYOR_BUILD_BUTTON.y&&
LAST_MOUSE_Y<=CONVEYOR_BUILD_BUTTON.y+CONVEYOR_BUILD_BUTTON.h) {
BRIDGEDBELT=!BRIDGEDBELT
}
},500)
}
if (button.cb!==undefined) { if (button.cb!==undefined) {
button.cb() button.cb()
return; return;