Example #1
0
 /**
  * Generates picture.
  *
  * @return Bengine_Game_Planet_Creator
  */
 protected function setPicture()
 {
     $planetTypes = new Map();
     $meta = Application::getMeta();
     foreach ($meta["config"]["planet"]["type"] as $name => $planetType) {
         if ($this->position >= $planetType["from"] && $this->position <= $planetType["to"]) {
             $planetTypes->push(array("name" => $name, "number" => $planetType["number"]));
         }
     }
     $randomPlanet = $planetTypes->getRandomElement();
     $this->picture = sprintf("%s%02d", $randomPlanet["name"], mt_rand(1, $randomPlanet["number"]));
     return $this;
 }