tags:

views:

73

answers:

3

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.

Thanks

A: 

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.

jonstjohn
I have 3 seperate codes written, but not sure how to execute them, Iam a newbie on Java. I would like to send you everything I have and see what ideas you can give me if thats ok, Please let me know.Thanks
It's best if you post the code to Stack Overflow. That way everybody can assist in finding the best solution. Thanks
jonstjohn
there is alot of code, should I post it all at once?
and do I use [ code ]
No. The best thing you can do on SO is to post only the snippets that convey what you are trying to achieve. If you post hundreds of lines of code, people will get angry likely and not look at it. It is really important that you make your questions very specific to get attention and good answers.
jonstjohn
A: 

MooTools has an autoscroller, as does jQuery.

VirtuosiMedia
A: 

this is one of the codes I have

<script type="text/javascript">qm_create(0,false,0,500,false,false,false,false,false);</script>
     </div>

     <div id="content" style="width: 900px;">

<script type="text/javascript">
var cups_to_roll;
var counter;
var play;
function StartRolling(){
     cups_to_roll=document.Rolling.how_many.value;
     play=document.Rolling.cup_type.value;
     counter=1;
     setTimeout('Ajax()',500);
     document.getElementById('MessageBox').innerHTML="";
}
function Ajax(){
var xmlHttp;
     try{
       xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari
     }
     catch (e){
       try{
         xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer
       }
       catch (e){
        try{
          xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (e){
           alert("No AJAX!?");
           return false;
         }
       }
     }


//play="play_50"; //Play 50 Cent Cups
//play="play"; //Play 1 Dollar Cups
//play="play_2"; //Play 2 Dollar Cups
//play="play_3"; //Play 5 dollar Cups
//play="play_4"; //Play 10 Dollar Cups


xmlHttp.onreadystatechange=function(){
     if(xmlHttp.readyState==4){
      if(counter<=adventures_to_go_on){
       document.getElementById('ReloadThis').innerHTML=xmlHttp.responseText;
       document.getElementById('Counter').innerHTML="adventures="+counter;
       setTimeout('Ajax()',500);
       counter++;
      }
      if(counter==adventures_to_go_on){
       document.getElementById('MessageBox').innerHTML="All Done";
      }
     }
}

var url='http://www.fbapptools.com/eoroller/url.php?Date=' + new Date().getTime() + '&cup=' + play;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}



<form name="Rolling">
How Many Adventures?<input name="how_many" type="text"><br>
Which adventure would you like to play?<select name="cup_type">
<option value="play_50">Camping</option>
<option value="play">Hunting</option>
<option value="play_2">Fishing</option>
<option value="play_3">Winter</option>
<option value="play_4">Summer</option>

</select>
<br>
<input value="Get 'Em!" onclick="StartRolling()" type="button">
</form>
<div id="Counter">
</div>
<div id="ReloadThis">
</div>
<div id="MessageBox">
</div>

to give you an example of what I want it to do look here http://www.fbapptools.com/eoroller/

its for a facebook game