fillRect(0, 0, $r->getWidth(), self::HEIGHT, [0, 0, 0]); $font->draw($r, '1UP', 16, 0, 1, ArcadeFont::GREEN); $font->draw($r, self::points($this->session->score), 64, 8, 1, ArcadeFont::WHITE, 'right'); $font->draw($r, 'HI SCORE', $r->getWidth(), 0, 1, ArcadeFont::RED, 'right'); $font->draw($r, self::points($this->session->hiScore), $r->getWidth(), 8, 1, ArcadeFont::WHITE, 'right'); } /** Lives (rainbow arcs) and the diamonds picked up on this island, over the bottom of the playfield. */ public function renderBottom(Renderer $r): void { $y = $r->getHeight() - 7; for ($i = 0; $i < min($this->session->lives, 8); $i++) { $this->artwork->drawLifeIcon($r, 1 + $i * 9, $y); } foreach (self::DIAMOND_COLOURS as $i => $colour) { if (!empty($this->session->diamonds[$i])) { $r->fillRect($r->getWidth() - 60 + $i * 8, $y + 1, 5, 5, $colour); } } } /** Scores are shown like the original: "00" for nothing. */ public static function points(float $score): string { return $score < 1 ? '00' : number_format($score, 0, '', ''); } }