theweirdn8 Posted December 30, 2014 Share Posted December 30, 2014 Hello guys, I've been tickering around with EnchantJS and I have been unsuccessful on finding a way to find the mouse coordinates without touching/clicking on the screen. I plan on making a RTS project and I will need to have the mouse coordinates available for the commander to move around the map freely without having to click to do so. Does anyone know how to do this? Quote Link to comment Share on other sites More sharing options...
madmarcel Posted January 5, 2015 Share Posted January 5, 2015 No mention of it in the API.Hmmm, enchant js dev mentions it on his blog.http://blog.enchantjs.com/en/2011/11/22/shi3z-game-programming-2-how-to-become-a-game-programmer-in-48-hours/ You may have to write your own mouse motion listener.This incomplete example uses jQuery to get the canvas offset. Getting the mouse coordinates on a canvas requires some browser kludges and jQuery makes it a little easier.yourcanvas.addEventListener("mousemove", function(event) {var canvas = document.getElementById('yourcanvas'),var x = event.pageX - canvas.offsetLeft,var y = event.pageY - canvas.offsetTop;...}); Quote Link to comment Share on other sites More sharing options...
mwatt Posted January 6, 2015 Share Posted January 6, 2015 I too tinkered around with EnchantJS at one point. I found it very good and very easy - up to a point. After I hit that point, which involved getting support for features and bug fixes, I hit a wall. Part of the problem is that the developers are Japanese and there was less English support and usage than Japanese. Part of the problem is that the engine is simple to use but not especially feature-rich. In the end, I gave up on Enchant, though I don't think it is useless. I turned to Pixi first and then to Phaser. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.