Results 1 to 5 of 5
  1.    #1  
    i have the following code:

    Code:
    this.updater = this.controller.window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    
    ...updateProgress = function(){
    .
    .
    .
    if(){
    
         this.windSpeed++;
    
         this.controller.window.clearInterval(this.updater);
    
         this.updater =      this.controller.window.setInterval(this.updateProgress.bind(this), 100-     this.windSpeed*5);
    
    }
    
    else{
    
         this.windSpeed--;
    
         this.controller.window.clearInterval(this.updater);
    
         this.updater = this.controller.window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    }
    .
    .
    .
    }//end of updateProgress function
    i start the setInterval, but update it inside the function it is bound to. this code does not work, though, and will not update the speed the game is running at. any ideas? thanks!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  2. #2  
    Quote Originally Posted by shanerooni View Post
    i have the following code:

    Code:
    this.updater = this.controller.window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    
    ...updateProgress = function(){
    .
    .
    .
    if(){
    
         this.windSpeed++;
    
         this.controller.window.clearInterval(this.updater);
    
         this.updater =      this.controller.window.setInterval(this.updateProgress.bind(this), 100-     this.windSpeed*5);
    
    }
    
    else{
    
         this.windSpeed--;
    
         this.controller.window.clearInterval(this.updater);
    
         this.updater = this.controller.window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    }
    .
    .
    .
    }//end of updateProgress function
    i start the setInterval, but update it inside the function it is bound to. this code does not work, though, and will not update the speed the game is running at. any ideas? thanks!
    Try something like this:

    Code:
    this.updater = window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    
    
    
    updateProgress()
    
    .
    .
    if(){
    
         this.windSpeed++;
    
         window.clearInterval(this.updater);
    
         this.updater =  window.setInterval(this.updateProgress.bind(this), 100-  this.windSpeed*5);
    
    }
    
    else{
    
         this.windSpeed--;
    
         window.clearInterval(this.updater);
    
         this.updater = window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    }
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  3.    #3  
    no luck... i'll keep checking away. thanks!
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix
  4. #4  
    Quote Originally Posted by shanerooni View Post
    no luck... i'll keep checking away. thanks!
    What I did in my app that worked was making different intervals, instead of using the same one. I'm also using handlers, but that shouldn't be a problem.

    Code:
    if(){
    
         this.windSpeed++;
    
         window.clearInterval(this.updater);
        window.clearInterval(this.secondIf);
    
         this.firstIf=  window.setInterval(this.updateProgress.bind(this), 100-  this.windSpeed*5);
    
    }
    
    else{
    
         this.windSpeed--;
    
         window.clearInterval(this.updater);
        window.clearInterval(this.firstIf);
    
         this.secondIf= window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    }
    WOG Dev - WebOS Group http://www.WebOSGroup.com
    PMP Dev - http://www.PimpMyPre.com
    Apps: WOG O.S.K., WOG Card Keeper, WOG Glowstick, WOG Kid Protect, PreLoad, PimpMySounds
  5.    #5  
    Quote Originally Posted by pimpmypre View Post
    What I did in my app that worked was making different intervals, instead of using the same one. I'm also using handlers, but that shouldn't be a problem.

    Code:
    if(){
    
         this.windSpeed++;
    
         window.clearInterval(this.updater);
        window.clearInterval(this.secondIf);
    
         this.firstIf=  window.setInterval(this.updateProgress.bind(this), 100-  this.windSpeed*5);
    
    }
    
    else{
    
         this.windSpeed--;
    
         window.clearInterval(this.updater);
        window.clearInterval(this.firstIf);
    
         this.secondIf= window.setInterval(this.updateProgress.bind(this), 100-this.windSpeed*5);
    }
    yeah, i tried to do that too, but as i increase the speed of the game it gets choppy. it's for a hot air balloon game, Ballooning, and instead of increasing the speed of the game, i'm just having the balloon move up and down at a lower rate (if gameSpeed = 2, upDist += upDistInc/gameSpeed)... so the game will stay the same speed (which is good since it's graphics intensive on the canvas), and and the balloon will move proportionally slower over a given distance.

    thanks for the help! i'm sure we could have made it work, but like i mentioned it would kill the processing. i'm already updating a load of drawing and calcs every 100ms.
    My site: Shanerooni, LLC
    Follow me on Twitter
    My apps: GuessWhat? | MazeHunter3D | Small Wonders | PhakePhoney | AutismAware | PicSketcher | Cubix | QuickSolve | QuickSpell | QuickTrace | QuickWhack | QuickSuite | Soccer Shots | Ballooning |
    Cubix

Posting Permissions