I have connected up a NodeJS and HTML5 client/server architecture. Now what i am trying to do is make it so that the player can click anywhere on the canvas so that the player can move to that location. All information i have found so far states WASD movement no click to move movement. I looked at your tutorial with regards to “Move element to click position” and tried implementing. But no luck… Just wondering if i could get some assistance on this?, Quite a large project… Just need this click to move and i shall be away (Hopefully)
Hi Jason!
Have you looked at this: https://www.kirupa.com/html5/keyboard_events_in_javascript.htm That tutorial explains how to listen for keyboard events. From there, you can easily map it to what you saw in the Move to Click tutorial. Let me know if that helps
Ah! Sorry - misread your post. Can you be a bit more specific where you are running into issues? Are you having difficulty detecting the mouse click position, or are you having difficulty animating the player to the click location?
Okay so i got the server and the client set up.
What im struggling with is what side to write what… If that makes sense?
I know you have to make the server listen for the event made via the client but just unsure…
Unless you are planning on storing each player’s state on the server, everything can be done client side. There is no need for the server to listen for the event if all you are doing is moving a player from one location to another location.