Beispiel #1
0
 public function update(World $world)
 {
     $players = $world->getPlayerCollection();
     foreach ($players as $player) {
         /** @var $player Player */
         $player->getIa()->update($world);
         $player->update($world);
     }
     if ($world->getTimer()->isTime(100)) {
         gc_collect_cycles();
     }
 }
 public function render(MapRenderInterface $mapRender, World $world)
 {
     $world->update();
     if ($world->getInputController()->getKey() == "x") {
         $world->getMemoryManager()->persist();
         return;
     }
     $players = $world->getPlayerCollection();
     foreach ($players as $player) {
         $world->getMap()->setItem($player->getPosition(), "P");
     }
     $mapRender->render($world->getMap()->getMap());
     //usleep(200);
     $mapRender->clear($world->getMap()->getMap());
 }