Jump to content

Mouse click being added wrongly


reportingsjr

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...