I have a game that requires you to click on an object to collect prizes, but instead of giving my user carpel tunnel I want to create an autoroller. I have some code done already but I cant get it to work. If there is anyone out there that would be able to help me get this code working, it would be greatly appreciated.


2 Answers

jonstjohn On

Since you didn't give a very specific description of your problem, I'll give you a somewhat vague answer. However, you may find it helpful:

  • When the user clicks on the object to collect prizes, bind the window.scrollTo() method to the document's mousemove event.
  • Each time the mousemove event is fired, it can kick off the scrollTo event.
  • Look for changes in the y parameter, and scroll + or -

I don't actually recommend creating this behavior, though (in terms of usability). You may want to think of a better way to layout the prize selection so it is more intuitive to the user.

VirtuosiMedia On

MooTools has an autoscroller, as does jQuery.