I’m making a game and I want to move an element (which would actually be the character) to wherever I click on the page. (mousedown actually)
I believe it’s possible with a script that changes an element’s position on mousedown but I don’t know how to do it.
I need a simple working example and then I’ll figure out how to adapt it to my site but I haven’t been able to find one.
I tried some simple moving, and found out a tutorial on how to move it with the keyboard but it’s not quite what I want and couldn’t find how to do it with the mouse.
I’m testing it here, though I’m chaning the code fast and most of the time nothing is working:
http://chusmix.com/game/movechar.php
Some advice, code, link anything will be welcomed. Thanks
I managed to pull it off only with javascript:
Thanks for all answers