js/pacman.js
// Runs the current game `state` in a loop and render the sprites
Runs the current game `state` in a loop and render the sprites
Runs the current game ` state ` in a loop and render the sprites
function gameLoop() {
  state();
  currtime = new Date().getTime();
  delta = (currtime-lasttime)/1000;
  frameTime -= delta;
  if (frameTime <= 0) {
    frameIndex++;
    if (frameIndex >= frames.length) {
      frameIndex = 0;
    }
    pacmanLevel1.texture = PIXI.Texture.fromFrame(frames[frameIndex]);
    pacmanMenu.texture = PIXI.Texture.fromFrame(frames[frameIndex]);
    frameTime = FRAMERATE;
  }
  renderer.render(stage);
  requestAnimationFrame(gameLoop);
  lasttime = currtime;
}
function gameLoop ( ) { state ( ) ; currtime = new Date ( ) . getTime ( ) ; delta = ( currtime - lasttime ) / 1000 ; frameTime -= delta ; if ( frameTime <= 0 ) { frameIndex ++ ; if ( frameIndex >= frames . length ) { frameIndex = 0 ; } pacmanLevel1 . texture = PIXI . Texture . fromFrame ( frames [ frameIndex ] ) ; pacmanMenu . texture = PIXI . Texture . fromFrame ( frames [ frameIndex ] ) ; frameTime = FRAMERATE ; } renderer . render ( stage ) ; requestAnimationFrame ( gameLoop ) ; lasttime = currtime ; }
Runs the current game `state` in a loop and render the sprites
Runs the current game ` state ` in a loop and render the sprites
//  stats.begin(); // monitored code goes here // Update the current game state: // Determine seconds elapsed since last frame // Animate pacman //    if (activeLevel == 1) pacman = pacmanLevel1; //    if (activeLevel == 2) pacman = pacmanLevel2; //    pacmanLevel2.texture = PIXI.Texture.fromFrame(frames2[frameIndex]); // Render the stage - Tell the `renderer` to render the `stage` // Loop this function 60 times per second //  stats.end();