public function onFrameUpdate()
 {
     $now = time();
     if ($now > $this->previousTime) {
         $this->currentFrameIndex = ($this->currentFrameIndex + 1) % count($this->frames);
         $this->frameBuffer->setBackgroundFrame($this->frames[$this->currentFrameIndex]);
     }
     $this->previousTime = $now;
 }
Exemple #2
0
 /**
  * This method is called when the game enters this game loop.
  * This is where you would replace the default frame among other things.
  */
 public function onEnter()
 {
     if ($this->background) {
         $this->frameBuffer->setBackgroundFrame($this->background->getPixels());
     }
 }