Camera control scripts on mobile devices - Isometric
prajwal.be.21

Hey,

I am using camera-control script "right click and drag to move.js" and "mouse wheel to zoom.js" in my isometric game and have run into an issue with drag to move on mobile screens. 

The camera control works well on PC browsers and I can use button "2" or button "0" to drag either with right or left button respectively. The "mouse wheel to zoom" feature too works fine.

But the problem is when I play this game on a mobile browser. "mouse wheel to zoom.js" script works where but I cannot drag the map by dragging the screen. I changed "wade.app.onMouseDown" to "wade.app.onIsoTerrainMouseDown" but still I am not able to move the map on mobile screens.

May I know what I should do to get this feature working for mobile screens? Do I need to change anything in the eventhandlers that makes the script work on small screen, etc? Please help!

All 3 Comments
prajwal.be.21

Hey guys, I changed the script to be triggered by onSwipe events instead of onMouse events and it is working. I just went to docs and replaced the events that were only triggered by mouse to ones triggered by touch events. Still have to figure of how to set dragActive to flase based on how much the camera moved, but think I can do it with playing around with pos' and newpos' x and y properties.

Gio

Hi Prajwal, sorry for the late reply. Did you get it working as you wanted?

I think it should work if you don't use the "button" property - I believe that is only defined for actual mouse events, not touch events. However, it should be ok to use onMouseDown even on touch screen devices, you shouldn't need to use onSwipe (unless you want to).

prajwal.be.21

Thank you so much for the reply Gio. Gosh, I should have figured out to omit the button property while setting dragActive to true.

Thanks a lot anyways, appreciate it!.

Post a reply
Add Attachment
Submit Reply
Login to Reply