reportingsjr Posted July 24, 2007 Share Posted July 24, 2007 Hi, I'm making a game right now with javascript and html, but for some reason it is moving the character around wrongly. Every time you click, the click is recorded as being further away from the mouse. So each time it ends up further and firther away from the mouse. (sorry if I have not explained this well, iyou can see for yourself though).Try it at http://play.rsbattlehelp.com (non IE compatible, why are you using IE though? )You can view the source code to see it all, I have added documentation on a few of them, the main ones anyways. I think the problem is in the draw_char() function.I will be releasing this to the public soon, it will be open source and I hope to get other people adding to it (choco is helping a bit).Thanks for reading! Link to comment Share on other sites More sharing options...
justsomeguy Posted July 24, 2007 Share Posted July 24, 2007 What are you doing with this:x = e.clientX-w/2-cx;Do you mean this:x = (e.clientX) - (w/2) - (cx);or this:x = (e.clientX - w) / (2 - cx);Division has a greater precendence then subtraction, so it's doing the first one. Is that the one you mean? Regardless, it might be better to use parens for clarification anyway. Link to comment Share on other sites More sharing options...
reportingsjr Posted July 24, 2007 Author Share Posted July 24, 2007 Hmm, could be, I was thinking w/2 and h/2 were just those the whole time. I'll try it!EDIT: nope, tried it and nothing changed. Link to comment Share on other sites More sharing options...
jhecht Posted July 25, 2007 Share Posted July 25, 2007 If it helps you any, Firebug is giving me this error:this[this.length - 1] has no propertiesaddItem(click clientX=0, clientY=0, undefined, undefined, undefined)play.rsbattlehelp... (line 21)handleEvent(click clientX=0, clientY=0)play.rsbattlehelp... (line 221)[break on this error] this[(this.length-1)]["name"] = name;Says its on play.rsbattlehelp.com line 21Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.