Code Sketch
Bixuu SkyboundOdysseyEvent04
Category: Programming
import java.awt.{BasicStroke, BorderLayout, Color, Dimension, Font, Graphics, Graphics2D, GradientPaint, Polygon, RenderingHints}
import java.awt.event.{ActionEvent, ActionListener, KeyEvent, KeyListener, MouseAdapter, MouseEvent, WindowAdapter, WindowEvent}
import javax.swing.{BorderFactory, JButton, JFrame, JLabel, JPanel, JTextField, SwingConstants, SwingUtilities, Timer, WindowConstants}
import scala.collection.mutable.ArrayBuffer
object SkyboundOdysseyEvent04 {
def main(args: Array[String]): Unit = {
SwingUtilities.invokeLater(new Runnable {
def run(): Unit = {
val frame = new SkyboundAppFrame()
frame.setVisible(true)
}
})
}
}
class SkyboundAppFrame extends JFrame("TITANVERSE: AGE OF LEGENDS | SKYBOUND ODYSSEY") {
private val cards = new java.awt.CardLayout()
private val root = new JPanel(cards)
private val dark = new Color(8, 20, 46)
private val cyan = new Color(113, 239, 255)
private val gold = new Color(255, 211, 119)
private val white = new Color(240, 249, 255)
private var playerName = "SKY EXPLORER"
private var gamePanel: SkyboundGamePanel = null
private val loginPanel = new JPanel(new BorderLayout(12, 12))
private val nameField = new JTextField(18)
buildLogin()
root.add(loginPanel, "LOGIN")
setContentPane(root)
setSize(1100, 760)
setMinimumSize(new Dimension(900, 650))
setLocationRelativeTo(null)
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
addWindowListener(new WindowAdapter {
override def windowClosing(e: WindowEvent): Unit = {
if (gamePanel != null) gamePanel.stopGame()
}
})
cards.show(root, "LOGIN")
private def styleButton(button: JButton): Unit = {
button.setFont(new Font("SansSerif", Font.BOLD, 15))
button.setForeground(white)
button.setBackground(new Color(22, 68, 105))
button.setFocusPainted(false)
button.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(cyan, 1),
BorderFactory.createEmptyBorder(10, 18, 10, 18)
))
}
private def makeLabel(text: String, size: Int, color: Color): JLabel = {
val label = new JLabel(text, SwingConstants.CENTER)
label.setFont(new Font("SansSerif", Font.BOLD, size))
label.setForeground(color)
label
}
private def buildLogin(): Unit = {
loginPanel.setBackground(dark)
loginPanel.setBorder(BorderFactory.createEmptyBorder(28, 35, 28, 35))
val header = new JPanel(new BorderLayout(5, 9))
header.setOpaque(false)
header.add(makeLabel("TITANVERSE: AGE OF LEGENDS", 27, gold), BorderLayout.NORTH)
header.add(makeLabel("EVENT 04 | SKYBOUND ODYSSEY: BEYOND THE CLOUDS", 21, cyan), BorderLayout.CENTER)
header.add(makeLabel("Explore floating islands. Ride the wind. Restore the Skyheart.", 15, white), BorderLayout.SOUTH)
loginPanel.add(header, BorderLayout.NORTH)
val art = new SkyLoginArtwork()
art.setPreferredSize(new Dimension(900, 430))
loginPanel.add(art, BorderLayout.CENTER)
val bottom = new JPanel()
bottom.setOpaque(false)
val prompt = makeLabel("EXPLORER NAME:", 14, white)
nameField.setFont(new Font("SansSerif", Font.PLAIN, 17))
nameField.setPreferredSize(new Dimension(230, 38))
nameField.setText("SkyExplorer")
val start = new JButton("BEGIN EXPEDITION")
styleButton(start)
start.addActionListener(new ActionListener {
def actionPerformed(e: ActionEvent): Unit = beginGame()
})
bottom.add(prompt)
bottom.add(nameField)
bottom.add(start)
loginPanel.add(bottom, BorderLayout.SOUTH)
}
private def beginGame(): Unit = {
val raw = nameField.getText
if (raw != null && raw.trim.length > 0) playerName = raw.trim.take(18)
if (gamePanel != null) gamePanel.stopGame()
gamePanel = new SkyboundGamePanel(playerName, new Runnable {
def run(): Unit = showMenuAgain()
})
root.add(gamePanel, "GAME")
cards.show(root, "GAME")
gamePanel.startGame()
gamePanel.requestFocusInWindow()
}
private def showMenuAgain(): Unit = {
if (gamePanel != null) gamePanel.stopGame()
cards.show(root, "LOGIN")
nameField.setText(playerName)
}
}
class SkyLoginArtwork extends JPanel {
setOpaque(true)
setBackground(new Color(12, 29, 63))
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(10, 26, 67), 0, h, new Color(56, 127, 170)))
g.fillRect(0, 0, w, h)
g.setColor(new Color(255, 255, 255, 190))
var i = 0
while (i < 55) {
val x = (i * 137 + 41) % math.max(1, w)
val y = (i * 71 + 19) % math.max(1, h)
g.fillOval(x, y, 2 + (i % 3), 2 + (i % 3))
i += 1
}
drawCloud(g, 95, 90, 1.0)
drawCloud(g, w - 230, 120, 1.25)
drawIsland(g, w / 2 - 150, h / 2 + 75, 300, 100)
g.setColor(new Color(100, 248, 255, 210))
g.setFont(new Font("SansSerif", Font.BOLD, 27))
g.drawString("BEYOND THE CLOUDS", w / 2 - 155, 80)
g.setFont(new Font("SansSerif", Font.PLAIN, 15))
g.setColor(Color.WHITE)
g.drawString("4 SKY REALMS ? 16 SKY SHARDS ? 1 STORM GUARDIAN", w / 2 - 222, 112)
g.dispose()
}
private def drawCloud(g: Graphics2D, x: Int, y: Int, scale: Double): Unit = {
g.setColor(new Color(224, 247, 255, 190))
g.fillOval(x, y + 18, (75 * scale).toInt, (35 * scale).toInt)
g.fillOval(x + (22 * scale).toInt, y, (75 * scale).toInt, (55 * scale).toInt)
g.fillOval(x + (58 * scale).toInt, y + 15, (78 * scale).toInt, (38 * scale).toInt)
}
private def drawIsland(g: Graphics2D, x: Int, y: Int, width: Int, height: Int): Unit = {
val top = new Polygon()
top.addPoint(x, y + 25)
top.addPoint(x + width / 5, y)
top.addPoint(x + width * 4 / 5, y)
top.addPoint(x + width, y + 25)
top.addPoint(x + width * 3 / 4, y + 56)
top.addPoint(x + width / 4, y + 56)
g.setColor(new Color(52, 115, 93))
g.fillPolygon(top)
val rock = new Polygon()
rock.addPoint(x + 25, y + 43)
rock.addPoint(x + width - 25, y + 43)
rock.addPoint(x + width / 2, y + height)
g.setColor(new Color(57, 78, 112))
g.fillPolygon(rock)
g.setColor(new Color(114, 238, 207))
g.fillOval(x + width / 2 - 16, y - 18, 32, 32)
g.setColor(new Color(255, 218, 128))
g.fillOval(x + width / 2 - 7, y - 9, 14, 14)
}
}
case class SkyShard(var x: Double, var y: Double, var collected: Boolean)
case class SkyWisp(var x: Double, var y: Double, var phase: Double, var stunned: Int)
class SkyboundGamePanel(val explorerName: String, val backAction: Runnable) extends JPanel with KeyListener {
private val timer = new Timer(30, new ActionListener {
def actionPerformed(e: ActionEvent): Unit = updateGame()
})
private val regionNames = List("CLOUDHAVEN ISLES", "ZEPHYR PEAKS", "AURORA SKYBRIDGE", "STORMHEART CITADEL")
private val regionColors = List(new Color(106, 235, 221), new Color(157, 208, 255), new Color(226, 177, 255), new Color(255, 202, 126))
private val shardPositions = List(
List((170.0, 165.0), (370.0, 410.0), (635.0, 190.0), (820.0, 430.0)),
List((140.0, 420.0), (335.0, 160.0), (620.0, 420.0), (850.0, 170.0)),
List((175.0, 190.0), (420.0, 410.0), (690.0, 170.0), (845.0, 390.0)),
List((145.0, 390.0), (365.0, 165.0), (645.0, 395.0), (835.0, 170.0))
)
private val shards = ArrayBuffer[SkyShard]()
private val wisps = ArrayBuffer[SkyWisp]()
private var region = 0
private var playerX = 95.0
private var playerY = 520.0
private var coins = 0
private var totalShards = 0
private var lives = 5
private var energy = 100
private var dashTicks = 0
private var shieldTicks = 0
private var pulseTicks = 0
private var hitCooldown = 0
private var paused = false
private var won = false
private var lost = false
private var rescueDone = false
private var rescueX = 520.0
private var rescueY = 300.0
private var keyW = false
private var keyA = false
private var keyS = false
private var keyD = false
private var ticks = 0
private var message = "Collect 4 Sky Shards, rescue the Cloud Sprite, then reach the portal."
private var messageTicks = 240
setBackground(new Color(10, 25, 59))
setFocusable(true)
addKeyListener(this)
setPreferredSize(new Dimension(1040, 680))
addMouseListener(new MouseAdapter {
override def mousePressed(e: MouseEvent): Unit = {
requestFocusInWindow()
if (!paused && !won && !lost) {
playerX = math.max(35.0, math.min(getWidth - 35.0, e.getX.toDouble))
playerY = math.max(95.0, math.min(getHeight - 60.0, e.getY.toDouble))
}
}
})
loadRegion()
def startGame(): Unit = {
timer.start()
requestFocusInWindow()
}
def stopGame(): Unit = {
timer.stop()
}
private def loadRegion(): Unit = {
shards.clear()
val positions = shardPositions(region)
positions.foreach { point => shards += SkyShard(point._1, point._2, false) }
wisps.clear()
wisps += SkyWisp(300.0, 260.0, 0.0, 0)
wisps += SkyWisp(720.0, 330.0, 2.1, 0)
playerX = 90.0
playerY = getHeight.toDouble - 105.0
rescueDone = false
rescueX = 510.0 + (region * 37).toDouble
rescueY = 295.0 - (region * 13).toDouble
message = "Explore " + regionNames(region) + " and gather its 4 Sky Shards."
messageTicks = 220
}
private def shardCount: Int = shards.count(s => s.collected)
private def distance(ax: Double, ay: Double, bx: Double, by: Double): Double = {
val dx = ax - bx
val dy = ay - by
math.sqrt(dx * dx + dy * dy)
}
private def setMessage(text: String): Unit = {
message = text
messageTicks = 150
}
private def useWindPulse(): Unit = {
if (energy >= 15) {
energy -= 15
pulseTicks = 22
var stunnedCount = 0
wisps.foreach { w =>
if (distance(playerX, playerY, w.x, w.y) < 190.0) {
w.stunned = 120
stunnedCount += 1
}
}
if (stunnedCount > 0) setMessage("WIND PULSE! Nearby storm wisps are stunned.")
else setMessage("Wind Pulse released. No wisp was in range.")
} else setMessage("Not enough energy for Wind Pulse.")
}
private def interact(): Unit = {
if (distance(playerX, playerY, rescueX, rescueY) < 68.0 && !rescueDone) {
rescueDone = true
coins += 45
energy = math.min(100, energy + 25)
setMessage("Cloud Sprite rescued! +45 Sky Coins and +25 Energy.")
} else if (shardCount >= 4 && distance(playerX, playerY, getWidth - 105.0, 330.0) < 105.0) {
if (region < 3) {
region += 1
loadRegion()
} else {
won = true
setMessage("THE SKYHEART IS RESTORED! You completed the expedition.")
}
} else if (shardCount < 4) {
setMessage("The portal needs 4 Sky Shards. Current: " + shardCount + "/4.")
} else {
setMessage("Move closer to the glowing portal and press E.")
}
}
private def updateGame(): Unit = {
if (!paused && !won && !lost) {
ticks += 1
if (messageTicks > 0) messageTicks -= 1
if (hitCooldown > 0) hitCooldown -= 1
if (dashTicks > 0) dashTicks -= 1
if (shieldTicks > 0) shieldTicks -= 1
if (pulseTicks > 0) pulseTicks -= 1
if (energy < 100 && ticks % 8 == 0) energy += 1
var speed = 3.0 + math.min(2.0, coins.toDouble / 180.0)
if (dashTicks > 0) speed = 8.0
var dx = 0.0
var dy = 0.0
if (keyW) dy -= speed
if (keyS) dy += speed
if (keyA) dx -= speed
if (keyD) dx += speed
if (dx != 0.0 && dy != 0.0) {
dx *= 0.707
dy *= 0.707
}
playerX += dx
playerY += dy
playerX = math.max(30.0, math.min(getWidth - 35.0, playerX))
playerY = math.max(95.0, math.min(getHeight - 55.0, playerY))
shards.foreach { shard =>
if (!shard.collected && distance(playerX, playerY, shard.x, shard.y) < 29.0) {
shard.collected = true
totalShards += 1
coins += 25
energy = math.min(100, energy + 8)
setMessage("Sky Shard collected! +25 Sky Coins.")
}
}
wisps.foreach { w =>
if (w.stunned > 0) w.stunned -= 1
else {
w.phase += 0.045
val targetDx = playerX - w.x
val targetDy = playerY - w.y
val len = math.max(1.0, math.sqrt(targetDx * targetDx + targetDy * targetDy))
val chase = if (len < 300.0) 1.15 else 0.45
w.x += targetDx / len * chase + math.sin(w.phase) * 0.5
w.y += targetDy / len * chase + math.cos(w.phase * 0.8) * 0.4
}
if (distance(playerX, playerY, w.x, w.y) < 31.0 && shieldTicks == 0 && hitCooldown == 0 && w.stunned == 0) {
lives -= 1
hitCooldown = 75
playerX = math.max(45.0, playerX - 38.0)
playerY = math.min(getHeight - 70.0, playerY + 25.0)
setMessage("A Storm Wisp hit you! Use Q for a Cloud Shield.")
if (lives <= 0) {
lost = true
setMessage("Your glider lost its energy. Press R to retry this realm.")
}
}
}
}
repaint()
}
private def drawCloud(g: Graphics2D, x: Int, y: Int, scale: Int, alpha: Int): Unit = {
g.setColor(new Color(230, 248, 255, alpha))
g.fillOval(x, y + 14 * scale, 70 * scale, 28 * scale)
g.fillOval(x + 18 * scale, y, 58 * scale, 42 * scale)
g.fillOval(x + 48 * scale, y + 13 * scale, 65 * scale, 29 * scale)
}
private def drawFloatingIsland(g: Graphics2D, x: Int, y: Int, size: Int, color: Color): Unit = {
val top = new Polygon()
top.addPoint(x, y + 15)
top.addPoint(x + size / 5, y - 14)
top.addPoint(x + size * 4 / 5, y - 14)
top.addPoint(x + size, y + 15)
top.addPoint(x + size * 4 / 5, y + 45)
top.addPoint(x + size / 5, y + 45)
g.setColor(color)
g.fillPolygon(top)
val rock = new Polygon()
rock.addPoint(x + 15, y + 34)
rock.addPoint(x + size - 15, y + 34)
rock.addPoint(x + size / 2, y + 105)
g.setColor(new Color(52, 72, 111))
g.fillPolygon(rock)
g.setColor(new Color(135, 226, 242, 150))
g.drawLine(x + size / 2 - 8, y + 58, x + size / 2 - 24, y + 90)
g.drawLine(x + size / 2 + 8, y + 60, x + size / 2 + 25, y + 91)
}
private def drawShard(g: Graphics2D, x: Int, y: Int): Unit = {
val p = new Polygon()
p.addPoint(x, y - 17)
p.addPoint(x + 12, y - 3)
p.addPoint(x + 7, y + 17)
p.addPoint(x - 7, y + 17)
p.addPoint(x - 12, y - 3)
g.setColor(new Color(77, 247, 255, 70))
g.fillOval(x - 22, y - 22, 44, 44)
g.setColor(new Color(108, 248, 255))
g.fillPolygon(p)
g.setColor(Color.WHITE)
g.drawLine(x, y - 11, x, y + 11)
}
private def drawPlayer(g: Graphics2D): Unit = {
val px = playerX.toInt
val py = playerY.toInt
if (shieldTicks > 0) {
g.setColor(new Color(111, 239, 255, 65))
g.fillOval(px - 30, py - 34, 60, 68)
g.setColor(new Color(148, 248, 255, 210))
g.setStroke(new BasicStroke(2.0f))
g.drawOval(px - 30, py - 34, 60, 68)
}
g.setColor(new Color(255, 207, 124))
g.fillOval(px - 10, py - 25, 20, 20)
g.setColor(new Color(35, 71, 111))
g.fillRoundRect(px - 12, py - 7, 24, 31, 9, 9)
g.setColor(new Color(117, 239, 244))
val leftWing = new Polygon()
leftWing.addPoint(px - 13, py - 3)
leftWing.addPoint(px - 31, py + 18)
leftWing.addPoint(px - 20, py + 21)
val rightWing = new Polygon()
rightWing.addPoint(px + 13, py - 3)
rightWing.addPoint(px + 31, py + 18)
rightWing.addPoint(px + 20, py + 21)
g.fillPolygon(leftWing)
g.fillPolygon(rightWing)
g.setColor(Color.WHITE)
g.fillOval(px - 5, py - 17, 3, 3)
g.fillOval(px + 2, py - 17, 3, 3)
}
private def drawWisp(g: Graphics2D, w: SkyWisp): Unit = {
val x = w.x.toInt
val y = w.y.toInt
if (w.stunned > 0) g.setColor(new Color(180, 231, 255, 170))
else g.setColor(new Color(186, 126, 255, 210))
g.fillOval(x - 16, y - 17, 32, 32)
g.fillOval(x - 22, y - 2, 15, 21)
g.fillOval(x + 7, y - 2, 15, 21)
g.setColor(new Color(26, 30, 74))
g.fillOval(x - 7, y - 7, 4, 6)
g.fillOval(x + 3, y - 7, 4, 6)
}
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 top = regionColors(region)
g.setPaint(new GradientPaint(0, 0, new Color(11, 28, 72), 0, h, new Color(73, 145, 184)))
g.fillRect(0, 0, w, h)
var star = 0
while (star < 65) {
val sx = (star * 151 + 17) % math.max(1, w)
val sy = (star * 67 + 31) % math.max(1, h - 90)
g.setColor(new Color(255, 255, 255, 120 + (star % 100)))
g.fillOval(sx, sy, 2, 2)
star += 1
}
drawCloud(g, 35, 125 + (math.sin(ticks * 0.012) * 9).toInt, 1, 135)
drawCloud(g, w - 215, 205 + (math.cos(ticks * 0.01) * 8).toInt, 1, 145)
drawCloud(g, w / 2 - 50, h - 105, 2, 95)
drawFloatingIsland(g, 45, 240, 230, new Color(72, 154, 129))
drawFloatingIsland(g, 350, 410, 270, new Color(78, 155, 137))
drawFloatingIsland(g, 690, 245, 250, new Color(82, 151, 141))
g.setColor(new Color(255, 255, 255, 60))
g.setStroke(new BasicStroke(2.0f))
g.drawArc(240, 300, 190, 130, 190, 150)
g.drawArc(585, 260, 170, 140, 10, 150)
shards.foreach { s => if (!s.collected) drawShard(g, s.x.toInt, s.y.toInt) }
if (!rescueDone) {
val rx = rescueX.toInt
val ry = rescueY.toInt
g.setColor(new Color(255, 231, 149, 75))
g.fillOval(rx - 23, ry - 23, 46, 46)
g.setColor(new Color(255, 235, 177))
g.fillOval(rx - 11, ry - 14, 22, 22)
g.setColor(new Color(249, 255, 255))
g.fillOval(rx - 17, ry + 4, 34, 21)
g.setColor(Color.WHITE)
g.setFont(new Font("SansSerif", Font.BOLD, 11))
g.drawString("CLOUD SPRITE", rx - 42, ry + 39)
}
wisps.foreach(w => drawWisp(g, w))
val gateX = w - 105
val gateY = 330
val gateColor = if (shardCount >= 4) new Color(255, 225, 138) else new Color(126, 147, 178)
g.setColor(new Color(gateColor.getRed, gateColor.getGreen, gateColor.getBlue, 55))
g.fillOval(gateX - 47, gateY - 72, 94, 144)
g.setColor(gateColor)
g.setStroke(new BasicStroke(5.0f))
g.drawOval(gateX - 31, gateY - 55, 62, 110)
g.drawOval(gateX - 20, gateY - 43, 40, 86)
g.setFont(new Font("SansSerif", Font.BOLD, 11))
g.drawString(if (shardCount >= 4) "PORTAL OPEN" else "4 SHARDS", gateX - 40, gateY + 88)
drawPlayer(g)
g.setColor(new Color(5, 13, 36, 220))
g.fillRoundRect(14, 12, w - 28, 74, 18, 18)
g.setColor(top)
g.setFont(new Font("SansSerif", Font.BOLD, 17))
g.drawString("SKYBOUND ODYSSEY | " + regionNames(region), 30, 39)
g.setColor(Color.WHITE)
g.setFont(new Font("SansSerif", Font.PLAIN, 13))
g.drawString("EXPLORER: " + explorerName + " SHARDS: " + shardCount + "/4 TOTAL: " + totalShards + "/16 COINS: " + coins, 30, 62)
g.drawString("LIVES: " + lives + " ENERGY: " + energy + " CLOUD SPRITE: " + (if (rescueDone) "RESCUED" else "WAITING"), 30, 80)
g.setColor(new Color(4, 12, 32, 205))
g.fillRoundRect(14, h - 46, w - 28, 32, 12, 12)
g.setColor(new Color(230, 247, 255))
g.setFont(new Font("SansSerif", Font.BOLD, 12))
val bottomText = if (messageTicks > 0) message else "WASD/ARROWS MOVE SPACE GLIDER DASH Q CLOUD SHIELD F WIND PULSE E INTERACT P PAUSE B BACK"
g.drawString(bottomText, 27, h - 25)
if (paused || won || lost) {
g.setColor(new Color(3, 9, 28, 205))
g.fillRect(0, 0, w, h)
g.setFont(new Font("SansSerif", Font.BOLD, 34))
g.setColor(if (won) goldColor else new Color(167, 230, 255))
val title = if (won) "THE SKYHEART IS RESTORED!" else if (lost) "GLIDER ENERGY DEPLETED" else "EXPEDITION PAUSED"
g.drawString(title, w / 2 - 245, h / 2 - 30)
g.setFont(new Font("SansSerif", Font.PLAIN, 17))
g.setColor(Color.WHITE)
val help = if (won) "You mastered all four sky realms. Press B to return." else if (lost) "Press R to retry this realm, or B to return." else "Press P to resume, or B to return to login."
g.drawString(help, w / 2 - 225, h / 2 + 15)
}
g.dispose()
}
private val goldColor = new Color(255, 220, 132)
override def keyPressed(e: KeyEvent): Unit = {
val code = e.getKeyCode
if (code == KeyEvent.VK_W || code == KeyEvent.VK_UP) keyW = true
if (code == KeyEvent.VK_A || code == KeyEvent.VK_LEFT) keyA = true
if (code == KeyEvent.VK_S || code == KeyEvent.VK_DOWN) keyS = true
if (code == KeyEvent.VK_D || code == KeyEvent.VK_RIGHT) keyD = true
if (code == KeyEvent.VK_P && !won && !lost) paused = !paused
if (code == KeyEvent.VK_ESCAPE) paused = true
if (code == KeyEvent.VK_B) backAction.run()
if (code == KeyEvent.VK_R && lost) {
lives = 5
energy = 100
lost = false
loadRegion()
}
if (!paused && !won && !lost) {
if (code == KeyEvent.VK_SPACE && energy >= 12 && dashTicks == 0) {
energy -= 12
dashTicks = 15
}
if (code == KeyEvent.VK_Q && energy >= 18) {
energy -= 18
shieldTicks = 100
setMessage("CLOUD SHIELD ACTIVATED!")
}
if (code == KeyEvent.VK_F) useWindPulse()
if (code == KeyEvent.VK_E) interact()
}
repaint()
}
override def keyReleased(e: KeyEvent): Unit = {
val code = e.getKeyCode
if (code == KeyEvent.VK_W || code == KeyEvent.VK_UP) keyW = false
if (code == KeyEvent.VK_A || code == KeyEvent.VK_LEFT) keyA = false
if (code == KeyEvent.VK_S || code == KeyEvent.VK_DOWN) keyS = false
if (code == KeyEvent.VK_D || code == KeyEvent.VK_RIGHT) keyD = false
}
override def keyTyped(e: KeyEvent): Unit = {}
}
SkyboundOdysseyEvent04.main(Array[String]())