Skip to content

Commit

Permalink
Added a turnOver flag, stopped infinite loop for ball speed change
Browse files Browse the repository at this point in the history
  • Loading branch information
judenaveenraj committed Aug 25, 2011
1 parent 7965cd1 commit b4ade71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion myscript.js
Expand Up @@ -7,6 +7,7 @@ var wheelRotStatus=1;
var upperhalf=0; //to denote the ball is in upper half of wheel and to correct angle
var indiRot=0;
var ballDropped=0;
var turnOver=0;
var betMouseX=0;
var betMouseY=0;
var presentBetNum=0;
Expand Down Expand Up @@ -168,6 +169,7 @@ if(ballspdinc<0) ballspdinc=0;
}

function ballAccelrt(){
if (turnOver!=1){
//console.log(" 1:"+posx+" 2:"+posy+" 3:"+posrad+" 4:"+posangrad+" 5:"+posangle+" 6:"+ball.x+" 7:"+ball.y);
if(upperhalf==0){
posangle+=ballspdinc;
Expand All @@ -190,6 +192,7 @@ if (ballspdinc==0)
{
var x=-1*(posangle%360);
x=Math.floor(posangle/10);
turnOver=1;
console.log(x);
//Math.floor(posangle
}
Expand All @@ -201,6 +204,7 @@ else
setTimeout(function(){if (ballspdinc>0) decrSpd();},5);
setTimeout(function(){ballAccelrt();},5);
}
}


function dropball(){
Expand Down Expand Up @@ -229,7 +233,8 @@ posangle=posangrad*(180/Math.PI);
function guessBetPos(){
betMouseX=canvas.mouse.x-545;
betMouseY=(canvas.mouse.y-360)*-1;
if(0<betMouseX<535 && 0<betMouseY<135)
if(0<betMouseX && betMouseX<535 && 0<betMouseY && betMouseY<135)
console.log("x:"+betMouseX+"y: "+betMouseY);
presentBetNum=(3*Math.floor(betMouseX/45))+(Math.ceil(betMouseY/45));
stopbtntext.text=betMouseX+" "+betMouseY+" "+presentBetNum;

Expand Down

0 comments on commit b4ade71

Please sign in to comment.