Code Sketch
Bixuu AbyssalKingdomSecretsOfTheDeepEvent03
Category: Programming
import java.awt.{BasicStroke, BorderLayout, Color, Dimension, Font, Graphics, Graphics2D, GradientPaint, Polygon, RenderingHints}
import java.awt.event.{ActionEvent, ActionListener, KeyAdapter, KeyEvent, MouseAdapter, MouseEvent, WindowAdapter, WindowEvent}
import javax.swing.{JButton, JFrame, JLabel, JPanel, JTextField, SwingConstants, SwingUtilities, Timer, WindowConstants}
import scala.collection.mutable.ArrayBuffer
object AbyssalKingdomSecretsOfTheDeepEvent03 {
def main(args: Array[String]): Unit = {
SwingUtilities.invokeLater(new Runnable {
def run(): Unit = openGame()
})
}
def openGame(): Unit = {
val frame = new JFrame("TITANVERSE - ABYSSAL KINGDOM: SECRETS OF THE DEEP")
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
frame.setResizable(false)
val login = new AbyssalLoginPanel((playerName: String) => {
val game = new AbyssalGamePanel(playerName)
frame.setContentPane(game)
frame.pack()
frame.setLocationRelativeTo(null)
game.requestFocusInWindow()
game.startGame()
frame.addWindowListener(new WindowAdapter {
override def windowClosing(e: WindowEvent): Unit = game.stopGame()
override def windowClosed(e: WindowEvent): Unit = game.stopGame()
})
})
frame.setContentPane(login)
frame.pack()
frame.setLocationRelativeTo(null)
frame.setVisible(true)
}
}
class AbyssalLoginPanel(onStart: String => Unit) extends JPanel {
setPreferredSize(new Dimension(1024, 720))
setLayout(null)
setBackground(new Color(3, 22, 43))
val title = new JLabel("ABYSSAL KINGDOM", SwingConstants.CENTER)
title.setFont(new Font("Serif", Font.BOLD, 48))
title.setForeground(new Color(174, 245, 255))
title.setBounds(170, 105, 684, 65)
add(title)
val subtitle = new JLabel("SECRETS OF THE DEEP | TITANVERSE EVENT 03", SwingConstants.CENTER)
subtitle.setFont(new Font("SansSerif", Font.BOLD, 17))
subtitle.setForeground(new Color(90, 220, 224))
subtitle.setBounds(190, 177, 644, 35)
add(subtitle)
val story = new JLabel("Explore sunken kingdoms, collect pearls and awaken the Abyss Gate.", SwingConstants.CENTER)
story.setFont(new Font("SansSerif", Font.PLAIN, 16))
story.setForeground(new Color(201, 232, 239))
story.setBounds(150, 240, 724, 32)
add(story)
val nameLabel = new JLabel("ENTER YOUR DIVER NAME", SwingConstants.CENTER)
nameLabel.setFont(new Font("SansSerif", Font.BOLD, 16))
nameLabel.setForeground(new Color(160, 231, 239))
nameLabel.setBounds(300, 330, 424, 30)
add(nameLabel)
val nameField = new JTextField("Ocean Explorer")
nameField.setFont(new Font("SansSerif", Font.PLAIN, 20))
nameField.setHorizontalAlignment(SwingConstants.CENTER)
nameField.setBounds(342, 370, 340, 44)
add(nameField)
val startButton = new JButton("DIVE INTO THE KINGDOM")
startButton.setFont(new Font("SansSerif", Font.BOLD, 16))
startButton.setForeground(Color.WHITE)
startButton.setBackground(new Color(0, 116, 145))
startButton.setFocusPainted(false)
startButton.setBounds(342, 440, 340, 50)
startButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = {
var chosen = nameField.getText.trim
if (chosen.length == 0) chosen = "Ocean Explorer"
onStart(chosen)
}
})
add(startButton)
val details = new JLabel("WASD / ARROWS: MOVE SPACE: SWIFT CURRENT DASH F: BUBBLE PULSE E: INTERACT", SwingConstants.CENTER)
details.setFont(new Font("SansSerif", Font.PLAIN, 12))
details.setForeground(new Color(136, 201, 213))
details.setBounds(80, 590, 864, 26)
add(details)
val safe = new JLabel("Offline adventure | No internet, no file changes, no extra downloads", SwingConstants.CENTER)
safe.setFont(new Font("SansSerif", Font.PLAIN, 12))
safe.setForeground(new Color(102, 166, 184))
safe.setBounds(180, 625, 664, 24)
add(safe)
override def paintComponent(g: Graphics): Unit = {
super.paintComponent(g)
val g2 = g.asInstanceOf[Graphics2D]
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
g2.setPaint(new GradientPaint(0, 0, new Color(2, 13, 37), 0, getHeight, new Color(0, 105, 130)))
g2.fillRect(0, 0, getWidth, getHeight)
var i = 0
while (i < 75) {
val x = (i * 137 + 29) % getWidth
val y = (i * 79 + 17) % getHeight
val size = 2 + (i % 4)
g2.setColor(new Color(133, 235, 245, 90))
g2.fillOval(x, y, size, size)
i += 1
}
g2.setColor(new Color(70, 220, 230, 28))
g2.fillOval(345, 10, 330, 260)
g2.setColor(new Color(2, 25, 53, 160))
g2.fillOval(395, 42, 250, 195)
g2.setColor(new Color(94, 225, 231, 75))
g2.setStroke(new BasicStroke(4.0f))
g2.drawOval(395, 42, 250, 195)
}
}
class AbyssalPickup(val x: Int, val y: Int, val kind: Int, var collected: Boolean)
class AbyssalBubble(val x: Int, val y: Int, var used: Boolean)
class AbyssalJelly(var x: Double, var y: Double, var direction: Double, var stunnedTicks: Int)
class AbyssalGamePanel(val playerName: String) extends JPanel {
setPreferredSize(new Dimension(1024, 720))
setLayout(null)
setBackground(new Color(2, 28, 52))
setFocusable(true)
val zoneNames = Array("CORAL GARDENS", "SUNKEN ROYAL RUINS", "ABYSSAL TRENCH", "PEARL PALACE")
val zoneStories = Array(
"Find the lost pearls among glowing coral.",
"Explore the ruins and recover the royal emblems.",
"Follow the deep currents and find ancient runes.",
"Awaken the Pearl Guardian and open the Abyss Gate."
)
val keys = scala.collection.mutable.Set[Int]()
val pickups = ArrayBuffer[AbyssalPickup]()
val airBubbles = ArrayBuffer[AbyssalBubble]()
val jellies = ArrayBuffer[AbyssalJelly]()
var zone = 0
var playerX = 105.0
var playerY = 365.0
var oxygen = 100
var lives = 3
var pearls = 0
var coins = 0
var relics = 0
var collectedInZone = 0
var tick = 0
var dashTicks = 0
var dashCooldown = 0
var pulseTicks = 0
var pulseCooldown = 0
var invulnerableTicks = 0
var paused = false
var gameOver = false
var victory = false
var guardianShields = 3
var mouseTargetX = -1.0
var mouseTargetY = -1.0
var statusMessage = "Collect 5 treasures to unlock the next sea gate."
var gameTimer: Timer = null
val interactButton = new JButton("INTERACT / GATE")
interactButton.setBounds(600, 660, 150, 34)
styleButton(interactButton)
interactButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = { interact(); requestFocusInWindow() }
})
add(interactButton)
val dashButton = new JButton("CURRENT DASH")
dashButton.setBounds(760, 660, 120, 34)
styleButton(dashButton)
dashButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = { doDash(); requestFocusInWindow() }
})
add(dashButton)
val pulseButton = new JButton("BUBBLE PULSE")
pulseButton.setBounds(890, 660, 124, 34)
styleButton(pulseButton)
pulseButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = { doPulse(); requestFocusInWindow() }
})
add(pulseButton)
def styleButton(button: JButton): Unit = {
button.setFont(new Font("SansSerif", Font.BOLD, 11))
button.setForeground(Color.WHITE)
button.setBackground(new Color(0, 105, 133))
button.setFocusPainted(false)
button.setFocusable(false)
}
loadZone()
addKeyListener(new KeyAdapter {
override def keyPressed(e: KeyEvent): Unit = {
keys += e.getKeyCode
if (e.getKeyCode == KeyEvent.VK_SPACE) doDash()
if (e.getKeyCode == KeyEvent.VK_F) doPulse()
if (e.getKeyCode == KeyEvent.VK_E) interact()
if (e.getKeyCode == KeyEvent.VK_P || e.getKeyCode == KeyEvent.VK_ESCAPE) paused = !paused
if (e.getKeyCode == KeyEvent.VK_B) returnToBase()
if (e.getKeyCode == KeyEvent.VK_R && (gameOver || victory)) restartGame()
}
override def keyReleased(e: KeyEvent): Unit = { keys -= e.getKeyCode }
})
addMouseListener(new MouseAdapter {
override def mousePressed(e: MouseEvent): Unit = {
if (e.getButton == MouseEvent.BUTTON1 && e.getY < 645) {
mouseTargetX = e.getX.toDouble
mouseTargetY = e.getY.toDouble
requestFocusInWindow()
}
}
})
def startGame(): Unit = {
if (gameTimer == null) {
gameTimer = new Timer(40, new ActionListener {
def actionPerformed(e: ActionEvent): Unit = updateGame()
})
}
gameTimer.start()
requestFocusInWindow()
}
def stopGame(): Unit = {
if (gameTimer != null) gameTimer.stop()
}
def loadZone(): Unit = {
pickups.clear()
airBubbles.clear()
jellies.clear()
collectedInZone = 0
playerX = 105.0
playerY = 365.0
oxygen = 100
mouseTargetX = -1.0
mouseTargetY = -1.0
var i = 0
while (i < 5) {
val px = 210 + i * 145 + (zone % 2) * 24
val py = 220 + ((i * 97 + zone * 53) % 245)
pickups += new AbyssalPickup(px, py, i % 3, false)
i += 1
}
airBubbles += new AbyssalBubble(320, 180, false)
airBubbles += new AbyssalBubble(710, 520, false)
jellies += new AbyssalJelly(430.0, 310.0, 1.0, 0)
jellies += new AbyssalJelly(735.0, 430.0, -1.0, 0)
statusMessage = zoneStories(zone)
}
def doDash(): Unit = {
if (!paused && !gameOver && !victory && dashCooldown <= 0) {
dashTicks = 12
dashCooldown = 75
statusMessage = "Swift Current Dash!"
}
}
def doPulse(): Unit = {
if (!paused && !gameOver && !victory && pulseCooldown <= 0) {
pulseTicks = 14
pulseCooldown = 95
var i = 0
while (i < jellies.length) {
val jelly = jellies(i)
val dx = jelly.x - playerX
val dy = jelly.y - playerY
if (dx * dx + dy * dy < 230.0 * 230.0) jelly.stunnedTicks = 120
i += 1
}
if (zone == 3 && collectedInZone >= 5 && guardianShields > 0) {
guardianShields -= 1
statusMessage = "Pearl Pulse struck the Guardian! Shields left: " + guardianShields
} else {
statusMessage = "A bubble pulse clears the nearby current!"
}
}
}
def interact(): Unit = {
if (gameOver || victory || paused) return
if (playerX > 835.0 && collectedInZone >= 5) {
if (zone < 3) {
zone += 1
loadZone()
} else if (guardianShields <= 0) {
victory = true
statusMessage = "The Abyss Gate is awake! The Deep Kingdom is restored."
} else {
statusMessage = "The Pearl Guardian still holds " + guardianShields + " shields. Use Bubble Pulse nearby!"
}
} else if (playerX > 835.0) {
statusMessage = "The Sea Gate needs 5 treasures. You have " + collectedInZone + "/5."
} else {
statusMessage = "Swim to the glowing gate on the right and press E."
}
}
def returnToBase(): Unit = {
playerX = 105.0
playerY = 365.0
oxygen = 100
mouseTargetX = -1.0
mouseTargetY = -1.0
statusMessage = "Back at the safe reef. Catch your breath!"
}
def restartGame(): Unit = {
zone = 0
lives = 3
pearls = 0
coins = 0
relics = 0
guardianShields = 3
gameOver = false
victory = false
paused = false
loadZone()
requestFocusInWindow()
}
def updateGame(): Unit = {
if (paused || gameOver || victory) { repaint(); return }
tick += 1
if (dashCooldown > 0) dashCooldown -= 1
if (pulseCooldown > 0) pulseCooldown -= 1
if (dashTicks > 0) dashTicks -= 1
if (pulseTicks > 0) pulseTicks -= 1
if (invulnerableTicks > 0) invulnerableTicks -= 1
var dx = 0.0
var dy = 0.0
if (keys.contains(KeyEvent.VK_A) || keys.contains(KeyEvent.VK_LEFT)) dx -= 1.0
if (keys.contains(KeyEvent.VK_D) || keys.contains(KeyEvent.VK_RIGHT)) dx += 1.0
if (keys.contains(KeyEvent.VK_W) || keys.contains(KeyEvent.VK_UP)) dy -= 1.0
if (keys.contains(KeyEvent.VK_S) || keys.contains(KeyEvent.VK_DOWN)) dy += 1.0
if (dx == 0.0 && dy == 0.0 && mouseTargetX >= 0.0) {
val mx = mouseTargetX - playerX
val my = mouseTargetY - playerY
val distance = Math.sqrt(mx * mx + my * my)
if (distance > 8.0) { dx = mx / distance; dy = my / distance }
else { mouseTargetX = -1.0; mouseTargetY = -1.0 }
}
val baseSpeed = 2.65 + Math.min(1.4, pearls.toDouble * 0.045)
val speed = if (dashTicks > 0) baseSpeed * 2.8 else baseSpeed
if (dx != 0.0 || dy != 0.0) {
val length = Math.sqrt(dx * dx + dy * dy)
playerX += dx / length * speed
playerY += dy / length * speed
}
playerX = Math.max(35.0, Math.min(970.0, playerX))
playerY = Math.max(145.0, Math.min(590.0, playerY))
if (tick % 18 == 0) oxygen -= 1
if (oxygen <= 0) {
lives -= 1
if (lives <= 0) {
gameOver = true
statusMessage = "Out of air! Press R to dive again."
} else {
oxygen = 65
playerX = 105.0
playerY = 365.0
statusMessage = "Air depleted! A safe-current carried you back to the reef."
}
}
var i = 0
while (i < pickups.length) {
val pickup = pickups(i)
if (!pickup.collected) {
val px = pickup.x - playerX
val py = pickup.y - playerY
if (px * px + py * py < 30.0 * 30.0) {
pickup.collected = true
collectedInZone += 1
relics += 1
pearls += 1
coins += (if (pickup.kind == 2) 30 else 15)
statusMessage = if (pickup.kind == 2) "Ancient Sea Relic collected! +30 pearls" else "Pearl collected! +15 pearls"
}
}
i += 1
}
i = 0
while (i < airBubbles.length) {
val bubble = airBubbles(i)
val bx = bubble.x - playerX
val by = bubble.y - playerY
if (!bubble.used && bx * bx + by * by < 34.0 * 34.0) {
bubble.used = true
oxygen = Math.min(100, oxygen + 35)
coins += 5
statusMessage = "Air bubble collected! Oxygen restored."
}
i += 1
}
i = 0
while (i < jellies.length) {
val jelly = jellies(i)
if (jelly.stunnedTicks > 0) jelly.stunnedTicks -= 1
else {
jelly.x += jelly.direction * (1.0 + zone * 0.18)
if (jelly.x < 280.0 || jelly.x > 830.0) jelly.direction = -jelly.direction
}
val jx = jelly.x - playerX
val jy = jelly.y - playerY
if (jx * jx + jy * jy < 28.0 * 28.0 && invulnerableTicks <= 0) {
oxygen = Math.max(0, oxygen - 12)
invulnerableTicks = 55
playerX = Math.max(70.0, playerX - 55.0)
statusMessage = "A jelly current pushed you back. Find an air bubble!"
}
i += 1
}
repaint()
}
def drawCentered(g: Graphics2D, text: String, x: Int, y: Int): Unit = {
val width = g.getFontMetrics.stringWidth(text)
g.drawString(text, x - width / 2, y)
}
def drawCoral(g: Graphics2D, x: Int, y: Int, c: Color): Unit = {
g.setColor(c)
g.setStroke(new BasicStroke(7.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND))
g.drawLine(x, y, x, y - 35)
g.drawLine(x, y - 15, x - 15, y - 29)
g.drawLine(x, y - 18, x + 16, y - 34)
g.drawLine(x - 15, y - 29, x - 22, y - 39)
g.drawLine(x + 16, y - 34, x + 22, y - 44)
}
def drawPlayer(g: Graphics2D): Unit = {
val x = playerX.toInt
val y = playerY.toInt
g.setColor(new Color(0, 15, 28, 100))
g.fillOval(x - 19, y + 18, 42, 12)
g.setColor(new Color(255, 181, 90))
g.fillOval(x - 12, y - 24, 25, 25)
g.setColor(new Color(55, 185, 205))
g.fillRoundRect(x - 17, y - 2, 34, 34, 12, 12)
g.setColor(new Color(5, 47, 70))
g.fillOval(x - 9, y - 17, 18, 14)
g.setColor(new Color(150, 245, 255))
g.drawOval(x - 9, y - 17, 18, 14)
g.setColor(new Color(252, 209, 120))
g.fillOval(x + 4, y - 12, 4, 4)
g.setColor(new Color(255, 172, 72))
g.fillOval(x - 20, y + 28, 18, 7)
g.fillOval(x + 2, y + 28, 18, 7)
g.setColor(new Color(100, 235, 246, 120))
g.fillOval(x - 23, y - 27, 46, 65)
}
override def paintComponent(g: Graphics): Unit = {
super.paintComponent(g)
val g2 = g.asInstanceOf[Graphics2D]
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
val top = zone match {
case 0 => new Color(2, 35, 67)
case 1 => new Color(12, 28, 65)
case 2 => new Color(1, 12, 42)
case _ => new Color(8, 37, 73)
}
val bottom = zone match {
case 0 => new Color(0, 118, 139)
case 1 => new Color(37, 77, 125)
case 2 => new Color(15, 34, 79)
case _ => new Color(0, 130, 153)
}
g2.setPaint(new GradientPaint(0, 0, top, 0, 720, bottom))
g2.fillRect(0, 0, getWidth, getHeight)
var b = 0
while (b < 55) {
val bx = (b * 173 + tick / 2) % 1024
val by = 100 + ((b * 89 + tick) % 500)
val size = 3 + (b % 6)
g2.setColor(new Color(170, 246, 255, 65))
g2.drawOval(bx, by, size, size)
b += 1
}
g2.setColor(new Color(12, 78, 94, 150))
g2.fillOval(-100, 515, 520, 230)
g2.fillOval(320, 530, 470, 210)
g2.fillOval(720, 520, 420, 220)
drawCoral(g2, 55, 600, new Color(255, 112, 129))
drawCoral(g2, 245, 605, new Color(255, 174, 93))
drawCoral(g2, 500, 605, new Color(106, 230, 187))
drawCoral(g2, 940, 605, new Color(242, 117, 179))
if (zone == 1 || zone == 3) {
g2.setColor(new Color(25, 71, 100, 190))
var ruin = 0
while (ruin < 4) {
val rx = 300 + ruin * 150
g2.fillRect(rx, 280 + (ruin % 2) * 35, 34, 230)
g2.fillRect(rx - 12, 270 + (ruin % 2) * 35, 58, 18)
ruin += 1
}
}
g2.setColor(new Color(72, 215, 235, 45))
g2.fillOval(720, 130, 190, 190)
g2.setColor(new Color(105, 244, 245, 170))
g2.setStroke(new BasicStroke(6.0f))
g2.drawOval(825, 300, 90, 150)
g2.setColor(new Color(180, 255, 245, 80))
g2.drawOval(835, 310, 70, 130)
var i = 0
while (i < pickups.length) {
val p = pickups(i)
if (!p.collected) {
val color = p.kind match {
case 0 => new Color(255, 222, 145)
case 1 => new Color(112, 240, 255)
case _ => new Color(220, 164, 255)
}
g2.setColor(new Color(color.getRed, color.getGreen, color.getBlue, 50))
g2.fillOval(p.x - 21, p.y - 21, 42, 42)
g2.setColor(color)
val gem = new Polygon(Array(p.x, p.x + 13, p.x + 8, p.x - 8, p.x - 13), Array(p.y - 13, p.y - 2, p.y + 13, p.y + 13, p.y - 2), 5)
g2.fillPolygon(gem)
g2.setColor(Color.WHITE)
g2.drawPolygon(gem)
}
i += 1
}
i = 0
while (i < airBubbles.length) {
val bubble = airBubbles(i)
if (!bubble.used) {
g2.setColor(new Color(120, 246, 255, 80))
g2.fillOval(bubble.x - 18, bubble.y - 18, 36, 36)
g2.setColor(new Color(210, 255, 255))
g2.drawOval(bubble.x - 18, bubble.y - 18, 36, 36)
g2.drawOval(bubble.x - 7, bubble.y - 11, 8, 8)
}
i += 1
}
i = 0
while (i < jellies.length) {
val jelly = jellies(i)
val jx = jelly.x.toInt
val jy = jelly.y.toInt
val jellyColor = if (jelly.stunnedTicks > 0) new Color(180, 255, 255) else new Color(177, 137, 255)
g2.setColor(new Color(166, 134, 255, 55))
g2.fillOval(jx - 25, jy - 25, 50, 50)
g2.setColor(jellyColor)
g2.fillOval(jx - 15, jy - 13, 30, 25)
g2.setStroke(new BasicStroke(3.0f))
g2.drawLine(jx - 10, jy + 8, jx - 15, jy + 22)
g2.drawLine(jx, jy + 10, jx, jy + 25)
g2.drawLine(jx + 10, jy + 8, jx + 15, jy + 22)
g2.setColor(new Color(20, 33, 73))
g2.fillOval(jx - 7, jy - 3, 4, 4)
g2.fillOval(jx + 3, jy - 3, 4, 4)
i += 1
}
if (pulseTicks > 0) {
g2.setColor(new Color(145, 250, 255, 100))
g2.setStroke(new BasicStroke(5.0f))
g2.drawOval(playerX.toInt - (pulseTicks * 5), playerY.toInt - (pulseTicks * 5), pulseTicks * 10, pulseTicks * 10)
}
drawPlayer(g2)
g2.setColor(new Color(0, 18, 38, 190))
g2.fillRoundRect(18, 14, 988, 94, 22, 22)
g2.setColor(new Color(145, 239, 247))
g2.setFont(new Font("SansSerif", Font.BOLD, 19))
g2.drawString("ABYSSAL KINGDOM", 38, 43)
g2.setFont(new Font("SansSerif", Font.BOLD, 14))
g2.drawString("DIVER: " + playerName, 40, 72)
g2.drawString("ZONE " + (zone + 1) + "/4 - " + zoneNames(zone), 300, 43)
g2.drawString("PEARLS: " + pearls + " COINS: " + coins + " RELICS: " + relics, 300, 72)
g2.setColor(new Color(28, 64, 78))
g2.fillRoundRect(790, 30, 190, 18, 9, 9)
g2.setColor(if (oxygen > 35) new Color(58, 220, 214) else new Color(255, 140, 105))
g2.fillRoundRect(790, 30, oxygen * 19 / 10, 18, 9, 9)
g2.setColor(Color.WHITE)
g2.setFont(new Font("SansSerif", Font.BOLD, 12))
g2.drawString("OXYGEN " + oxygen + "%", 835, 25)
g2.drawString("AIR: " + lives, 900, 75)
g2.setColor(new Color(0, 18, 36, 190))
g2.fillRoundRect(22, 620, 555, 76, 15, 15)
g2.setColor(new Color(198, 245, 248))
g2.setFont(new Font("SansSerif", Font.BOLD, 13))
g2.drawString("TREASURES: " + collectedInZone + "/5 NEXT GATE: " + (if (collectedInZone >= 5) "READY" else "LOCKED"), 38, 646)
g2.setFont(new Font("SansSerif", Font.PLAIN, 12))
g2.drawString(statusMessage, 38, 674)
if (zone == 3 && collectedInZone >= 5) {
g2.setColor(new Color(255, 224, 153, 210))
drawCentered(g2, "PEARL GUARDIAN SHIELDS: " + guardianShields + " | USE BUBBLE PULSE", 510, 145)
}
if (paused || gameOver || victory) {
g2.setColor(new Color(0, 9, 24, 205))
g2.fillRect(0, 0, getWidth, getHeight)
g2.setColor(if (victory) new Color(163, 255, 230) else Color.WHITE)
g2.setFont(new Font("Serif", Font.BOLD, 42))
val message = if (victory) "THE ABYSSAL KINGDOM IS RESTORED!" else if (gameOver) "DIVE OVER" else "PAUSED"
drawCentered(g2, message, 512, 330)
g2.setFont(new Font("SansSerif", Font.PLAIN, 18))
drawCentered(g2, if (victory || gameOver) "Press R to play again" else "Press P or ESC to resume", 512, 375)
}
}
}
// Start the game when the complete Kojo script is run.
AbyssalKingdomSecretsOfTheDeepEvent03.main(Array[String]())