Jump to content

Nodejs + HTL5 player movement


CheekyTrooper
 Share

Recommended Posts

Hey. I'm quite new to the forum and to html5 development. I have been able to link the NodeJS server to the html5 canvas and get designated numbers (atm, it will be player avatars later) But my problem is at the moment is that i can not seem to find any documentation on how to make it so that the player can click anywhere on the canvas to move to that spot. I was able to find WASD or up,down,left,right. But it is not what i want for this project. Just wondering if anyone has any experience in this, and if possible able to link over a documentation of some sort ?

 

Thankyou in advance

Link to comment
Share on other sites

The click event has associated <x, y> coordinates in its payload, you can use those to work out where in the screen the user clicked, where in the DOM they clicked, where in the canvas they clicked and then where in your world where they clicked.

After that you'll need some pathfinding to move from A->B and thats a more involved subject.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...