Code Sketch
Bixuu TITANVERSE: AGE OF LEGENDS event 1
Category: Programming
import java.awt.{BasicStroke, BorderLayout, Color, Dimension, Font, Graphics, Graphics2D, GradientPaint, RenderingHints}
import java.awt.event.{ActionEvent, ActionListener, KeyEvent, MouseAdapter, MouseEvent}
import java.awt.geom.{Ellipse2D, RoundRectangle2D}
import javax.swing.{AbstractAction, BorderFactory, JButton, JFrame, JLabel, JPanel, JComponent, JTextField, KeyStroke, SwingConstants, SwingUtilities, Timer, WindowConstants}
import scala.collection.mutable.ArrayBuffer
object PrimalTitansLostCivilizationEvent01 {
var mainFrame: JFrame = null
var activeGame: TitanGamePanel = null
val bgDark = new Color(10, 19, 25)
val gold = new Color(239, 190, 91)
val mint = new Color(103, 224, 173)
val textLight = new Color(237, 244, 236)
def makeButton(title: String): JButton = {
val b = new JButton(title)
b.setFont(new Font("SansSerif", Font.BOLD, 14))
b.setForeground(textLight)
b.setBackground(new Color(39, 72, 65))
b.setFocusPainted(false)
b.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(116, 193, 148), 1),
BorderFactory.createEmptyBorder(9, 16, 9, 16)
))
b
}
def makeLabel(value: String, size: Int, color: Color): JLabel = {
val l = new JLabel(value, SwingConstants.CENTER)
l.setFont(new Font("SansSerif", Font.BOLD, size))
l.setForeground(color)
l
}
def main(args: Array[String]): Unit = {
SwingUtilities.invokeLater(new Runnable {
def run(): Unit = {
mainFrame = new JFrame("TITANVERSE: AGE OF LEGENDS | PRIMAL TITANS")
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
mainFrame.setSize(1120, 790)
mainFrame.setMinimumSize(new Dimension(900, 680))
mainFrame.setLocationRelativeTo(null)
showLogin()
mainFrame.setVisible(true)
}
})
}
def showLogin(): Unit = {
val root = new JPanel(new BorderLayout(12, 12))
root.setBackground(bgDark)
root.setBorder(BorderFactory.createEmptyBorder(28, 40, 28, 40))
val title = makeLabel("TITANVERSE: AGE OF LEGENDS", 30, gold)
val subtitle = makeLabel("EVENT 01 ? PRIMAL TITANS: LOST CIVILIZATION", 18, mint)
val story = makeLabel("Explore a forgotten world. Awaken the ancient creatures. Restore the Titan civilization.", 14, textLight)
val header = new JPanel(new BorderLayout(4, 9))
header.setOpaque(false)
header.add(title, BorderLayout.NORTH)
header.add(subtitle, BorderLayout.CENTER)
header.add(story, BorderLayout.SOUTH)
val center = new LoginArtworkPanel()
center.setPreferredSize(new Dimension(850, 440))
val bottom = new JPanel()
bottom.setOpaque(false)
val nameField = new JTextField(18)
nameField.setFont(new Font("SansSerif", Font.PLAIN, 17))
nameField.setForeground(new Color(25, 42, 36))
nameField.setPreferredSize(new Dimension(220, 38))
val startButton = makeButton("ENTER THE LOST CIVILIZATION")
val nameLabel = makeLabel("YOUR EXPLORER NAME:", 13, textLight)
bottom.add(nameLabel)
bottom.add(nameField)
bottom.add(startButton)
startButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = {
val entered = nameField.getText.trim
val player = if (entered.length == 0) "Explorer" else entered
showGame(player)
}
})
nameField.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = startButton.doClick()
})
root.add(header, BorderLayout.NORTH)
root.add(center, BorderLayout.CENTER)
root.add(bottom, BorderLayout.SOUTH)
mainFrame.setContentPane(root)
mainFrame.revalidate()
mainFrame.repaint()
}
def showGame(playerName: String): Unit = {
if (activeGame != null) activeGame.stopGame()
val root = new JPanel(new BorderLayout(8, 8))
root.setBackground(bgDark)
root.setBorder(BorderFactory.createEmptyBorder(10, 12, 10, 12))
val hud = new JPanel(new BorderLayout(8, 4))
hud.setBackground(new Color(18, 35, 39))
hud.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(new Color(100, 164, 129)),
BorderFactory.createEmptyBorder(8, 12, 8, 12)
))
val playerLabel = makeLabel("EXPLORER: " + playerName, 14, gold)
playerLabel.setHorizontalAlignment(SwingConstants.LEFT)
val statsLabel = makeLabel("REALM 1 | HEALTH 100 | RELICS 0/3 | COINS 0", 14, textLight)
hud.add(playerLabel, BorderLayout.WEST)
hud.add(statsLabel, BorderLayout.CENTER)
activeGame = new TitanGamePanel(playerName, new Runnable {
def run(): Unit = {
if (activeGame != null) statsLabel.setText(activeGame.statusText())
}
})
val controls = new JPanel()
controls.setBackground(new Color(13, 27, 32))
val pulseButton = makeButton("ANCIENT ROAR [SPACE]")
val shieldButton = makeButton("TITAN SHIELD [Q]")
val interactButton = makeButton("INTERACT [E]")
val pauseButton = makeButton("PAUSE [P]")
val backButton = makeButton("BACK TO LOGIN [B]")
controls.add(pulseButton)
controls.add(shieldButton)
controls.add(interactButton)
controls.add(pauseButton)
controls.add(backButton)
pulseButton.addActionListener(new ActionListener { def actionPerformed(e: ActionEvent): Unit = activeGame.useRoar() })
shieldButton.addActionListener(new ActionListener { def actionPerformed(e: ActionEvent): Unit = activeGame.useShield() })
interactButton.addActionListener(new ActionListener { def actionPerformed(e: ActionEvent): Unit = activeGame.interact() })
pauseButton.addActionListener(new ActionListener { def actionPerformed(e: ActionEvent): Unit = activeGame.togglePause() })
backButton.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = {
if (activeGame != null) activeGame.stopGame()
activeGame = null
showLogin()
}
})
root.add(hud, BorderLayout.NORTH)
root.add(activeGame, BorderLayout.CENTER)
root.add(controls, BorderLayout.SOUTH)
mainFrame.setContentPane(root)
mainFrame.revalidate()
mainFrame.repaint()
activeGame.requestFocusInWindow()
}
class LoginArtworkPanel extends JPanel {
setOpaque(true)
setBackground(new Color(12, 26, 31))
override def paintComponent(graphics: Graphics): Unit = {
super.paintComponent(graphics)
val g = graphics.create().asInstanceOf[Graphics2D]
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
val w = getWidth
val h = getHeight
g.setPaint(new GradientPaint(0, 0, new Color(21, 53, 55), 0, h, new Color(10, 19, 26)))
g.fillRect(0, 0, w, h)
g.setColor(new Color(46, 83, 69))
var i = 0
while (i < 9) {
val x = i * (w / 8) - 35
val height = 90 + ((i * 37) % 120)
val pointsX = Array(x, x + 45, x + 90)
val pointsY = Array(h - 30, h - height - 75, h - 30)
g.fillPolygon(pointsX, pointsY, 3)
i += 1
}
g.setColor(new Color(106, 195, 140, 110))
g.fillOval(w / 2 - 150, h / 2 - 120, 300, 300)
g.setColor(new Color(237, 190, 91))
g.setStroke(new BasicStroke(6f))
g.drawOval(w / 2 - 110, h / 2 - 80, 220, 220)
g.setStroke(new BasicStroke(2f))
g.setColor(new Color(196, 237, 190))
g.fillOval(w / 2 - 23, h / 2 - 23, 46, 46)
g.setFont(new Font("Serif", Font.BOLD, 25))
g.setColor(new Color(246, 220, 153))
g.drawString("THE ANCIENT WORLD IS CALLING", w / 2 - 205, h - 24)
g.dispose()
}
}
class TitanRelic(var x: Double, var y: Double, val kind: Int) {
var collected = false
}
class WildCreature(var x: Double, var y: Double, val kind: Int) {
var stun = 0.0
var phase = 0.0
}
class TitanGamePanel(val explorerName: String, val changed: Runnable) extends JPanel {
setFocusable(true)
setPreferredSize(new Dimension(1000, 620))
setBackground(new Color(16, 39, 40))
val realmNames = Array("MOSSROOT VALLEY", "EMBERFANG RUINS", "TIDAL CAVERN", "SKY-TITAN SANCTUM")
val realmDescriptions = Array("The green valley of the first guardians", "A volcanic city guarded by stone beasts", "A flooded temple of the ancient sea", "The final home of the sky titans")
val realmColors = Array(new Color(81, 163, 106), new Color(212, 112, 66), new Color(63, 153, 190), new Color(150, 133, 205))
var realm = 0
var health = 100
var coins = 0
var relicCount = 0
var energy = 100
var playerX = 105.0
var playerY = 300.0
var targetX = -1.0
var targetY = -1.0
var moveUp = false
var moveDown = false
var moveLeft = false
var moveRight = false
var paused = false
var victory = false
var shieldTime = 0.0
var roarCooldown = 0.0
var damageCooldown = 0.0
var message = "Find 3 Titan Relics, then awaken the Totem!"
var gameTicks = 0
var bossHealth = 5
var finalBoss = false
val relics = ArrayBuffer[TitanRelic]()
val creatures = ArrayBuffer[WildCreature]()
val keysDown = scala.collection.mutable.Set[Int]()
def loadRealm(): Unit = {
relics.clear()
creatures.clear()
relicCount = 0
playerX = 105.0
playerY = 300.0
targetX = -1.0
targetY = -1.0
health = 100
energy = 100
finalBoss = false
if (realm == 0) {
relics += new TitanRelic(285, 180, 0)
relics += new TitanRelic(535, 440, 1)
relics += new TitanRelic(760, 185, 2)
creatures += new WildCreature(430, 180, 0)
creatures += new WildCreature(660, 420, 1)
} else if (realm == 1) {
relics += new TitanRelic(260, 425, 1)
relics += new TitanRelic(510, 175, 2)
relics += new TitanRelic(770, 405, 0)
creatures += new WildCreature(440, 330, 1)
creatures += new WildCreature(690, 190, 0)
creatures += new WildCreature(820, 480, 1)
} else if (realm == 2) {
relics += new TitanRelic(250, 180, 2)
relics += new TitanRelic(520, 450, 0)
relics += new TitanRelic(790, 190, 1)
creatures += new WildCreature(435, 250, 0)
creatures += new WildCreature(710, 430, 1)
} else {
relics += new TitanRelic(250, 420, 0)
relics += new TitanRelic(500, 160, 1)
relics += new TitanRelic(775, 420, 2)
creatures += new WildCreature(430, 340, 0)
creatures += new WildCreature(700, 200, 1)
}
changed.run()
repaint()
}
loadRealm()
val gameTimer = new Timer(30, new ActionListener {
def actionPerformed(e: ActionEvent): Unit = tickGame()
})
gameTimer.start()
def stopGame(): Unit = gameTimer.stop()
def statusText(): String = {
val name = if (realm >= 0 && realm < 4) realmNames(realm) else "INFINITY ARENA"
"" + name + " | HEALTH " + health + " | RELICS " + relicCount + "/3 | COINS " + coins + " | ENERGY " + energy
}
def bindKey(code: Int, label: String)(action: => Unit): Unit = {
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(code, 0), label)
getActionMap.put(label, new AbstractAction {
def actionPerformed(e: ActionEvent): Unit = action
})
}
def bindKeyRelease(code: Int, label: String)(action: => Unit): Unit = {
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(code, 0, true), label)
getActionMap.put(label, new AbstractAction {
def actionPerformed(e: ActionEvent): Unit = action
})
}
bindKey(KeyEvent.VK_W, "moveUp") { moveUp = true; targetX = -1.0 }
bindKey(KeyEvent.VK_S, "moveDown") { moveDown = true; targetX = -1.0 }
bindKey(KeyEvent.VK_A, "moveLeft") { moveLeft = true; targetX = -1.0 }
bindKey(KeyEvent.VK_D, "moveRight") { moveRight = true; targetX = -1.0 }
bindKey(KeyEvent.VK_UP, "arrowUp") { moveUp = true; targetX = -1.0 }
bindKey(KeyEvent.VK_DOWN, "arrowDown") { moveDown = true; targetX = -1.0 }
bindKey(KeyEvent.VK_LEFT, "arrowLeft") { moveLeft = true; targetX = -1.0 }
bindKey(KeyEvent.VK_RIGHT, "arrowRight") { moveRight = true; targetX = -1.0 }
bindKeyRelease(KeyEvent.VK_W, "stopMoveUp") { moveUp = false }
bindKeyRelease(KeyEvent.VK_S, "stopMoveDown") { moveDown = false }
bindKeyRelease(KeyEvent.VK_A, "stopMoveLeft") { moveLeft = false }
bindKeyRelease(KeyEvent.VK_D, "stopMoveRight") { moveRight = false }
bindKeyRelease(KeyEvent.VK_UP, "stopArrowUp") { moveUp = false }
bindKeyRelease(KeyEvent.VK_DOWN, "stopArrowDown") { moveDown = false }
bindKeyRelease(KeyEvent.VK_LEFT, "stopArrowLeft") { moveLeft = false }
bindKeyRelease(KeyEvent.VK_RIGHT, "stopArrowRight") { moveRight = false }
bindKey(KeyEvent.VK_SPACE, "ancientRoar") { useRoar() }
bindKey(KeyEvent.VK_Q, "titanShield") { useShield() }
bindKey(KeyEvent.VK_E, "interact") { interact() }
bindKey(KeyEvent.VK_P, "pauseGame") { togglePause() }
bindKey(KeyEvent.VK_B, "backLogin") { returnToLogin() }
addMouseListener(new MouseAdapter {
override def mousePressed(e: MouseEvent): Unit = {
if (!paused && !victory) {
targetX = e.getX.toDouble
targetY = e.getY.toDouble
requestFocusInWindow()
}
}
})
def returnToLogin(): Unit = {
stopGame()
activeGame = null
showLogin()
}
def togglePause(): Unit = {
paused = !paused
if (paused) message = "PAUSED ? press P to continue" else message = "The ancient world awaits!"
repaint()
}
def useRoar(): Unit = {
if (!paused && energy >= 20 && roarCooldown <= 0.0) {
energy -= 20
roarCooldown = 1.5
var i = 0
while (i < creatures.length) {
val dx = creatures(i).x - playerX
val dy = creatures(i).y - playerY
if (Math.sqrt(dx * dx + dy * dy) < 175.0) creatures(i).stun = 2.2
i += 1
}
if (finalBoss) bossHealth -= 1
message = "ANCIENT ROAR! Nearby creatures are stunned."
changed.run()
repaint()
} else if (energy < 20) {
message = "Not enough energy for Ancient Roar!"
}
}
def useShield(): Unit = {
if (!paused && energy >= 25) {
energy -= 25
shieldTime = 3.5
message = "TITAN SHIELD ACTIVE!"
changed.run()
repaint()
} else {
message = "Need 25 energy to activate the shield."
}
}
def interact(): Unit = {
if (paused || victory) return
var found = false
var i = 0
while (i < relics.length && !found) {
val r = relics(i)
val dx = r.x - playerX
val dy = r.y - playerY
if (!r.collected && Math.sqrt(dx * dx + dy * dy) < 58.0) {
r.collected = true
relicCount += 1
coins += 25
energy = Math.min(100, energy + 12)
message = "ANCIENT RELIC COLLECTED! +25 COINS"
found = true
}
i += 1
}
if (!found && relicCount >= 3 && playerX > getWidth - 165 && playerY > getHeight - 170) {
awakenRealm()
found = true
}
if (!found && relicCount >= 3) message = "Go to the glowing TOTEM at the lower-right and press E."
if (!found && relicCount < 3) message = "Find all 3 Ancient Relics first. Walk close and press E."
changed.run()
repaint()
}
def awakenRealm(): Unit = {
if (realm < 3) {
coins += 100
val awakened = realmNames(realm)
realm += 1
message = "TITAN AWAKENED IN " + awakened + "! +100 COINS"
loadRealm()
} else {
finalBoss = true
bossHealth = 5
message = "THE INFINITY TITAN HAS AWAKENED! Use Ancient Roar near it."
creatures.clear()
creatures += new WildCreature(720, 300, 2)
realm = 4
repaint()
}
}
def tickGame(): Unit = {
if (paused || victory) return
gameTicks += 1
val step = 4.0 + (coins / 150).min(2)
var dx = 0.0
var dy = 0.0
if (moveUp) dy -= step
if (moveDown) dy += step
if (moveLeft) dx -= step
if (moveRight) dx += step
if (dx == 0.0 && dy == 0.0 && targetX >= 0.0) {
val tx = targetX - playerX
val ty = targetY - playerY
val dist = Math.sqrt(tx * tx + ty * ty)
if (dist > 5.0) {
dx = (tx / dist) * step
dy = (ty / dist) * step
} else {
targetX = -1.0
}
}
val moveLength = Math.sqrt(dx * dx + dy * dy)
if (moveLength > 0.0) {
playerX += dx / moveLength * step
playerY += dy / moveLength * step
}
playerX = Math.max(32.0, Math.min(getWidth - 32.0, playerX))
playerY = Math.max(60.0, Math.min(getHeight - 35.0, playerY))
if (energy < 100 && gameTicks % 8 == 0) energy += 1
if (shieldTime > 0.0) shieldTime -= 0.03
if (roarCooldown > 0.0) roarCooldown -= 0.03
if (damageCooldown > 0.0) damageCooldown -= 0.03
var i = 0
while (i < creatures.length) {
val c = creatures(i)
if (c.stun > 0.0) c.stun -= 0.03
else {
val ex = playerX - c.x
val ey = playerY - c.y
val dist = Math.sqrt(ex * ex + ey * ey)
if (dist > 1.0) {
val speed = if (finalBoss) 1.5 else 0.85
c.x += (ex / dist) * speed
c.y += (ey / dist) * speed
}
if (dist < 34.0 && damageCooldown <= 0.0 && shieldTime <= 0.0) {
health -= 8
damageCooldown = 1.0
message = "A WILD CREATURE TOUCHED YOU! Find the relics and keep moving."
}
}
i += 1
}
if (finalBoss && bossHealth <= 0) {
victory = true
message = "VICTORY! THE LOST CIVILIZATION IS RESTORED!"
}
if (health <= 0) {
health = 100
playerX = 105.0
playerY = 300.0
coins = Math.max(0, coins - 20)
message = "You were returned to the sanctuary. 20 coins were used for recovery."
}
if (gameTicks % 4 == 0) changed.run()
repaint()
}
override def paintComponent(graphics: Graphics): Unit = {
super.paintComponent(graphics)
val g = graphics.create().asInstanceOf[Graphics2D]
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
val w = getWidth
val h = getHeight
val baseColor = if (realm >= 0 && realm < 4) realmColors(realm) else new Color(224, 182, 90)
val darker = new Color(Math.max(0, baseColor.getRed - 55), Math.max(0, baseColor.getGreen - 55), Math.max(0, baseColor.getBlue - 55))
g.setPaint(new GradientPaint(0, 0, darker, 0, h, new Color(9, 22, 27)))
g.fillRect(0, 0, w, h)
// distant mountains and ancient ruins
g.setColor(new Color(15, 35, 36, 180))
var m = 0
while (m < 8) {
val x = m * (w / 7) - 50
val mx = Array(x, x + 95, x + 190)
val my = Array(h - 45, h - 235 - ((m * 23) % 80), h - 45)
g.fillPolygon(mx, my, 3)
m += 1
}
g.setColor(new Color(180, 206, 153, 45))
var grid = 0
while (grid < w) {
g.drawLine(grid, 0, grid, h)
grid += 70
}
grid = 0
while (grid < h) {
g.drawLine(0, grid, w, grid)
grid += 70
}
// Ancient stone pillars
g.setColor(new Color(53, 65, 58))
g.fillRoundRect(35, 105, 48, 180, 10, 10)
g.fillRoundRect(w - 85, 110, 48, 180, 10, 10)
g.setColor(new Color(191, 162, 103))
g.drawRoundRect(35, 105, 48, 180, 10, 10)
g.drawRoundRect(w - 85, 110, 48, 180, 10, 10)
// glowing gate / totem at bottom-right
g.setColor(new Color(238, 198, 98, 55))
g.fillOval(w - 180, h - 180, 135, 135)
g.setColor(new Color(241, 205, 117))
g.setStroke(new BasicStroke(4f))
g.drawOval(w - 165, h - 165, 105, 105)
g.drawOval(w - 151, h - 151, 77, 77)
g.setFont(new Font("SansSerif", Font.BOLD, 12))
g.drawString(if (relicCount >= 3) "PRESS E: AWAKEN" else "TOTEM", w - 170, h - 22)
// realm trees / crystals
var tree = 0
while (tree < 7) {
val tx = 125 + tree * 125
val ty = 95 + ((tree * 79) % Math.max(100, h - 240))
g.setColor(new Color(53, 59, 43, 220))
g.fillRoundRect(tx - 5, ty, 10, 38, 4, 4)
g.setColor(new Color(43, 104 + (tree * 7) % 80, 76))
g.fillOval(tx - 26, ty - 27, 52, 45)
tree += 1
}
// relics
var i = 0
while (i < relics.length) {
val r = relics(i)
if (!r.collected) {
val relicColor = if (r.kind == 0) new Color(117, 232, 177) else if (r.kind == 1) new Color(239, 155, 91) else new Color(135, 199, 244)
g.setColor(new Color(relicColor.getRed, relicColor.getGreen, relicColor.getBlue, 55))
g.fillOval(r.x.toInt - 23, r.y.toInt - 23, 46, 46)
g.setColor(relicColor)
val px = Array(r.x.toInt, r.x.toInt + 13, r.x.toInt, r.x.toInt - 13)
val py = Array(r.y.toInt - 17, r.y.toInt, r.y.toInt + 17, r.y.toInt)
g.fillPolygon(px, py, 4)
g.setColor(Color.WHITE)
g.drawString("RELIC", r.x.toInt - 17, r.y.toInt + 31)
}
i += 1
}
// wild ancient creatures
i = 0
while (i < creatures.length) {
val c = creatures(i)
val beastColor = if (c.stun > 0.0) new Color(164, 221, 255) else new Color(181, 103, 81)
g.setColor(new Color(beastColor.getRed, beastColor.getGreen, beastColor.getBlue, 55))
g.fillOval(c.x.toInt - 29, c.y.toInt - 24, 58, 48)
g.setColor(beastColor)
g.fillOval(c.x.toInt - 22, c.y.toInt - 17, 44, 34)
g.fillOval(c.x.toInt + 12, c.y.toInt - 12, 20, 18)
g.setColor(new Color(255, 228, 154))
g.fillOval(c.x.toInt + 16, c.y.toInt - 7, 4, 4)
g.setColor(new Color(50, 38, 32))
g.drawLine(c.x.toInt - 12, c.y.toInt + 13, c.x.toInt - 15, c.y.toInt + 25)
g.drawLine(c.x.toInt + 8, c.y.toInt + 13, c.x.toInt + 11, c.y.toInt + 25)
i += 1
}
// player explorer
if (shieldTime > 0.0) {
g.setColor(new Color(107, 222, 236, 75))
g.fillOval(playerX.toInt - 33, playerY.toInt - 36, 66, 66)
g.setColor(new Color(135, 233, 246))
g.setStroke(new BasicStroke(3f))
g.drawOval(playerX.toInt - 33, playerY.toInt - 36, 66, 66)
}
g.setColor(new Color(28, 37, 34))
g.fillRoundRect(playerX.toInt - 13, playerY.toInt - 5, 26, 30, 9, 9)
g.setColor(new Color(241, 200, 127))
g.fillOval(playerX.toInt - 11, playerY.toInt - 24, 22, 22)
g.setColor(new Color(91, 141, 112))
g.fillRoundRect(playerX.toInt - 15, playerY.toInt + 15, 10, 17, 5, 5)
g.fillRoundRect(playerX.toInt + 5, playerY.toInt + 15, 10, 17, 5, 5)
g.setColor(Color.WHITE)
g.drawString(explorerName, playerX.toInt - 25, playerY.toInt - 32)
// information strip
g.setColor(new Color(4, 14, 18, 190))
g.fillRoundRect(12, 12, 410, 58, 12, 12)
g.setColor(textLight)
g.setFont(new Font("SansSerif", Font.BOLD, 14))
val realmTitle = if (realm < 4) realmNames(realm) else "INFINITY TITAN ARENA"
g.drawString(realmTitle, 25, 35)
g.setFont(new Font("SansSerif", Font.PLAIN, 12))
g.drawString("HP " + health + " ENERGY " + energy + " RELICS " + relicCount + "/3", 25, 55)
g.setColor(new Color(4, 14, 18, 195))
g.fillRoundRect(12, h - 54, w - 24, 40, 10, 10)
g.setColor(new Color(248, 219, 151))
g.setFont(new Font("SansSerif", Font.BOLD, 13))
g.drawString(message, 24, h - 29)
if (finalBoss) {
g.setColor(new Color(15, 10, 20, 210))
g.fillRoundRect(w / 2 - 110, 18, 220, 54, 10, 10)
g.setColor(new Color(249, 127, 103))
g.drawString("INFINITY TITAN " + Math.max(0, bossHealth) + "/5", w / 2 - 75, 49)
}
if (paused) {
g.setColor(new Color(0, 0, 0, 165))
g.fillRect(0, 0, w, h)
g.setColor(Color.WHITE)
g.setFont(new Font("SansSerif", Font.BOLD, 38))
g.drawString("PAUSED", w / 2 - 75, h / 2)
}
if (victory) {
g.setColor(new Color(0, 0, 0, 185))
g.fillRect(0, 0, w, h)
g.setColor(new Color(255, 220, 133))
g.setFont(new Font("Serif", Font.BOLD, 36))
g.drawString("THE TITANS HAVE AWAKENED!", w / 2 - 260, h / 2 - 10)
g.setFont(new Font("SansSerif", Font.PLAIN, 18))
g.setColor(Color.WHITE)
g.drawString("You restored the Lost Civilization. Press B to return.", w / 2 - 220, h / 2 + 30)
}
g.dispose()
}
}
}
PrimalTitansLostCivilizationEvent01.main(Array[String]())