Desarrollo tempranoPre-1.0: la sintaxis puede cambiar.Historial de versionesGitHub
Sprite2D

Star Viper

Traza una ruta ramificada por seis sectores temáticos del Borde Exterior, esquiva disparos con giros de tonel y enfréntate a seis jefes con el motor Sprite2D de Vectrune.

Toca la pantalla o pulsa Enter para abrir el mapa estelar, elige tu ruta y disfruta de las escenas animadas antes de cada sector.

Abrir Star Viper en una pestaña nueva
Star Viper

Cargando juego…

Licencia del juego

Ver código fuente
star_viper.rune
#!RUNE
import "controls.rune"
import "sprites.rune"
import "sectors_sprites.rune"
import "portraits.rune"
import "cutscenes.rune"
import "sound.rune"
import "logic.rune"

@App
name = Star Viper
type = sprite2d
scene = mission
resolution = [960, 540]
tick_rate = 60
port = 3015

@Animation/capsule
frames = ["capsule/1", "capsule/2"]
fps = 8

@Animation/option
frames = ["option/1", "option/2"]
fps = 10

@Animation/viper/roll
frames = ["viper/up", "viper/roll1", "viper/roll2", "viper/roll3", "viper/roll4", "viper/down"]
fps = 22

@Scene/mission
logic = viper
controls = viper
background = "#050814"
camera = camera
cutscene = active_cutscene
persistence = {"key": "star-viper-v1", "state": "profile", "interval_ticks": 120}
layers = [
    {"type": "starfield", "state": "star_palette", "count": 64, "speed": 1.4},
    {"type": "parallax",  "state": "backdrop",     "speed": 0.25},
    {"type": "sprites",   "state": "terrain"},
    {"type": "sprites",  "state": "capsules"},
    {"type": "sprites",  "state": "enemies"},
    {"type": "sprites",  "state": "boss_segs"},
    {"type": "sprites",  "state": "boss"},
    {"type": "sprites",  "state": "options"},
    {"type": "sprites",  "state": "player"},
    {"type": "sprites",  "state": "explosions", "blend": "add"},
    {"type": "shapes",   "state": "beams",      "blend": "add"},
    {"type": "shapes",   "state": "enemy_shots","blend": "add"},
    {"type": "shapes",   "state": "particles",  "blend": "add"},
    {"type": "sprites",  "state": "hazards"},
    {"type": "ui",       "state": "hud"}
]
controls.rune
#!RUNE
@Controls/viper
keys:
    ArrowLeft -> left
    ArrowRight -> right
    ArrowUp -> up
    ArrowDown -> down
    KeyA -> left
    KeyD -> right
    KeyW -> up
    KeyS -> down
    Space -> fire
    KeyZ -> fire
    KeyJ -> fire
    KeyX -> power
    KeyK -> power
    ShiftLeft -> power
    ShiftRight -> power
    KeyC -> roll
    KeyE -> roll
    KeyQ -> roll
    KeyL -> roll
commands:
    Enter -> host.start
    KeyP -> host.pause
    KeyM -> host.mute
    KeyF -> host.fullscreen
    F11 -> host.fullscreen
gamepad:
    Axis0- -> left
    Axis0+ -> right
    Axis1- -> up
    Axis1+ -> down
    Button14 -> left
    Button15 -> right
    Button12 -> up
    Button13 -> down
    Button0 -> fire
    Button1 -> power
    Button2 -> power
    Button3 -> roll
    Button4 -> roll
    Button5 -> roll
    Button9 -> {"command": "host.pause"}
    Button8 -> {"command": "host.start"}
cutscenes.rune
#!RUNE
# Overarching campaign story cutscenes for Star Viper: The Eclipse Armada.

@Cutscene/cut_orbital
next = beginSector
lines:
    left="pilot/calm" name="KAI" color="#5ce1ff" sound="capsule_pickup" text="Viper-01 online. All thrusters nominal. Approaching the Orbital Gate."
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="boss_warning" text="Kai, Admiral Vex's Eclipse Armada just hijacked the Rim relay network. Break their gate blockade!"
    left="pilot/grin" name="KAI" color="#5ce1ff" sound="power_activate" text="Roger that, Commander. Grabbing weapon pods and clearing the lane — launching now!"

@Cutscene/cut_cryo
next = beginSector
lines:
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="capsule_pickup" text="You chose the upper route through Cryo Drift. Sub-zero ice shards and Frost Drones ahead."
    left="pilot/calm" name="KAI" color="#5ce1ff" text="Cockpit heaters at max. What's guarding the frozen relay?"
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="boss_warning" text="A crystalline carrier — the Glacier Aegis. Watch for its prism cryo-volleys!"

@Cutscene/cut_venom
next = beginSector
lines:
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="boss_warning" text="Entering Venom Nebula. Corrosive green gas clouds will obscure sensors — stay alert!"
    left="pilot/calm" name="KAI" color="#5ce1ff" sound="capsule_pickup" text="My hull readouts are tingling already. Are those bio-drones?"
    right="commander/alert" name="CMDR. REY" color="#ff9f43" text="Vex's Plague Hive is breeding spore pods in the haze. Burn through the clouds and destroy its core!"

@Cutscene/cut_cave
next = beginSector
lines:
    left="pilot/calm" name="KAI" color="#5ce1ff" sound="capsule_pickup" text="Diving straight into Hollow Rock — an abandoned mining tunnel inside a rogue asteroid."
    right="vex/smirk" name="ADMIRAL VEX" color="#ff2e63" sound="boss_warning" text="Clever little pilot, crawling through the rocks to flank my citadel. Too bad you aren't alone in there."
    left="pilot/grin" name="KAI" color="#5ce1ff" sound="power_activate" text="Vex! Save the speech — I'll carve through whatever pet you hid in this cave!"

@Cutscene/cut_solar
next = beginSector
lines:
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="boss_warning" text="Welcome to Solar Forge. Vex is siphoning stellar plasma here to power the Eclipse Citadel."
    right="vex/smirk" name="ADMIRAL VEX" color="#ff2e63" text="My Helios Warden will reduce that toy fighter to stardust before you cross the corona."
    left="pilot/grin" name="KAI" color="#5ce1ff" sound="power_activate" text="Let's shut down his foundry and take the heat straight to his doorstep!"

@Cutscene/cut_eclipse
next = beginSector
lines:
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="boss_warning" text="This is it, Kai — Eclipse Citadel. Every relay leads here. Admiral Vex is launching his flagship!"
    right="vex/smirk" name="ADMIRAL VEX" color="#ff2e63" sound="boss_warning" text="Impressive that you survived the Rim. Now witness the Eclipse Sovereign at full power!"
    left="pilot/grin" name="KAI" color="#5ce1ff" sound="power_activate" text="All weapons hot, Commander. One last run — for the Outer Rim!"

@Cutscene/cut_ending
next = finishVictory
lines:
    left="pilot/grin" name="KAI" color="#5ce1ff" sound="power_activate" text="Eclipse Sovereign is down! Vex's relay signal just went completely dark!"
    right="commander/alert" name="CMDR. REY" color="#ff9f43" sound="capsule_pickup" text="Outstanding flying, Kai. The Outer Rim is free — bring Viper-01 home!"
logic.rune
#!RUNE
@Logic/viper
state:
    status = "ready"
    active_cutscene = ""
    bg_color = "#050814"
    title_tick = 0
    sector_id = "orbital"
    sector_name = "ORBITAL GATE"
    sector_num = 1
    selected_node = "orbital"
    cleared_nodes = []
    available_nodes = ["orbital"]
    score = 0
    profile = { "best_score": 0, "victories": 0 }
    lives = 3
    hp = 100
    max_hp = 100
    tick_count = 0
    wave_timer = 0
    warning_timer = 0
    respawn_timer = 0
    gameover_timer = 0
    boss_death_timer = 0
    boss_death_x = 0
    boss_death_y = 0
    boss_title = "DREADNOUGHT CORE"
    banner_text = ""
    banner_color = "#5ce1ff"
    banner_timer = 0
    drop_cycle = 0
    camera = { "x": 0, "y": 0, "zoom": 1, "shake_x": 0, "shake_y": 0 }
    shake = 0
    player = { "x": 140, "y": 250, "sprite": "viper/idle", "scale": 0.9, "sx": 0.9, "sy": 0.9, "rot": 0, "alpha": 1, "visible": true }
    invuln = 0
    speed = 5.0
    weapon = "pulse"
    has_missile = false
    shield = 0
    power_slot = 0
    power_prev = false
    roll_timer = 0
    roll_cd = 0
    roll_prev = false
    fire_cd = 0
    trail = []
    options = []
    backdrop = []
    terrain = []
    hazards = []
    star_palette = ["#7c94b8", "#dcecff"]
    enemies = []
    boss = []
    boss_segs = []
    explosions = []
    capsules = []
    beams = []
    enemy_shots = []
    particles = []
    hud = []

action initialize:
    call buildSpace
    call buildHud

action buildSpace:
    star_col1 = "#7c94b8"
    star_col2 = "#dcecff"
    if sector_id == "cryo":
        star_col1 = "#9beeff"
        star_col2 = "#ffffff"
    if sector_id == "venom":
        star_col1 = "#6ec94b"
        star_col2 = "#d4ff7a"
    if sector_id == "cave":
        star_col1 = "#7a5e85"
        star_col2 = "#c49bd1"
    if sector_id == "solar":
        star_col1 = "#ff8c42"
        star_col2 = "#fff0a8"
    if sector_id == "eclipse":
        star_col1 = "#a855f7"
        star_col2 = "#ff99b8"
    star_palette = [star_col1, star_col2]
    if sector_id == "cave":
        backdrop = []
    else:
        backdrop = [
            { "sprite": "planet", "x": 760, "y": 150, "scale": 1.15, "alpha": 0.8 }
        ]

action returnToTitle:
    status = "ready"
    active_cutscene = ""
    bg_color = "#050814"
    sector_id = "orbital"
    title_tick = 0
    enemies = []
    boss = []
    boss_segs = []
    terrain = []
    hazards = []
    explosions = []
    capsules = []
    beams = []
    enemy_shots = []
    particles = []
    trail = []
    options = []
    warning_timer = 0
    respawn_timer = 0
    gameover_timer = 0
    boss_death_timer = 0
    banner_timer = 0
    player = { "x": 240, "y": 265, "sprite": "viper/idle", "scale": 1.25, "rot": 0, "alpha": 1, "visible": true }
    music.stop
    call buildSpace
    call buildHud

action start:
    if status == "gameover" || status == "won":
        call returnToTitle
        stop
    # Start a new campaign on the 2D Galaxy Map with Orbital Gate ready to deploy!
    score = 0
    lives = 3
    hp = max_hp
    speed = 5.0
    weapon = "pulse"
    has_missile = false
    shield = 0
    power_slot = 0
    power_prev = false
    options = []
    cleared_nodes = []
    available_nodes = ["orbital"]
    selected_node = "orbital"
    sector_num = 1
    call openMap

action openMap:
    status = "map"
    active_cutscene = ""
    bg_color = "#040814"
    enemies = []
    boss = []
    boss_segs = []
    terrain = []
    hazards = []
    explosions = []
    capsules = []
    beams = []
    enemy_shots = []
    particles = []
    player.visible = false
    music.stop
    call buildSpace
    call buildHud

action deploySelected:
    sector_id = selected_node
    status = "briefing"
    player.visible = true
    if sector_id == "orbital":
        sector_name = "ORBITAL GATE"
        boss_title = "DREADNOUGHT CORE"
        bg_color = "#050814"
        active_cutscene = "cut_orbital"
    if sector_id == "cryo":
        sector_name = "CRYO DRIFT"
        boss_title = "GLACIER AEGIS"
        bg_color = "#071a2e"
        active_cutscene = "cut_cryo"
    if sector_id == "venom":
        sector_name = "VENOM NEBULA"
        boss_title = "PLAGUE HIVE"
        bg_color = "#071a10"
        active_cutscene = "cut_venom"
    if sector_id == "cave":
        sector_name = "HOLLOW ROCK"
        boss_title = "ABYSSAL SPACE WORM"
        bg_color = "#140d1a"
        active_cutscene = "cut_cave"
    if sector_id == "solar":
        sector_name = "SOLAR FORGE"
        boss_title = "HELIOS WARDEN"
        bg_color = "#210c09"
        active_cutscene = "cut_solar"
    if sector_id == "eclipse":
        sector_name = "ECLIPSE CITADEL"
        boss_title = "ECLIPSE SOVEREIGN"
        bg_color = "#12061c"
        active_cutscene = "cut_eclipse"
    call buildSpace
    call buildHud

action onKey(code):
    stop when status != "map"
    if code == "Enter" || code == "Space" || code == "KeyZ":
        sound.play("power_activate")
        call deploySelected
        stop
    if code == "ArrowUp" || code == "KeyW" || code == "ArrowLeft" || code == "KeyA":
        if available_nodes.length > 1:
            if selected_node == available_nodes[0]:
                selected_node = available_nodes[available_nodes.length - 1]
            else:
                selected_node = available_nodes[0]
            sound.play("capsule_pickup")
            call buildHud
        stop
    if code == "ArrowDown" || code == "KeyS" || code == "ArrowRight" || code == "KeyD":
        if available_nodes.length > 1:
            if selected_node == available_nodes[0]:
                selected_node = available_nodes[1]
            else:
                selected_node = available_nodes[0]
            sound.play("capsule_pickup")
            call buildHud
        stop

action onClick(mx, my):
    stop when status != "map"
    # Clicking the bottom DEPLOY button launches the selected sector
    if mx >= 676 && mx <= 916 && my >= 440 && my <= 492:
        sound.play("power_activate")
        call deploySelected
        stop
    # Direct click on any available glowing planet node
    map_nodes = [
        { "id": "orbital", "x": 140, "y": 230 },
        { "id": "cryo",    "x": 370, "y": 140 },
        { "id": "venom",   "x": 370, "y": 320 },
        { "id": "cave",    "x": 610, "y": 140 },
        { "id": "solar",   "x": 610, "y": 320 },
        { "id": "eclipse", "x": 835, "y": 230 }
    ]
    for node in map_nodes:
        if abs(mx - node.x) < 48 && abs(my - node.y) < 48:
            is_avail = false
            for av in available_nodes:
                if av == node.id:
                    is_avail = true
            if is_avail:
                if selected_node == node.id:
                    sound.play("power_activate")
                    call deploySelected
                else:
                    selected_node = node.id
                    sound.play("capsule_pickup")
                    call buildHud
                stop

action beginSector:
    status = "playing"
    active_cutscene = ""
    tick_count = 0
    wave_timer = 0
    warning_timer = 0
    respawn_timer = 0
    gameover_timer = 0
    boss_death_timer = 0
    invuln = 75
    hp = max_hp
    enemies = []
    boss = []
    boss_segs = []
    explosions = []
    capsules = []
    beams = []
    enemy_shots = []
    particles = []
    trail = []
    terrain = []
    hazards = []
    player.x = 140
    player.y = 250
    player.scale = 0.9
    player.sx = 0.9
    player.sy = 0.9
    player.visible = true
    roll_timer = 0
    roll_cd = 0
    roll_prev = false
    # Initialize themed environment hazards/terrain
    if sector_id == "cave":
        for ti in [0, 1, 2, 3, 4, 5, 6]:
            terrain.push({ "x": ti * 160 + 80, "y": 0, "sprite": "cave_wall_top", "side": "top", "scale": 1 })
            terrain.push({ "x": ti * 160 + 140, "y": 494, "sprite": "cave_wall_bot", "side": "bot", "scale": 1 })
    if sector_id == "venom":
        for ci in [0, 1, 2, 3, 4]:
            hazards.push({ "x": ci * 230 + 120, "y": 110 + (ci % 3) * 125, "sprite": "toxic_cloud", "scale": 1.35, "alpha": 0.62, "vx": -1.4 - (ci % 2) * 0.5 })
    call buildSpace
    call buildHud
    music.stop
    music.play "star_viper"

action finishVictory:
    profile.victories = profile.victories + 1
    status = "won"
    active_cutscene = ""
    music.stop
    call buildHud

action spawnExplosionSprite(ex, ey, sc):
    stop when explosions.length >= 10
    explosions.push({ "x": ex, "y": ey, "sprite": "boom/1", "scale": sc, "rot": (tick_count % 12) * 0.52, "alpha": 1, "age": 0, "max": 20 })

action spawnBurst(bx, by, col):
    stop when particles.length >= 44
    particles.push({ "kind": "ring", "x": bx, "y": by, "r": 6, "stroke": col, "width": 3, "alpha": 0.95, "life": 16, "max": 16, "grow": 2.8 })
    for k in [0, 1, 2, 3, 4, 5]:
        ang = k * 1.0472 + (tick_count % 7) * 0.1
        spd = 2.4 + (k % 3) * 1.4
        particles.push({ "kind": "circle", "x": bx, "y": by, "r": 3.2, "fill": col, "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 16, "max": 16 })

action spawnWeaponDrop(dx, dy):
    drop_cycle = drop_cycle + 1
    kind_idx = drop_cycle % 4
    if kind_idx == 1:
        capsules.push({ "x": dx, "y": dy, "sprite": "drop/spread", "kind": "spread", "scale": 1 })
    else:
        if kind_idx == 2:
            capsules.push({ "x": dx, "y": dy, "sprite": "drop/laser", "kind": "laser", "scale": 1 })
        else:
            if kind_idx == 3:
                capsules.push({ "x": dx, "y": dy, "sprite": "drop/plasma", "kind": "plasma", "scale": 1 })
            else:
                capsules.push({ "x": dx, "y": dy, "sprite": "drop/double", "kind": "double", "scale": 1 })

action spawnEnemyExplosion(ex, ey, kind):
    if kind == "interceptor" || kind == "turret" || kind == "cryo_drone":
        call spawnExplosionSprite ex, ey, 1.15
        col_r = kind == "cryo_drone" ? "#7ef5ff" : "#ff77c8"
        particles.push({ "kind": "ring", "x": ex, "y": ey, "r": 10, "stroke": col_r, "width": 3.5, "alpha": 1, "life": 20, "max": 20, "grow": 3.2 })
        for k in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]:
            ang = k * 0.6283 + (tick_count % 9) * 0.14
            spd = 2.6 + (k % 3) * 1.7
            particles.push({ "kind": "rect", "x": ex, "y": ey, "w": 6, "h": 3, "fill": k % 2 == 0 ? "#ffd166" : col_r, "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 24, "max": 24 })
    else:
        if kind == "asteroid" || kind == "ice_shard":
            call spawnExplosionSprite ex, ey, 0.85
            sh_c = kind == "ice_shard" ? "#a8f8ff" : "#9ab3d4"
            particles.push({ "kind": "ring", "x": ex, "y": ey, "r": 8, "stroke": sh_c, "width": 2.5, "alpha": 0.9, "life": 16, "max": 16, "grow": 2.4 })
            for k in [0, 1, 2, 3, 4, 5, 6, 7]:
                ang = k * 0.7854 + (tick_count % 5) * 0.2
                spd = 2.0 + (k % 3) * 1.3
                particles.push({ "kind": "rect", "x": ex, "y": ey, "w": 7, "h": 6, "r": 2, "fill": sh_c, "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 24, "max": 24 })
        else:
            call spawnExplosionSprite ex, ey, 0.85
            c1 = kind == "spore_pod" ? "#a3ff47" : "#ff9b4a"
            particles.push({ "kind": "ring", "x": ex, "y": ey, "r": 7, "stroke": c1, "width": 3, "alpha": 0.95, "life": 16, "max": 16, "grow": 2.7 })
            for k in [0, 1, 2, 3, 4, 5, 6, 7]:
                ang = k * 0.7854 + (tick_count % 7) * 0.12
                spd = 2.5 + (k % 3) * 1.5
                particles.push({ "kind": "circle", "x": ex, "y": ey, "r": 3.4, "fill": c1, "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 18, "max": 18 })

action spawnPlayerExplosion(px, py):
    call spawnExplosionSprite px, py, 1.45
    call spawnExplosionSprite px + 14, py - 10, 0.95
    particles.push({ "kind": "ring", "x": px, "y": py, "r": 8, "stroke": "#ffffff", "width": 4.5, "alpha": 1, "life": 22, "max": 22, "grow": 4.2 })
    particles.push({ "kind": "ring", "x": px, "y": py, "r": 6, "stroke": "#5ce1ff", "width": 3.5, "alpha": 0.95, "life": 28, "max": 28, "grow": 3.1 })
    particles.push({ "kind": "ring", "x": px, "y": py, "r": 4, "stroke": "#ff6b35", "width": 2.5, "alpha": 0.9, "life": 32, "max": 32, "grow": 2.2 })
    for k in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]:
        ang = k * 0.5236 + 0.18
        spd = 3.0 + (k % 4) * 1.4
        particles.push({ "kind": "rect", "x": px, "y": py, "w": 8, "h": 3.5, "fill": k % 3 == 0 ? "#5ce1ff" : (k % 3 == 1 ? "#eef6ff" : "#ff8c2b"), "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 32, "max": 32 })

action spawnBossNova(bx, by):
    call spawnExplosionSprite bx, by, 2.6
    call spawnExplosionSprite bx - 48, by - 36, 1.7
    call spawnExplosionSprite bx + 44, by + 32, 1.7
    call spawnExplosionSprite bx - 36, by + 40, 1.5
    call spawnExplosionSprite bx + 46, by - 34, 1.5
    particles.push({ "kind": "ring", "x": bx, "y": by, "r": 14, "stroke": "#ffffff", "width": 6, "alpha": 1, "life": 30, "max": 30, "grow": 6.5 })
    particles.push({ "kind": "ring", "x": bx, "y": by, "r": 10, "stroke": "#ff5ca8", "width": 4.5, "alpha": 0.95, "life": 36, "max": 36, "grow": 4.8 })
    particles.push({ "kind": "ring", "x": bx, "y": by, "r": 8, "stroke": "#5ce1ff", "width": 3.5, "alpha": 0.9, "life": 42, "max": 42, "grow": 3.6 })
    for k in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]:
        ang = k * 0.3927 + 0.1
        spd = 3.2 + (k % 4) * 1.8
        particles.push({ "kind": "rect", "x": bx, "y": by, "w": 10, "h": 4, "fill": k % 3 == 0 ? "#ffffff" : (k % 3 == 1 ? "#ff5ca8" : "#ffd166"), "alpha": 1, "vx": cos(ang) * spd, "vy": sin(ang) * spd, "life": 38, "max": 38 })

action fireFrom(fx, fy):
    if weapon == "laser":
        beams.push({ "kind": "rect", "x": fx + 24, "y": fy - 2.5, "w": 64, "h": 5, "r": 2.5, "fill": "#6ef3ff", "vx": 18, "vy": 0, "pierce": true, "dmg": 2 })
    else:
        if weapon == "spread":
            beams.push({ "kind": "rect", "x": fx + 24, "y": fy - 2, "w": 18, "h": 4, "r": 2, "fill": "#4eff9b", "vx": 14.5, "vy": 0, "pierce": false, "dmg": 1 })
            beams.push({ "kind": "rect", "x": fx + 20, "y": fy - 8, "w": 16, "h": 3.5, "r": 1.5, "fill": "#4eff9b", "vx": 13.5, "vy": -3.2, "pierce": false, "dmg": 1 })
            beams.push({ "kind": "rect", "x": fx + 20, "y": fy + 4, "w": 16, "h": 3.5, "r": 1.5, "fill": "#4eff9b", "vx": 13.5, "vy": 3.2, "pierce": false, "dmg": 1 })
        else:
            if weapon == "plasma":
                beams.push({ "kind": "circle", "x": fx + 28, "y": fy, "r": 8, "fill": "#f472b6", "stroke": "#ffffff", "width": 2, "vx": 12.5, "vy": 0, "pierce": false, "dmg": 3 })
            else:
                beams.push({ "kind": "rect", "x": fx + 24, "y": fy - 2, "w": 22, "h": 4, "r": 2, "fill": "#ffe87a", "vx": 15, "vy": 0, "pierce": false, "dmg": 1 })
                if weapon == "double":
                    beams.push({ "kind": "rect", "x": fx + 18, "y": fy - 12, "w": 16, "h": 3.5, "r": 1.5, "fill": "#7ef5ff", "vx": 12, "vy": -5.5, "pierce": false, "dmg": 1 })
    if has_missile:
        beams.push({ "kind": "circle", "x": fx + 8, "y": fy + 14, "r": 4, "fill": "#ff8f42", "vx": 6.5, "vy": 3.2, "pierce": false, "dmg": 2 })

action activatePower:
    stop when power_slot == 0
    if power_slot == 1:
        speed = min(8.5, speed + 1.0)
        banner_text = "SPEED UP!"
        banner_color = "#5ce1ff"
    if power_slot == 2:
        has_missile = true
        banner_text = "MISSILES ONLINE!"
        banner_color = "#ff8f42"
    if power_slot == 3:
        weapon = "double"
        banner_text = "WEAPON: DOUBLE"
        banner_color = "#ffd166"
    if power_slot == 4:
        weapon = "laser"
        banner_text = "WEAPON: LASER"
        banner_color = "#6ef3ff"
    if power_slot == 5:
        if options.length < 3:
            options.push({ "x": player.x - 36, "y": player.y, "sprite": "option", "scale": 1 })
            banner_text = "OPTION POD DEPLOYED!"
            banner_color = "#ff9f43"
    if power_slot == 6:
        shield = 3
        hp = min(max_hp, hp + 40)
        banner_text = "SHIELD + HULL REPAIR!"
        banner_color = "#5ce1ff"
    banner_timer = 75
    power_slot = 0
    sound.play("power_activate")

action spawnBoss:
    boss_segs = []
    if sector_id == "cave":
        # Articulated Abyssal Space Worm Boss!
        boss = [
            { "x": 1060, "y": 245, "base_y": 245, "sprite": "boss_worm_head", "hit_sprite": "boss_worm_head_hit", "kind": "worm", "scale": 1.0, "hp": 68, "max_hp": 68, "vy": 2.0, "fire": 48, "flash": 0 }
        ]
        for wi in [1, 2, 3, 4, 5, 6]:
            boss_segs.push({ "x": 1060 + wi * 44, "y": 245, "sprite": "boss_worm_seg", "scale": max(0.62, 1.0 - wi * 0.05), "phase": wi * 0.65 })
    else:
        b_spr = "boss_core"
        b_hit = "boss_core_hit"
        b_hp = 45
        if sector_id == "cryo":
            b_spr = "boss_ice"
            b_hit = "boss_ice_hit"
            b_hp = 58
        if sector_id == "venom":
            b_spr = "boss_venom"
            b_hit = "boss_venom_hit"
            b_hp = 60
        if sector_id == "solar":
            b_spr = "boss_solar"
            b_hit = "boss_solar_hit"
            b_hp = 72
        if sector_id == "eclipse":
            b_spr = "boss_eclipse"
            b_hit = "boss_eclipse_hit"
            b_hp = 92
        boss = [
            { "x": 1060, "y": 245, "base_y": 245, "sprite": b_spr, "base_sprite": b_spr, "hit_sprite": b_hit, "kind": sector_id, "scale": 1.0, "hp": b_hp, "max_hp": b_hp, "vy": 1.9, "fire": 54, "flash": 0 }
        ]
    music.stop
    music.play "boss_battle"

action advanceCampaignAfterBoss:
    cleared_nodes.push(sector_id)
    sector_num = sector_num + 1
    if sector_id == "orbital":
        available_nodes = ["cryo", "venom"]
        selected_node = "cryo"
        call openMap
        stop
    if sector_id == "cryo" || sector_id == "venom":
        available_nodes = ["cave", "solar"]
        selected_node = "cave"
        call openMap
        stop
    if sector_id == "cave" || sector_id == "solar":
        available_nodes = ["eclipse"]
        selected_node = "eclipse"
        call openMap
        stop
    # Eclipse Citadel cleared -> Grand Ending Cutscene!
    status = "briefing"
    active_cutscene = "cut_ending"
    music.stop
    call buildHud

action tick(input):
    if status != "playing":
        title_tick = title_tick + 1
        if status == "ready":
            player.x = 240 + cos(title_tick * 0.03) * 18
            player.y = 265 + sin(title_tick * 0.05) * 14
            player.scale = 1.25
            player.sx = 1.25
            player.sy = 1.25
            player.rot = sin(title_tick * 0.05) * 0.04
            player.sprite = "viper/idle"
            player.alpha = 1
            player.visible = true
        call buildHud
        stop

    tick_count = tick_count + 1
    if invuln > 0:
        invuln = invuln - 1
    if fire_cd > 0:
        fire_cd = fire_cd - 1
    if roll_cd > 0:
        roll_cd = roll_cd - 1
    if roll_timer > 0:
        roll_timer = roll_timer - 1
    if banner_timer > 0:
        banner_timer = banner_timer - 1
    if warning_timer > 0:
        warning_timer = warning_timer - 1
        if warning_timer == 0:
            call spawnBoss
    if shake > 0:
        shake = shake - 1
        camera.shake_x = sin(tick_count * 1.9) * shake
        camera.shake_y = cos(tick_count * 2.3) * shake
    else:
        camera.shake_x = 0
        camera.shake_y = 0

    for b in backdrop:
        b.x = b.x - 0.22
        if b.x < -140:
            b.x = 1120

    # Scroll asteroid cave ceiling/floor walls
    for t in terrain:
        t.x = t.x - 2.6
        if t.x < -80:
            t.x = t.x + 1120

    # Drift noxious nebula clouds
    for h in hazards:
        h.x = h.x + h.vx
        if h.x < -110:
            h.x = 1070

    if gameover_timer > 0:
        gameover_timer = gameover_timer - 1
        if gameover_timer == 0:
            status = "gameover"
    if respawn_timer > 0:
        respawn_timer = respawn_timer - 1
        if respawn_timer == 0:
            player.x = 110
            player.y = 250
            player.visible = true
            hp = max_hp
            invuln = 100

    if player.visible:
        dx = 0
        dy = 0
        if input.right:
            dx = dx + 1
        if input.left:
            dx = dx - 1
        if input.down:
            dy = dy + 1
        if input.up:
            dy = dy - 1
        player.scale = 0.9
        player.sx = 0.9
        player.x = max(44, min(910, player.x + dx * (roll_timer > 0 ? speed * 1.28 : speed)))
        player.y = max(36, min(462, player.y + dy * (roll_timer > 0 ? speed * 1.28 : speed)))
        if input.roll && !roll_prev && roll_timer == 0 && roll_cd == 0:
            roll_timer = 26
            roll_cd = 55
            sound.play("barrel_roll")
            particles.push({ "kind": "ring", "x": player.x, "y": player.y, "r": 14, "stroke": "#7ef5ff", "width": 2.5, "alpha": 0.9, "life": 14, "max": 14, "grow": 2.4 })
        if input.roll:
            roll_prev = true
        else:
            roll_prev = false

        if roll_timer > 0:
            player.sy = 0.9
            player.rot = 0
            # Dedicated 6-stage 360-degree barrel roll sprite sequence (using group flip=y for inverted belly!)
            if roll_timer > 22:
                player.sprite = "viper/up"
            else:
                if roll_timer > 18:
                    player.sprite = "viper/roll1"
                else:
                    if roll_timer > 13:
                        player.sprite = "viper/roll2"
                    else:
                        if roll_timer > 8:
                            player.sprite = "viper/roll3"
                        else:
                            if roll_timer > 4:
                                player.sprite = "viper/roll4"
                            else:
                                player.sprite = "viper/down"
            if roll_timer % 6 == 0 && particles.length < 44:
                particles.push({ "kind": "ring", "x": player.x - 10, "y": player.y, "r": 18, "stroke": "#5ce1ff", "width": 2, "alpha": 0.7, "life": 10, "max": 10, "grow": 1.6 })
        else:
            player.sy = 0.9
            if dy < 0:
                player.sprite = "viper/up"
                player.rot = -0.06
            else:
                if dy > 0:
                    player.sprite = "viper/down"
                    player.rot = 0.06
                else:
                    player.sprite = "viper/idle"
                    player.rot = 0
        if invuln > 0 && tick_count % 6 < 3:
            player.alpha = 0.35
        else:
            player.alpha = 1

        if dx != 0 || dy != 0 || trail.length < 48:
            trail.unshift({ "x": player.x, "y": player.y })
            if trail.length > 60:
                trail.pop()
        for opt, oi in options:
            tidx = min(trail.length - 1, (oi + 1) * 14)
            if tidx >= 0:
                opt.x = trail[tidx].x - 10
                opt.y = trail[tidx].y

        if input.power && !power_prev:
            call activatePower
        if input.power:
            power_prev = true
        else:
            power_prev = false

        if input.fire && fire_cd <= 0 && boss_death_timer == 0:
            call fireFrom player.x, player.y
            for opt in options:
                call fireFrom opt.x, opt.y
            if weapon == "laser" || weapon == "plasma":
                fire_cd = weapon == "plasma" ? 13 : 10
                sound.play("fire_laser")
            else:
                fire_cd = 8
                sound.play("fire_pulse")

    # Sector-themed enemy waves -> Sector Boss at ~15 seconds
    if boss.length == 0 && warning_timer == 0 && boss_death_timer == 0 && gameover_timer == 0:
        wave_timer = wave_timer + 1
        cad = sector_num >= 3 ? 42 : 52
        if wave_timer % cad == 10:
            base_y = sector_id == "cave" ? (140 + ((tick_count * 37) % 210)) : (90 + ((tick_count * 37) % 300))
            drop_flag = wave_timer % (cad * 3) == 10
            e_kind = "scout"
            e_spr = "scout"
            e_hp = 1
            if sector_id == "cryo":
                e_kind = "cryo_drone"
                e_spr = "cryo_drone"
                e_hp = 2
            if sector_id == "venom":
                e_kind = "spore_pod"
                e_spr = "spore_pod"
                e_hp = 2
            enemies.push({ "x": 1000, "y": base_y, "base_y": base_y, "phase": tick_count * 0.1, "kind": e_kind, "sprite": e_spr, "hp": e_hp, "vx": -4.0, "scale": 0.9, "rot": 0, "drop": drop_flag, "weapon_drop": false, "fire": 55 })
        if wave_timer % 90 == 45:
            ay = sector_id == "cave" ? (145 + ((tick_count * 83) % 200)) : (75 + ((tick_count * 83) % 340))
            h_kind = sector_id == "cryo" ? "ice_shard" : "asteroid"
            enemies.push({ "x": 1010, "y": ay, "base_y": ay, "phase": 0, "kind": h_kind, "sprite": h_kind, "hp": 3, "vx": -2.6, "scale": 0.85, "rot": 0, "drop": false, "weapon_drop": false })
        if wave_timer % 130 == 70:
            iy = sector_id == "cave" ? (150 + ((tick_count * 59) % 190)) : (110 + ((tick_count * 59) % 280))
            is_wdrop = (wave_timer % 260 == 70)
            enemies.push({ "x": 1010, "y": iy, "base_y": iy, "phase": 0, "kind": "interceptor", "sprite": "interceptor", "hp": 3, "vx": -2.7, "scale": 0.95, "rot": 0, "drop": !is_wdrop, "weapon_drop": is_wdrop, "fire": 45 })
        if (sector_id == "solar" || sector_id == "eclipse" || sector_id == "cave") && wave_timer % 115 == 30:
            ty = sector_id == "cave" ? ((wave_timer % 230 == 30) ? 128 : 370) : ((wave_timer % 230 == 30) ? 74 : 434)
            enemies.push({ "x": 1000, "y": ty, "base_y": ty, "phase": 0, "kind": "turret", "sprite": "turret", "hp": 4, "vx": -1.9, "scale": 0.95, "rot": 0, "drop": false, "weapon_drop": true, "fire": 40 })
        if wave_timer == 840:
            warning_timer = 110
            sound.play("boss_warning")

    next_beams = []
    for b in beams:
        b.x = b.x + b.vx
        b.y = b.y + b.vy
        if b.x < 1020 && b.y > -20 && b.y < 520:
            next_beams.push(b)
    beams = next_beams

    next_enemies = []
    for e in enemies:
        e.x = e.x + e.vx
        if e.kind == "scout" || e.kind == "cryo_drone" || e.kind == "spore_pod":
            e.y = e.base_y + sin(tick_count * 0.08 + e.phase) * 44
        if e.kind == "asteroid" || e.kind == "ice_shard":
            e.rot = e.rot + 0.035
        if e.kind == "interceptor" || e.kind == "cryo_drone" || e.kind == "spore_pod":
            if e.kind == "interceptor":
                e.y = e.y + (player.y - e.y) * 0.015
            e.fire = (e.fire || 90) - 1
            if e.fire <= 0 && e.x > player.x + 110 && enemy_shots.length < 16:
                e.fire = e.kind == "interceptor" ? 105 : 115
                dxp = player.x - e.x
                dyp = player.y - e.y
                dist = max(1, sqrt(dxp * dxp + dyp * dyp))
                s_col = e.kind == "cryo_drone" ? "#8ef6ff" : (e.kind == "spore_pod" ? "#a3ff47" : "#ff5ca8")
                enemy_shots.push({ "kind": "circle", "x": e.x - 24, "y": e.y, "r": 5, "fill": s_col, "vx": dxp / dist * 3.9, "vy": dyp / dist * 3.9 })
        if e.kind == "turret":
            e.fire = e.fire - 1
            if e.fire <= 0 && e.x > 120 && e.x < 920:
                e.fire = 70
                dxp = player.x - e.x
                dyp = player.y - e.y
                dist = max(1, sqrt(dxp * dxp + dyp * dyp))
                enemy_shots.push({ "kind": "circle", "x": e.x - 26, "y": e.y - 8, "r": 4.5, "fill": "#7ef5ff", "vx": dxp / dist * 4.8, "vy": dyp / dist * 4.8 })
                enemy_shots.push({ "kind": "circle", "x": e.x - 26, "y": e.y + 8, "r": 4.5, "fill": "#7ef5ff", "vx": dxp / dist * 4.8, "vy": dyp / dist * 4.8 })
        hit = false
        for b in beams:
            if b.dead != true:
                bx = b.x + 12
                by = b.y
                if abs(bx - e.x) < 34 && abs(by - e.y) < 28:
                    e.hp = e.hp - b.dmg
                    if !b.pierce:
                        b.dead = true
                    if e.hp <= 0:
                        hit = true
        if hit:
            if e.kind == "interceptor" || e.kind == "turret":
                score = score + 250
            else:
                score = score + 100
            profile.best_score = max(profile.best_score, score)
            shake = min(8, shake + 3)
            sound.play("enemy_boom")
            call spawnEnemyExplosion e.x, e.y, e.kind
            if e.weapon_drop:
                call spawnWeaponDrop e.x, e.y
            else:
                if e.drop:
                    capsules.push({ "x": e.x, "y": e.y, "sprite": "capsule", "kind": "capsule", "scale": 1 })
        else:
            if e.x > -80:
                next_enemies.push(e)
    enemies = next_enemies

    # Staged cinematic Boss death chain-explosion sequence
    if boss_death_timer > 0:
        boss_death_timer = boss_death_timer - 1
        for bo in boss:
            bo.y = bo.y + 0.35
            bo.x = bo.x + sin(tick_count * 1.4) * 1.6
            if boss_death_timer % 6 < 3:
                bo.sprite = bo.hit_sprite
            else:
                bo.sprite = bo.kind == "worm" ? "boss_worm_head" : bo.base_sprite
            if boss_death_timer > 24 && boss_death_timer % 9 == 0:
                ox = ((boss_death_timer * 37) % 120) - 60
                oy = ((boss_death_timer * 53) % 100) - 50
                call spawnExplosionSprite bo.x + ox, bo.y + oy, 1.05
                call spawnBurst bo.x + ox, bo.y + oy, boss_death_timer % 18 == 0 ? "#ff5ca8" : "#ffd166"
                shake = 7
                sound.play("enemy_boom")
        if boss_death_timer == 22:
            for bo in boss:
                boss_death_x = bo.x
                boss_death_y = bo.y
            boss = []
            boss_segs = []
            shake = 16
            sound.play("boss_boom")
            call spawnBossNova boss_death_x, boss_death_y
        if boss_death_timer == 0:
            call advanceCampaignAfterBoss
    else:
        boss_triggered_death = false
        for bo in boss:
            if bo.kind == "worm":
                # Articulated Space Worm undulates across the cave!
                if bo.x > 640:
                    bo.x = bo.x - 2.4
                else:
                    bo.x = 640 + cos(tick_count * 0.04) * 110
                bo.y = 248 + sin(tick_count * 0.065) * 118
                for seg, si in boss_segs:
                    seg.x = bo.x + (si + 1) * 44
                    seg.y = 248 + sin(tick_count * 0.065 - seg.phase) * 118
                bo.fire = bo.fire - 1
                if bo.fire <= 0:
                    bo.fire = 46
                    dxp = player.x - (bo.x - 36)
                    dyp = player.y - bo.y
                    dist = max(1, sqrt(dxp * dxp + dyp * dyp))
                    enemy_shots.push({ "kind": "circle", "x": bo.x - 36, "y": bo.y, "r": 7, "fill": "#ff6b35", "vx": dxp / dist * 5.8, "vy": dyp / dist * 5.8 })
                    enemy_shots.push({ "kind": "circle", "x": bo.x - 36, "y": bo.y, "r": 5, "fill": "#ffd166", "vx": dxp / dist * 5.0, "vy": dyp / dist * 5.0 - 1.6 })
                    enemy_shots.push({ "kind": "circle", "x": bo.x - 36, "y": bo.y, "r": 5, "fill": "#ffd166", "vx": dxp / dist * 5.0, "vy": dyp / dist * 5.0 + 1.6 })
            else:
                if bo.x > 790:
                    bo.x = bo.x - 2.2
                else:
                    bo.y = bo.y + bo.vy
                    if bo.y < 110 || bo.y > 390:
                        bo.vy = -bo.vy
                    bo.fire = bo.fire - 1
                    if bo.fire <= 0 && enemy_shots.length < 16:
                        bo.fire = sector_id == "eclipse" ? 48 : (sector_id == "orbital" ? 72 : 60)
                        s_col = sector_id == "cryo" ? "#8ef6ff" : (sector_id == "venom" ? "#a3ff47" : (sector_id == "solar" ? "#ff9f43" : "#ff2e63"))
                        laser_spd = sector_id == "orbital" ? -5.2 : -6.2
                        enemy_shots.push({ "kind": "rect", "x": bo.x - 84, "y": bo.y - 34, "w": 20, "h": 5, "r": 2.5, "fill": s_col, "vx": laser_spd, "vy": 0 })
                        enemy_shots.push({ "kind": "rect", "x": bo.x - 84, "y": bo.y + 30, "w": 20, "h": 5, "r": 2.5, "fill": s_col, "vx": laser_spd, "vy": 0 })
                        dxp = player.x - (bo.x - 30)
                        dyp = player.y - bo.y
                        dist = max(1, sqrt(dxp * dxp + dyp * dyp))
                        enemy_shots.push({ "kind": "circle", "x": bo.x - 30, "y": bo.y, "r": 6, "fill": s_col, "vx": dxp / dist * 4.6, "vy": dyp / dist * 4.6 })
                        if sector_id == "cryo" || sector_id == "solar" || sector_id == "eclipse":
                            enemy_shots.push({ "kind": "circle", "x": bo.x - 30, "y": bo.y, "r": 5, "fill": "#ffffff", "vx": dxp / dist * 4.2, "vy": dyp / dist * 4.2 - 1.7 })
                            enemy_shots.push({ "kind": "circle", "x": bo.x - 30, "y": bo.y, "r": 5, "fill": "#ffffff", "vx": dxp / dist * 4.2, "vy": dyp / dist * 4.2 + 1.7 })
            if bo.flash > 0:
                bo.flash = bo.flash - 1
                bo.sprite = bo.hit_sprite
            else:
                bo.sprite = bo.kind == "worm" ? "boss_worm_head" : bo.base_sprite
            for b in beams:
                if b.dead != true:
                    bx = b.x + 12
                    by = b.y
                    if abs(bx - bo.x) < 74 && abs(by - bo.y) < 58:
                        bo.hp = bo.hp - b.dmg
                        bo.flash = 3
                        b.dead = true
                        if bo.hp <= 0:
                            boss_triggered_death = true
        if boss_triggered_death:
            enemy_shots = []
            score = score + (sector_id == "eclipse" ? 6000 : 2500)
            profile.best_score = max(profile.best_score, score)
            boss_death_timer = 105
            shake = 9
            music.stop
            sound.play("enemy_boom")

    beams = beams.filter it.dead != true

    next_caps = []
    for c in capsules:
        c.x = c.x - 1.6
        if player.visible && abs(c.x - player.x) < 40 && abs(c.y - player.y) < 32:
            if c.kind == "spread" || c.kind == "laser" || c.kind == "plasma" || c.kind == "double":
                weapon = c.kind
                score = score + 150
                profile.best_score = max(profile.best_score, score)
                sound.play("power_activate")
                if c.kind == "spread":
                    banner_text = "WEAPON: SPREAD!"
                    banner_color = "#4eff9b"
                if c.kind == "laser":
                    banner_text = "WEAPON: LASER!"
                    banner_color = "#6ef3ff"
                if c.kind == "plasma":
                    banner_text = "WEAPON: PLASMA!"
                    banner_color = "#f472b6"
                if c.kind == "double":
                    banner_text = "WEAPON: DOUBLE!"
                    banner_color = "#ffd166"
                banner_timer = 85
                call spawnBurst c.x, c.y, banner_color
            else:
                power_slot = (power_slot % 6) + 1
                score = score + 50
                profile.best_score = max(profile.best_score, score)
                sound.play("capsule_pickup")
                call spawnBurst c.x, c.y, "#ffd166"
        else:
            if c.x > -30:
                next_caps.push(c)
    capsules = next_caps

    next_shots = []
    for s in enemy_shots:
        s.x = s.x + s.vx
        s.y = s.y + s.vy
        if roll_timer > 0 && player.visible && abs(s.x - player.x) < 42 && abs(s.y - player.y) < 34:
            score = score + 25
            profile.best_score = max(profile.best_score, score)
            sound.play("roll_deflect")
            call spawnBurst s.x, s.y, "#7ef5ff"
        else:
            if s.x > -30 && s.x < 980 && s.y > -20 && s.y < 520:
                next_shots.push(s)
    enemy_shots = next_shots

    if invuln <= 0 && player.visible && status == "playing" && boss_death_timer == 0:
        dmg = 0
        if sector_id == "cave" && (player.y < 86 || player.y > 410):
            dmg = 25
        for e in enemies:
            if abs(e.x - player.x) < 36 && abs(e.y - player.y) < 24:
                dmg = max(dmg, 35)
        for bo in boss:
            if abs(bo.x - player.x) < 74 && abs(bo.y - player.y) < 54:
                dmg = max(dmg, 45)
        for seg in boss_segs:
            if abs(seg.x - player.x) < 34 && abs(seg.y - player.y) < 34:
                dmg = max(dmg, 30)
        if roll_timer == 0:
            for s in enemy_shots:
                if abs(s.x - player.x) < 28 && abs(s.y - player.y) < 18:
                    dmg = max(dmg, 25)
                    s.x = -100
        if dmg > 0:
            if shield > 0:
                shield = shield - 1
                invuln = 45
                shake = 5
                call spawnBurst player.x + 20, player.y, "#5ce1ff"
            else:
                hp = max(0, hp - dmg)
                if hp <= 0:
                    lives = lives - 1
                    player.visible = false
                    shake = 12
                    sound.play("player_hit")
                    call spawnPlayerExplosion player.x, player.y
                    if lives <= 0:
                        gameover_timer = 52
                        music.stop
                    else:
                        respawn_timer = 46
                else:
                    invuln = 36
                    shake = 6
                    sound.play("enemy_boom")
                    call spawnBurst player.x, player.y, "#ff8c2b"

    next_exps = []
    for ex in explosions:
        ex.age = ex.age + 1
        if ex.age < ex.max:
            if ex.age < 5:
                ex.sprite = "boom/1"
            else:
                if ex.age < 10:
                    ex.sprite = "boom/2"
                else:
                    if ex.age < 15:
                        ex.sprite = "boom/3"
                    else:
                        ex.sprite = "boom/4"
            ex.scale = ex.scale + 0.025
            ex.alpha = 1 - (ex.age / ex.max) * 0.65
            next_exps.push(ex)
    explosions = next_exps

    next_parts = []
    for p in particles:
        p.life = p.life - 1
        if p.life > 0:
            if p.grow:
                p.r = p.r + p.grow
            if p.vx:
                p.x = p.x + p.vx
                p.y = p.y + p.vy
            p.alpha = p.life / p.max
            next_parts.push(p)
    particles = next_parts

    call buildHud

action buildMapHud:
    pulse = 0.55 + abs(sin(title_tick * 0.08)) * 0.45
    hud = [
        { "kind": "rect", "x": 0, "y": 0, "w": 960, "h": 58, "fill": "#070f21dd" },
        { "kind": "line", "x1": 0, "y1": 58, "x2": 960, "y2": 58, "stroke": "#29466e", "width": 1.5 },
        { "kind": "text", "x": 28, "y": 29, "text": "OUTER RIM STAR CHART · SELECT ROUTE", "size": 17, "weight": "800", "fill": "#5ce1ff" },
        { "kind": "text", "x": 932, "y": 29, "text": "SCORE " + score + "  ·  SHIPS " + lives, "size": 14, "align": "right", "fill": "#edf3ff" }
    ]
    # Glowing branching hyperlane routes
    routes = [
        { "x1": 140, "y1": 230, "x2": 370, "y2": 140, "to": "cryo" },
        { "x1": 140, "y1": 230, "x2": 370, "y2": 320, "to": "venom" },
        { "x1": 370, "y1": 140, "x2": 610, "y2": 140, "to": "cave" },
        { "x1": 370, "y1": 140, "x2": 610, "y2": 320, "to": "solar" },
        { "x1": 370, "y1": 320, "x2": 610, "y2": 140, "to": "cave" },
        { "x1": 370, "y1": 320, "x2": 610, "y2": 320, "to": "solar" },
        { "x1": 610, "y1": 140, "x2": 835, "y2": 230, "to": "eclipse" },
        { "x1": 610, "y1": 320, "x2": 835, "y2": 230, "to": "eclipse" }
    ]
    for r in routes:
        is_sel = (r.to == selected_node)
        hud.push({ "kind": "line", "x1": r.x1, "y1": r.y1, "x2": r.x2, "y2": r.y2, "stroke": is_sel ? "#5ce1ff" : "#1f3557", "width": is_sel ? 3.5 : 2, "alpha": is_sel ? 0.9 : 0.7 })

    nodes = [
        { "id": "orbital", "x": 140, "y": 230, "name": "ORBITAL GATE",    "theme": "DEEP SPACE BLOCKADE",    "boss": "DREADNOUGHT CORE",   "col": "#5ce1ff" },
        { "id": "cryo",    "x": 370, "y": 140, "name": "CRYO DRIFT",      "theme": "GLACIAL ICE FIELD",      "boss": "GLACIER AEGIS",      "col": "#8ef6ff" },
        { "id": "venom",   "x": 370, "y": 320, "name": "VENOM NEBULA",    "theme": "NOXIOUS GAS CLOUD",      "boss": "PLAGUE HIVE",        "col": "#a3ff47" },
        { "id": "cave",    "x": 610, "y": 140, "name": "HOLLOW ROCK",     "theme": "ASTEROID CAVE TUNNEL",   "boss": "ABYSSAL SPACE WORM", "col": "#d48c6a" },
        { "id": "solar",   "x": 610, "y": 320, "name": "SOLAR FORGE",     "theme": "MOLTEN PLASMA FOUNDRY",  "boss": "HELIOS WARDEN",      "col": "#ff8c2b" },
        { "id": "eclipse", "x": 835, "y": 230, "name": "ECLIPSE CITADEL", "theme": "ADMIRAL VEX STRONGHOLD", "boss": "ECLIPSE SOVEREIGN",  "col": "#ff2e63" }
    ]
    sel_name = "ORBITAL GATE"
    sel_theme = "DEEP SPACE BLOCKADE"
    sel_boss = "DREADNOUGHT CORE"
    sel_col = "#5ce1ff"
    for n in nodes:
        is_clr = false
        for cl in cleared_nodes:
            if cl == n.id:
                is_clr = true
        is_av = false
        for av in available_nodes:
            if av == n.id:
                is_av = true
        is_sel = (n.id == selected_node)
        if is_sel:
            sel_name = n.name
            sel_theme = n.theme
            sel_boss = n.boss
            sel_col = n.col
        # Soft multi-ring planetary glow
        if is_av || is_clr:
            hud.push({ "kind": "circle", "x": n.x, "y": n.y, "r": is_sel ? 38 : 30, "fill": n.col, "alpha": is_sel ? (0.28 * pulse) : 0.14 })
        if is_sel:
            hud.push({ "kind": "ring", "x": n.x, "y": n.y, "r": 32 + sin(title_tick * 0.1) * 3, "stroke": "#ffffff", "width": 2.5, "alpha": pulse })
        node_fill = is_clr ? "#2ecc71" : (is_av ? n.col : "#1a2842")
        node_stroke = is_sel ? "#ffffff" : (is_av ? n.col : "#344c73")
        hud.push({ "kind": "circle", "x": n.x, "y": n.y, "r": 18, "fill": node_fill, "stroke": node_stroke, "width": 2.5 })
        hud.push({ "kind": "circle", "x": n.x - 5, "y": n.y - 5, "r": 5, "fill": "#ffffff", "alpha": is_av || is_clr ? 0.55 : 0.15 })
        hud.push({ "kind": "text", "x": n.x, "y": n.y + 34, "text": n.name, "size": 11, "align": "center", "weight": is_sel ? "800" : "600", "fill": is_sel ? "#ffffff" : (is_av ? n.col : "#607799") })
        if is_clr:
            hud.push({ "kind": "text", "x": n.x, "y": n.y + 1, "text": "OK", "size": 10, "align": "center", "weight": "900", "fill": "#05140b" })

    # Bottom tactical intel & deploy bar
    hud.push({ "kind": "rect", "x": 36, "y": 420, "w": 888, "h": 92, "r": 10, "fill": "#081226ee", "stroke": sel_col, "width": 2 })
    hud.push({ "kind": "text", "x": 60, "y": 448, "text": sel_name + "  ·  " + sel_theme, "size": 18, "weight": "900", "fill": sel_col })
    hud.push({ "kind": "text", "x": 60, "y": 476, "text": "BOSS INTEL: " + sel_boss + "   |   USE ARROWS OR TAP GLOWING NODE", "size": 12, "fill": "#c7d9f0" })
    hud.push({ "kind": "rect", "x": 676, "y": 440, "w": 230, "h": 52, "r": 8, "fill": sel_col, "stroke": "#ffffff", "width": 1.8, "alpha": 0.72 + pulse * 0.28 })
    hud.push({ "kind": "text", "x": 791, "y": 466, "text": "DEPLOY · ENTER", "size": 14, "align": "center", "weight": "900", "fill": "#061120" })

action buildHud:
    if status == "ready":
        prompt_alpha = 0.55 + abs(sin(title_tick * 0.06)) * 0.45
        hud = [
            { "kind": "rect", "x": 200, "y": 72, "w": 560, "h": 128, "r": 12, "fill": "#081226cc", "stroke": "#5ce1ff", "width": 2 },
            { "kind": "text", "x": 480, "y": 120, "text": "STAR VIPER", "size": 52, "align": "center", "weight": "900", "fill": "#eef7ff" },
            { "kind": "text", "x": 480, "y": 164, "text": "THE ECLIPSE ARMADA · BEST " + profile.best_score, "size": 14, "align": "center", "weight": "700", "fill": "#5ce1ff" },
            { "kind": "rect", "x": 290, "y": 356, "w": 380, "h": 44, "r": 8, "fill": "#ff8c2b", "stroke": "#fff2c2", "width": 2, "alpha": prompt_alpha },
            { "kind": "text", "x": 480, "y": 378, "text": "TAP SCREEN OR PRESS ENTER TO LAUNCH", "size": 14, "align": "center", "weight": "800", "fill": "#081124" },
            { "kind": "text", "x": 480, "y": 436, "text": "ARROWS / WASD: FLY   ·   SPACE / Z: FIRE   ·   X / SHIFT: POWER UP", "size": 12, "align": "center", "fill": "#9ab3d4" }
        ]
        stop
    if status == "map":
        call buildMapHud
        stop
    if status == "briefing":
        hud = [
            { "kind": "text", "x": 24, "y": 24, "text": sector_name + " · BRIEFING", "size": 14, "weight": "700", "fill": "#5ce1ff" }
        ]
        stop
    if status == "gameover" || status == "won":
        pulse = 0.58 + abs(sin(title_tick * 0.07)) * 0.42
        accent = status == "won" ? "#4eff9b" : "#ff5ca8"
        heading = status == "won" ? "MISSION CLEAR" : "GAME OVER"
        sub = status == "won" ? "ECLIPSE ARMADA DEFEATED · THE OUTER RIM IS FREE" : "VIPER-01 LOST IN " + sector_name
        hud = [
            { "kind": "rect", "x": 0, "y": 0, "w": 960, "h": 540, "fill": "#040814", "alpha": 0.62 },
            { "kind": "rect", "x": 210, "y": 110, "w": 540, "h": 296, "r": 14, "fill": "#091224ee", "stroke": accent, "width": 2.5 },
            { "kind": "text", "x": 480, "y": 168, "text": heading, "size": 46, "align": "center", "weight": "900", "fill": accent },
            { "kind": "text", "x": 480, "y": 208, "text": sub, "size": 13, "align": "center", "fill": "#c7d9f0" },
            { "kind": "line", "x1": 270, "y1": 234, "x2": 690, "y2": 234, "stroke": "#294063", "width": 1.5 },
            { "kind": "text", "x": 340, "y": 268, "text": "FINAL SCORE", "size": 12, "align": "center", "fill": "#8fa9cc" },
            { "kind": "text", "x": 340, "y": 294, "text": "" + score, "size": 26, "align": "center", "weight": "800", "fill": "#ffffff" },
            { "kind": "text", "x": 620, "y": 268, "text": "BEST SCORE", "size": 12, "align": "center", "fill": "#8fa9cc" },
            { "kind": "text", "x": 620, "y": 294, "text": "" + profile.best_score, "size": 26, "align": "center", "weight": "800", "fill": "#ffd166" },
            { "kind": "rect", "x": 290, "y": 334, "w": 380, "h": 44, "r": 8, "fill": accent, "stroke": "#ffffff", "width": 1.5, "alpha": pulse },
            { "kind": "text", "x": 480, "y": 356, "text": "TAP SCREEN OR PRESS ENTER FOR TITLE", "size": 13, "align": "center", "weight": "800", "fill": "#061120" }
        ]
        stop

    hp_w = max(0, hp * 130 / max_hp)
    hp_col = hp > 50 ? "#4eff9b" : (hp > 25 ? "#ffd166" : "#ff4d6d")
    w_label = weapon == "spread" ? "SPREAD" : (weapon == "laser" ? "LASER" : (weapon == "plasma" ? "PLASMA" : (weapon == "double" ? "DOUBLE" : "PULSE")))
    hud = [
        { "kind": "rect", "x": 0, "y": 494, "w": 960, "h": 46, "fill": "#091124ee" },
        { "kind": "line", "x1": 0, "y1": 494, "x2": 960, "y2": 494, "stroke": "#2d4c73", "width": 1.5 },
        { "kind": "text", "x": 20, "y": 22, "text": "SCORE " + score + "  ·  BEST " + profile.best_score, "size": 13, "fill": "#edf3ff" },
        { "kind": "text", "x": 430, "y": 22, "text": sector_name + "  ·  " + w_label, "size": 13, "align": "center", "fill": "#ffd166" },
        { "kind": "text", "x": 698, "y": 22, "text": "HULL", "size": 12, "align": "right", "fill": "#9ab3d4" },
        { "kind": "rect", "x": 706, "y": 15, "w": 130, "h": 13, "r": 4, "fill": "#13213b", "stroke": "#3b5982", "width": 1.5 },
        { "kind": "rect", "x": 706, "y": 15, "w": hp_w, "h": 13, "r": 4, "fill": hp_col },
        { "kind": "text", "x": 942, "y": 22, "text": "SHIPS " + lives, "size": 13, "align": "right", "fill": "#5ce1ff" }
    ]
    if banner_timer > 0:
        hud.push({ "kind": "rect", "x": 350, "y": 62, "w": 260, "h": 30, "r": 6, "fill": "#091326dd", "stroke": banner_color, "width": 1.5 })
        hud.push({ "kind": "text", "x": 480, "y": 77, "text": banner_text, "size": 13, "align": "center", "weight": "800", "fill": banner_color })
    if warning_timer > 0 && (tick_count % 24 < 16):
        hud.push({ "kind": "rect", "x": 230, "y": 195, "w": 500, "h": 64, "r": 8, "fill": "#2b0918dd", "stroke": "#ff4fa3", "width": 2 })
        hud.push({ "kind": "text", "x": 480, "y": 220, "text": "WARNING", "size": 24, "align": "center", "weight": "900", "fill": "#ff5ca8" })
        hud.push({ "kind": "text", "x": 480, "y": 244, "text": boss_title + " APPROACHING", "size": 13, "align": "center", "fill": "#ffd6ef" })
    for bo in boss:
        bw = max(0, bo.hp * 260 / bo.max_hp)
        hud.push({ "kind": "rect", "x": 350, "y": 38, "w": 260, "h": 10, "r": 4, "fill": "#1b0d1f", "stroke": "#ff5ca8", "width": 1.5 })
        hud.push({ "kind": "rect", "x": 350, "y": 38, "w": bw, "h": 10, "r": 4, "fill": "#ff5ca8" })
    labels = ["SPEED", "MISSILE", "DOUBLE", "LASER", "OPTION", "SHIELD"]
    for label, si in labels:
        sx = 165 + si * 106
        if power_slot == si + 1:
            hud.push({ "kind": "rect", "x": sx, "y": 504, "w": 98, "h": 26, "r": 4, "fill": "#ff8c2b", "stroke": "#fff2c2", "width": 2 })
            hud.push({ "kind": "text", "x": sx + 49, "y": 518, "text": label, "size": 12, "align": "center", "fill": "#091124" })
        else:
            hud.push({ "kind": "rect", "x": sx, "y": 504, "w": 98, "h": 26, "r": 4, "fill": "#13213b", "stroke": "#2f4b70", "width": 1 })
            hud.push({ "kind": "text", "x": sx + 49, "y": 518, "text": label, "size": 12, "align": "center", "fill": "#8fa9cc" })
    if shield > 0 && status == "playing" && player.visible:
        hud.push({ "kind": "ring", "x": player.x + 14, "y": player.y, "r": 32, "stroke": "#5ce1ff", "width": 2.5, "alpha": 0.65 })
    if roll_timer > 0 && status == "playing" && player.visible:
        hud.push({ "kind": "ring", "x": player.x, "y": player.y, "r": 36, "stroke": "#a8ffff", "width": 2.5, "alpha": 0.75 })
    roll_ready = (roll_cd == 0 && roll_timer == 0)
    hud.push({ "kind": "rect", "x": 18, "y": 504, "w": 124, "h": 26, "r": 4, "fill": roll_ready ? "#0f2e45" : "#101a2e", "stroke": roll_ready ? "#5ce1ff" : "#2b4263", "width": 1.5 })
    hud.push({ "kind": "text", "x": 80, "y": 518, "text": roll_timer > 0 ? "ROLLING!" : (roll_ready ? "ROLL [C] OK" : "ROLL ..."), "size": 11, "align": "center", "weight": "700", "fill": roll_ready ? "#7ef5ff" : "#6b84a8" })
portraits.rune
#!RUNE
# High-fidelity cel-shaded anime character portraits for Star Viper briefings.

@Sprite/pilot/calm
size = [220, 240]
origin = [110, 120]
defs:
    aura      = radial(110 124 104, #5ce1ff40 0, #16447022 0.62, #05081400 1)
    frame_bg  = linear(20 20 -> 200 226, #0d2240cc 0, #071022dd 1)
    skin      = linear(108 56 -> 114 150, #ffead9 0, #fad0b4 0.68, #e6a888 1)
    skin_sh   = linear(108 124 -> 112 160, #d48e70 0, #b87058 1)
    hair_main = linear(104 16 -> 116 138, #3864b8 0, #1d356b 0.52, #0d1938 1)
    hair_dark = linear(100 32 -> 110 148, #192b59 0, #091229 1)
    suit_wht  = linear(108 148 -> 114 236, #f4f9ff 0, #c8dcf0 0.55, #6c8cb0 1)
    suit_dk   = linear(110 146 -> 110 236, #283f63 0, #121f38 1)
    iris      = linear(110 86 -> 110 107, #092038 0, #1d8cd4 0.45, #5eeeff 0.85, #c8ffff 1)
    visor     = linear(62 46 -> 158 68, #a8f8ffaa 0, #38bdf866 0.6, #0d4b7a88 1)
shapes:
    # Subtle holographic cockpit comms backing
    circle 110 124 102 fill=aura blend=add
    poly 24,30 184,30 202,48 202,228 38,228 24,214 fill=frame_bg stroke=#5ce1ff55/1.5 join=round
    line 32 42 58 42 stroke=#5ce1ff/2 cap=round opacity=0.7
    line 170 218 194 218 stroke=#5ce1ff/2 cap=round opacity=0.7

    # Flight suit shoulders, collar & harness straps
    path "M 22 232 Q 36 172 74 156 L 148 156 Q 186 172 198 232 Z" fill=suit_wht stroke=#0a1526/2.5 join=round
    # Under-suit navy chest V & high collar
    poly 74,154 110,196 146,154 134,150 110,174 86,150 fill=suit_dk stroke=#0a1526/2 join=round
    path "M 66 154 L 84 188 L 110 204 L 136 188 L 154 154 L 142 150 L 110 186 L 78 150 Z" fill=#eef6ff stroke=#0e2038/2 join=round
    # Shoulder harness & glowing cyan telemetry strips
    poly 46,168 64,160 80,232 60,232 fill=suit_dk stroke=#0a1526/1.8
    poly 174,168 156,160 140,232 160,232 fill=suit_dk stroke=#0a1526/1.8
    line 56 168 72 224 stroke=#5ce1ff/3 cap=round
    line 164 168 148 224 stroke=#5ce1ff/3 cap=round
    rect 98 204 24 8 r=3 fill=#10243d stroke=#5ce1ff/1.5
    circle 110 208 2.5 fill=#7ef5ff blend=add

    # Back hair volume (swept anime silhouette)
    path "M 54 78 L 40 118 L 62 128 L 54 144 L 86 146 L 140 146 L 166 138 L 158 122 L 176 108 L 162 66 L 146 32 L 74 30 Z" fill=hair_dark stroke=#070e1f/2.2 join=round

    # Neck & cel-shaded chin shadow
    path "M 94 130 L 92 162 Q 110 172 128 162 L 126 130 Z" fill=skin stroke=#8a5742/1.4
    path "M 94 134 Q 110 152 126 134 L 126 146 Q 110 160 94 146 Z" fill=skin_sh opacity=0.65

    # Ears + cockpit comms earpiece
    ellipse 67 104 7 11 fill=skin stroke=#8a5742/1.5
    ellipse 152 104 7 11 fill=skin stroke=#8a5742/1.5
    rect 58 95 10 20 r=4 fill=#1e3454 stroke=#5ce1ff/1.8
    circle 63 105 2.5 fill=#7ef5ff blend=add

    # Tapered anime face & jawline (subtle 3/4 tilt right)
    path "M 69 72 Q 68 112 84 132 Q 100 148 112 149 Q 126 148 140 130 Q 152 110 150 72 Q 148 44 110 44 Q 70 44 69 72 Z" fill=skin stroke=#8a5742/1.8
    # Soft cheek warmth & right-edge rim light
    ellipse 86 112 10 4.5 fill=#ff9482 opacity=0.22
    ellipse 134 112 10 4.5 fill=#ff9482 opacity=0.22
    path "M 145 78 Q 146 108 136 128" fill=none stroke=#8ef6ff/2 cap=round opacity=0.55

    # Forehead shadow cast by bangs
    path "M 72 68 Q 92 84 112 78 Q 132 84 148 70 L 146 54 L 74 54 Z" fill=#c48368 opacity=0.32

    # Detailed anime eyes (left & right)
    # Sclera + subtle upper lid shadow
    path "M 77 98 Q 89 88 102 97 Q 99 108 88 108 Q 78 107 77 98 Z" fill=#ffffff
    path "M 120 97 Q 133 88 144 98 Q 143 107 133 108 Q 122 108 120 97 Z" fill=#ffffff
    path "M 78 96 Q 89 91 101 96 L 100 99 Q 89 95 79 99 Z" fill=#b5c9e0 opacity=0.5
    path "M 121 96 Q 133 91 143 96 L 142 99 Q 133 95 122 99 Z" fill=#b5c9e0 opacity=0.5
    # Gradient iris + pupil + lower crescent glow
    ellipse 91 99 7.5 8.5 fill=iris stroke=#0a1e36/1.2
    ellipse 131 99 7.5 8.5 fill=iris stroke=#0a1e36/1.2
    circle 91 99 3.4 fill=#071526
    circle 131 99 3.4 fill=#071526
    path "M 86 103 Q 91 107 96 103" fill=none stroke=#b8ffff/2.2 cap=round
    path "M 126 103 Q 131 107 136 103" fill=none stroke=#b8ffff/2.2 cap=round
    # Twin anime catchlights
    circle 87 95 2.7 fill=#ffffff
    circle 127 95 2.7 fill=#ffffff
    circle 95 102 1.3 fill=#ffffff opacity=0.9
    circle 135 102 1.3 fill=#ffffff opacity=0.9
    # Sculpted upper lashes, eyelid crease & focused brows
    path "M 74 96 Q 88 86 104 95" fill=none stroke=#091326/3.5 cap=round
    path "M 118 95 Q 134 86 147 96" fill=none stroke=#091326/3.5 cap=round
    path "M 79 88 Q 90 84 100 88" fill=none stroke=#8a5742/1.2 cap=round opacity=0.7
    path "M 122 88 Q 132 84 142 88" fill=none stroke=#8a5742/1.2 cap=round opacity=0.7
    path "M 76 82 Q 89 79 103 84" fill=none stroke=#14254d/2.8 cap=round
    path "M 119 84 Q 133 79 145 82" fill=none stroke=#14254d/2.8 cap=round

    # Delicate anime nose & calm mouth
    path "M 111 108 L 113 116 L 110 117" fill=none stroke=#9c654d/1.6 cap=round join=round
    path "M 101 129 Q 111 132 121 128" fill=none stroke=#7d4636/2 cap=round
    line 108 134 114 134 stroke=#d49377/1.4 cap=round

    # Comms boom mic curving toward cheek
    path "M 64 113 Q 76 130 96 130" fill=none stroke=#5ce1ff/2.2 cap=round
    circle 97 130 2.5 fill=#162944 stroke=#7ef5ff/1.4

    # Layered windswept anime bangs & side locks
    path "M 56 84 Q 50 44 82 24 Q 112 12 146 26 Q 172 42 164 84 L 152 106 L 146 72 L 136 92 L 128 62 L 114 96 L 104 60 L 90 94 L 82 64 L 68 104 Z" fill=hair_main stroke=#070e1f/2.2 join=round
    # Extra spiky crown tufts
    poly 88,26 74,10 104,20 fill=hair_main stroke=#070e1f/1.8 join=round
    poly 118,22 142,10 138,28 fill=hair_main stroke=#070e1f/1.8 join=round
    # Glossy anime hair highlight arc
    path "M 74 44 Q 94 34 110 40" fill=none stroke=#7ad4ff/4 cap=round opacity=0.75
    path "M 122 38 Q 138 34 150 44" fill=none stroke=#7ad4ff/3.5 cap=round opacity=0.7

    # Translucent cyan flight visor tucked on forehead
    path "M 68 58 Q 110 44 152 58 L 147 70 Q 110 58 73 70 Z" fill=visor stroke=#8ef6ff/1.8 join=round
    path "M 82 58 Q 108 51 134 57" fill=none stroke=#ffffff/2 cap=round opacity=0.65

@Sprite/pilot/grin
size = [220, 240]
origin = [110, 120]
defs:
    aura      = radial(110 124 108, #5ce1ff55 0, #16447022 0.62, #05081400 1)
    frame_bg  = linear(20 20 -> 200 226, #102a4ecc 0, #071022dd 1)
    skin      = linear(108 56 -> 114 150, #ffead9 0, #fad0b4 0.68, #e6a888 1)
    skin_sh   = linear(108 124 -> 112 160, #d48e70 0, #b87058 1)
    hair_main = linear(104 16 -> 116 138, #3f6fc9 0, #1f3973 0.52, #0d1938 1)
    hair_dark = linear(100 32 -> 110 148, #192b59 0, #091229 1)
    suit_wht  = linear(108 148 -> 114 236, #f4f9ff 0, #c8dcf0 0.55, #6c8cb0 1)
    suit_dk   = linear(110 146 -> 110 236, #283f63 0, #121f38 1)
    iris      = linear(110 86 -> 110 107, #092038 0, #249be8 0.45, #70f4ff 0.85, #d6ffff 1)
    visor     = linear(62 46 -> 158 68, #b8fbffbb 0, #38bdf877 0.6, #0d4b7a88 1)
shapes:
    circle 110 124 106 fill=aura blend=add
    poly 24,30 184,30 202,48 202,228 38,228 24,214 fill=frame_bg stroke=#7ef5ff77/1.8 join=round
    line 32 42 64 42 stroke=#7ef5ff/2.2 cap=round opacity=0.85
    line 166 218 194 218 stroke=#7ef5ff/2.2 cap=round opacity=0.85

    path "M 22 232 Q 36 172 74 156 L 148 156 Q 186 172 198 232 Z" fill=suit_wht stroke=#0a1526/2.5 join=round
    poly 74,154 110,196 146,154 134,150 110,174 86,150 fill=suit_dk stroke=#0a1526/2 join=round
    path "M 66 154 L 84 188 L 110 204 L 136 188 L 154 154 L 142 150 L 110 186 L 78 150 Z" fill=#eef6ff stroke=#0e2038/2 join=round
    poly 46,168 64,160 80,232 60,232 fill=suit_dk stroke=#0a1526/1.8
    poly 174,168 156,160 140,232 160,232 fill=suit_dk stroke=#0a1526/1.8
    line 56 168 72 224 stroke=#7ef5ff/3.2 cap=round
    line 164 168 148 224 stroke=#7ef5ff/3.2 cap=round
    rect 98 204 24 8 r=3 fill=#10243d stroke=#7ef5ff/1.5
    circle 110 208 3 fill=#a8ffff blend=add

    path "M 54 78 L 40 118 L 62 128 L 54 144 L 86 146 L 140 146 L 166 138 L 158 122 L 176 108 L 162 66 L 146 32 L 74 30 Z" fill=hair_dark stroke=#070e1f/2.2 join=round
    path "M 94 130 L 92 162 Q 110 172 128 162 L 126 130 Z" fill=skin stroke=#8a5742/1.4
    path "M 94 134 Q 110 152 126 134 L 126 146 Q 110 160 94 146 Z" fill=skin_sh opacity=0.65

    ellipse 67 104 7 11 fill=skin stroke=#8a5742/1.5
    ellipse 152 104 7 11 fill=skin stroke=#8a5742/1.5
    rect 58 95 10 20 r=4 fill=#1e3454 stroke=#7ef5ff/2
    circle 63 105 2.8 fill=#a8ffff blend=add

    path "M 69 72 Q 68 112 84 132 Q 100 148 112 149 Q 126 148 140 130 Q 152 110 150 72 Q 148 44 110 44 Q 70 44 69 72 Z" fill=skin stroke=#8a5742/1.8
    ellipse 86 112 11 5 fill=#ff8a78 opacity=0.28
    ellipse 134 112 11 5 fill=#ff8a78 opacity=0.28
    path "M 145 78 Q 146 108 136 128" fill=none stroke=#9ef8ff/2.4 cap=round opacity=0.7
    path "M 72 68 Q 92 84 112 78 Q 132 84 148 70 L 146 54 L 74 54 Z" fill=#c48368 opacity=0.32

    path "M 77 98 Q 89 87 102 96 Q 99 107 88 107 Q 78 106 77 98 Z" fill=#ffffff
    path "M 120 96 Q 133 87 144 98 Q 143 106 133 107 Q 122 107 120 96 Z" fill=#ffffff
    ellipse 91 98 7.5 8.2 fill=iris stroke=#0a1e36/1.2
    ellipse 131 98 7.5 8.2 fill=iris stroke=#0a1e36/1.2
    circle 91 98 3.2 fill=#071526
    circle 131 98 3.2 fill=#071526
    path "M 86 102 Q 91 106 96 102" fill=none stroke=#c8ffff/2.4 cap=round
    path "M 126 102 Q 131 106 136 102" fill=none stroke=#c8ffff/2.4 cap=round
    circle 87 94 2.9 fill=#ffffff
    circle 127 94 2.9 fill=#ffffff
    circle 95 101 1.4 fill=#ffffff
    circle 135 101 1.4 fill=#ffffff
    path "M 74 95 Q 88 85 104 94" fill=none stroke=#091326/3.5 cap=round
    path "M 118 94 Q 134 85 147 95" fill=none stroke=#091326/3.5 cap=round
    # Confident raised brows
    path "M 75 79 Q 89 74 103 81" fill=none stroke=#14254d/2.8 cap=round
    path "M 119 81 Q 133 74 146 79" fill=none stroke=#14254d/2.8 cap=round

    path "M 111 108 L 113 115 L 110 116" fill=none stroke=#9c654d/1.6 cap=round join=round
    # Expressive anime grin
    path "M 97 125 Q 112 138 127 123 Q 112 128 97 125 Z" fill=#ffffff stroke=#7d4636/2 join=round
    line 108 137 115 137 stroke=#d49377/1.4 cap=round

    path "M 64 113 Q 76 130 94 130" fill=none stroke=#7ef5ff/2.2 cap=round
    circle 95 130 2.5 fill=#162944 stroke=#7ef5ff/1.4

    path "M 56 84 Q 50 44 82 24 Q 112 12 146 26 Q 172 42 164 84 L 152 106 L 146 72 L 136 92 L 128 62 L 114 96 L 104 60 L 90 94 L 82 64 L 68 104 Z" fill=hair_main stroke=#070e1f/2.2 join=round
    poly 88,26 74,10 104,20 fill=hair_main stroke=#070e1f/1.8 join=round
    poly 118,22 142,10 138,28 fill=hair_main stroke=#070e1f/1.8 join=round
    path "M 74 44 Q 94 34 110 40" fill=none stroke=#8ef6ff/4.2 cap=round opacity=0.85
    path "M 122 38 Q 138 34 150 44" fill=none stroke=#8ef6ff/3.8 cap=round opacity=0.8

    path "M 68 58 Q 110 44 152 58 L 147 70 Q 110 58 73 70 Z" fill=visor stroke=#a8ffff/2 join=round
    path "M 82 58 Q 108 51 134 57" fill=none stroke=#ffffff/2.2 cap=round opacity=0.75

@Sprite/commander/alert
size = [220, 240]
origin = [110, 120]
defs:
    aura      = radial(110 124 104, #ff9f4340 0, #7a2a1b22 0.62, #05081400 1)
    frame_bg  = linear(20 20 -> 200 226, #2e1424cc 0, #0d0816dd 1)
    skin      = linear(110 56 -> 108 148, #fae0cf 0, #e6b89e 0.7, #cc9174 1)
    skin_sh   = linear(110 124 -> 110 160, #ba7c62 0, #995d48 1)
    hair_main = linear(110 18 -> 110 152, #f7f9ff 0, #cad4eb 0.55, #7d8cb3 1)
    hair_sh   = linear(110 42 -> 110 164, #9aa8cc 0, #4d5a7d 1)
    coat      = linear(110 148 -> 110 236, #5e1a36 0, #330f24 0.55, #160712 1)
    lapel     = linear(110 148 -> 110 210, #8c274d 0, #4a122b 1)
    gold      = linear(40 160 -> 180 180, #fff0a8 0, #f5a623 0.6, #a65c08 1)
    iris      = linear(110 88 -> 110 106, #4a1a00 0, #f59227 0.5, #ffe27a 0.9, #fff8d6 1)
    lens      = radial(130 98 18, #ffe08a99 0, #ff8c2b66 0.6, #ff450011 1)
shapes:
    # Amber holographic command backing
    circle 110 124 102 fill=aura blend=add
    poly 36,30 196,30 196,214 182,228 18,228 18,48 fill=frame_bg stroke=#ff9f4355/1.5 join=round
    line 162 42 188 42 stroke=#ff9f43/2 cap=round opacity=0.75
    line 26 218 52 218 stroke=#ff9f43/2 cap=round opacity=0.75

    # Flowing layered silver back hair
    path "M 54 68 Q 36 116 42 166 L 78 172 L 142 172 L 178 166 Q 184 116 166 68 Q 152 26 110 26 Q 68 26 54 68 Z" fill=hair_sh stroke=#2c3652/2 join=round

    # High-collar fleet commander coat & gold epaulets
    path "M 20 232 Q 36 168 74 152 L 146 152 Q 184 168 200 232 Z" fill=coat stroke=#0d040c/2.5 join=round
    poly 66,150 92,196 110,180 128,196 154,150 140,146 110,168 80,146 fill=lapel stroke=#ffbe5c/2 join=round
    # Gold shoulder epaulets & tactical piping
    rect 38 164 26 9 r=3 fill=gold stroke=#3b1c04/1.5
    rect 156 164 26 9 r=3 fill=gold stroke=#3b1c04/1.5
    line 88 186 84 228 stroke=#ffbe5c/2 cap=round
    line 132 186 136 228 stroke=#ffbe5c/2 cap=round
    circle 110 184 5 fill=gold stroke=#3b1c04/1.5

    # Neck & shadow
    path "M 96 128 L 94 158 Q 110 168 126 158 L 124 128 Z" fill=skin stroke=#8a5742/1.4
    path "M 96 132 Q 110 148 124 132 L 124 144 Q 110 156 96 144 Z" fill=skin_sh opacity=0.6

    # Ears
    ellipse 68 104 6.5 10 fill=skin stroke=#8a5742/1.4
    ellipse 151 104 6.5 10 fill=skin stroke=#8a5742/1.4

    # Sharp sculpted anime face
    path "M 70 72 Q 70 112 86 132 Q 100 146 110 147 Q 120 146 134 132 Q 150 112 150 72 Q 148 44 110 44 Q 72 44 70 72 Z" fill=skin stroke=#8a5742/1.7
    path "M 75 78 Q 74 108 84 126" fill=none stroke=#ffd166/2 cap=round opacity=0.5
    path "M 73 66 Q 94 82 114 74 Q 134 80 147 68 L 146 52 L 74 52 Z" fill=#b87b64 opacity=0.28

    # Sharp focused amber-gold anime eyes
    path "M 78 97 Q 90 90 102 97 Q 99 105 89 105 Q 80 105 78 97 Z" fill=#ffffff
    path "M 118 97 Q 130 90 142 97 Q 140 105 131 105 Q 121 105 118 97 Z" fill=#ffffff
    ellipse 90 98 6.5 7 fill=iris stroke=#2e1204/1.2
    ellipse 130 98 6.5 7 fill=iris stroke=#2e1204/1.2
    circle 90 98 2.9 fill=#1f0a03
    circle 130 98 2.9 fill=#1f0a03
    path "M 86 102 Q 90 105 94 102" fill=none stroke=#fff3b8/2 cap=round
    path "M 126 102 Q 130 105 134 102" fill=none stroke=#fff3b8/2 cap=round
    circle 87 95 2.2 fill=#ffffff
    circle 127 95 2.2 fill=#ffffff
    # Winged upper lashes & sharp angled brows
    path "M 75 95 Q 89 88 104 96" fill=none stroke=#1b1226/3.4 cap=round
    path "M 116 96 Q 131 88 145 95" fill=none stroke=#1b1226/3.4 cap=round
    path "M 76 83 Q 90 82 103 87" fill=none stroke=#4a587a/2.6 cap=round
    path "M 117 87 Q 130 82 144 83" fill=none stroke=#4a587a/2.6 cap=round

    # Nose & resolute lips
    path "M 109 108 L 107 115 L 110 116" fill=none stroke=#9c654d/1.5 cap=round join=round
    path "M 100 128 Q 110 127 120 128" fill=none stroke=#8a3d3d/2.2 cap=round
    line 106 132 114 132 stroke=#c97b7b/1.6 cap=round opacity=0.7

    # Sleek asymmetrical silver-platinum anime bangs & cheek-framing locks
    path "M 54 88 Q 52 38 88 22 Q 116 14 146 28 Q 168 44 166 92 L 154 134 L 146 84 L 132 62 L 116 88 L 104 58 L 86 92 L 74 72 L 64 134 Z" fill=hair_main stroke=#344061/2 join=round
    # Crisp white hair halo highlights
    path "M 74 44 Q 98 34 124 40" fill=none stroke=#ffffff/4 cap=round opacity=0.9
    path "M 134 44 Q 146 48 154 56" fill=none stroke=#ffffff/3 cap=round opacity=0.75

    # Glowing holographic amber tactical eyepiece + reticle
    rect 114 86 32 24 r=6 fill=lens stroke=#ff9f43/2.2 blend=add
    circle 130 98 6.5 fill=none stroke=#ffe08a/1.4 opacity=0.9
    line 121 98 125 98 stroke=#ffe08a/1.2 cap=round
    line 135 98 139 98 stroke=#ffe08a/1.2 cap=round
    line 130 89 130 93 stroke=#ffe08a/1.2 cap=round
    line 130 103 130 107 stroke=#ffe08a/1.2 cap=round
    path "M 146 98 L 156 96 L 154 106" fill=none stroke=#ff9f43/2.2 cap=round join=round

# --- Lip-sync talk frames (inherited via extends) ---

@Sprite/pilot/calm/talk1
extends = pilot/calm
shapes:
    ellipse 111 131 13 6 fill=skin
    path "M 102 128 Q 111 126 120 128 Q 118 134 111 134 Q 104 134 102 128 Z" fill=#6e242a stroke=#7d4636/1.6 join=round
    line 105 129 117 129 stroke=#ffffff/1.8 cap=round

@Sprite/pilot/calm/talk2
extends = pilot/calm
shapes:
    ellipse 111 131 14 7 fill=skin
    path "M 101 126 Q 111 124 121 126 Q 119 138 111 138 Q 103 138 101 126 Z" fill=#631d24 stroke=#7d4636/1.8 join=round
    path "M 104 127 L 118 127 L 117 130 L 105 130 Z" fill=#ffffff
    ellipse 111 135 5 2.4 fill=#d96b75

@Animation/pilot/calm/talk
frames = ["pilot/calm", "pilot/calm/talk1", "pilot/calm/talk2", "pilot/calm/talk1"]
fps = 12

@Sprite/pilot/grin/talk1
extends = pilot/grin
shapes:
    ellipse 112 131 16 8 fill=skin
    path "M 99 127 Q 112 125 125 126 Q 122 134 112 135 Q 102 134 99 127 Z" fill=#6e242a stroke=#7d4636/1.7 join=round
    path "M 102 127 L 122 127 L 120 130 L 104 130 Z" fill=#ffffff

@Sprite/pilot/grin/talk2
extends = pilot/grin
shapes:
    ellipse 112 131 17 9 fill=skin
    path "M 98 125 Q 112 123 126 124 Q 123 139 112 139 Q 101 139 98 125 Z" fill=#631d24 stroke=#7d4636/1.8 join=round
    path "M 101 126 L 123 126 L 121 130 L 103 130 Z" fill=#ffffff
    ellipse 112 135 6 2.6 fill=#df727c

@Animation/pilot/grin/talk
frames = ["pilot/grin", "pilot/grin/talk1", "pilot/grin/talk2", "pilot/grin/talk1"]
fps = 13

@Sprite/commander/alert/talk1
extends = commander/alert
shapes:
    ellipse 110 129 13 6 fill=skin
    path "M 101 127 Q 110 125 119 127 Q 117 133 110 133 Q 103 133 101 127 Z" fill=#69202b stroke=#8a3d3d/1.7 join=round
    line 104 128 116 128 stroke=#ffffff/1.6 cap=round

@Sprite/commander/alert/talk2
extends = commander/alert
shapes:
    ellipse 110 129 14 7 fill=skin
    path "M 100 125 Q 110 123 120 125 Q 118 137 110 137 Q 102 137 100 125 Z" fill=#5c1824 stroke=#8a3d3d/1.8 join=round
    path "M 103 126 L 117 126 L 116 129 L 104 129 Z" fill=#ffffff
    ellipse 110 134 4.8 2.2 fill=#cf6370

@Animation/commander/alert/talk
frames = ["commander/alert", "commander/alert/talk1", "commander/alert/talk2", "commander/alert/talk1"]
fps = 12

# --- Antagonist portrait: ADMIRAL VEX (Eclipse Armada) ---

@Sprite/vex/smirk
size = [220, 240]
origin = [110, 120]
defs:
    aura      = radial(110 124 104, #ff2e6344 0, #5c0a3822 0.62, #05081400 1)
    frame_bg  = linear(20 20 -> 200 226, #260a1ecc 0, #0b0512dd 1)
    skin      = linear(110 56 -> 110 148, #e8dce8 0, #c9b5cc 0.72, #9e84a6 1)
    skin_sh   = linear(110 124 -> 110 160, #876c94 0, #5c436b 1)
    hair_main = linear(110 14 -> 110 148, #2b123d 0, #160824 0.6, #090312 1)
    armor     = linear(110 148 -> 110 236, #30112e 0, #19071a 0.55, #0a030d 1)
    visor     = linear(72 86 -> 148 102, #ff2e63 0, #ff7096 0.5, #b80f3c 1)
shapes:
    circle 110 124 102 fill=aura blend=add
    poly 36,30 196,30 196,214 182,228 18,228 18,48 fill=frame_bg stroke=#ff2e6366/1.8 join=round
    line 158 42 188 42 stroke=#ff2e63/2.2 cap=round opacity=0.85
    line 26 218 56 218 stroke=#ff2e63/2.2 cap=round opacity=0.85

    # Spiky dark-violet back hair
    path "M 48 76 L 34 128 L 60 146 L 160 146 L 186 128 L 172 76 L 150 24 L 70 24 Z" fill=hair_main stroke=#05020a/2.2 join=round

    # High-collared obsidian armada cloak & crimson trim
    path "M 16 232 Q 32 164 70 148 L 150 148 Q 188 164 204 232 Z" fill=armor stroke=#050208/2.5 join=round
    poly 56,144 82,198 110,178 138,198 164,144 150,140 110,164 70,140 fill=#4a102b stroke=#ff2e63/2 join=round
    line 44 166 72 226 stroke=#ff2e63/2.8 cap=round
    line 176 166 148 226 stroke=#ff2e63/2.8 cap=round
    poly 110,180 120,196 110,212 100,196 fill=#ff2e63 stroke=#ff99b8/1.5

    # Neck & shadow
    path "M 95 128 L 93 158 Q 110 168 127 158 L 125 128 Z" fill=skin stroke=#5e496b/1.4
    path "M 95 132 Q 110 148 125 132 L 125 144 Q 110 156 95 144 Z" fill=skin_sh opacity=0.65

    # Sharp angular villain face
    path "M 70 72 Q 71 112 88 134 Q 102 148 110 149 Q 118 148 132 134 Q 149 112 150 72 Q 148 44 110 44 Q 72 44 70 72 Z" fill=skin stroke=#5e496b/1.8
    # Cybernetic crimson visor across both eyes
    path "M 68 88 L 110 94 L 152 88 L 146 105 L 110 109 L 74 105 Z" fill=#1a0614 stroke=#ff2e63/2.2 join=round
    path "M 76 93 L 106 97 L 104 102 L 78 99 Z" fill=visor blend=add
    path "M 144 93 L 114 97 L 116 102 L 142 99 Z" fill=visor blend=add
    line 82 95 100 98 stroke=#ffffff/1.8 cap=round opacity=0.85
    line 138 95 120 98 stroke=#ffffff/1.8 cap=round opacity=0.85

    # Sharp nose & sinister smirk
    path "M 109 109 L 107 116 L 111 117" fill=none stroke=#6e547a/1.6 cap=round
    path "M 96 128 Q 111 135 126 123" fill=none stroke=#3d1930/2.4 cap=round
    line 106 134 115 134 stroke=#8f739e/1.4 cap=round

    # Swept dark-violet anime bangs with crimson-magenta highlight
    path "M 54 84 Q 52 36 86 20 Q 114 10 148 24 Q 170 40 166 86 L 152 104 L 144 68 L 128 88 L 114 56 L 96 90 L 82 62 L 66 102 Z" fill=hair_main stroke=#05020a/2 join=round
    path "M 74 42 Q 104 30 142 42" fill=none stroke=#c74b8c/3.5 cap=round opacity=0.75

@Sprite/vex/smirk/talk1
extends = vex/smirk
shapes:
    ellipse 111 129 16 7 fill=skin
    path "M 98 127 Q 111 124 124 125 Q 121 134 111 134 Q 101 134 98 127 Z" fill=#420d1d stroke=#3d1930/1.8 join=round
    line 102 127 120 126 stroke=#ffffff/1.8 cap=round

@Sprite/vex/smirk/talk2
extends = vex/smirk
shapes:
    ellipse 111 129 17 8 fill=skin
    path "M 97 125 Q 111 122 125 123 Q 122 138 111 138 Q 100 138 97 125 Z" fill=#360816 stroke=#3d1930/1.8 join=round
    path "M 100 125 L 122 124 L 120 128 L 102 129 Z" fill=#ffffff
    ellipse 111 134 5.5 2.4 fill=#b83758

@Animation/vex/smirk/talk
frames = ["vex/smirk", "vex/smirk/talk1", "vex/smirk/talk2", "vex/smirk/talk1"]
fps = 12
sectors_sprites.rune
#!RUNE
# Themed enemies, hazards, terrain, and bosses for Star Viper's 6 branching sectors.

# --- ICE SECTOR (Cryo Drift) ---

@Sprite/ice_shard
size = [64, 52]
origin = [32, 26]
defs:
    crystal = linear(8 6 -> 56 46, #ffffff 0, #9beeff 0.45, #2b82b8 1)
    glow    = radial(32 26 28, #a8f8ff55 0, #38bdf800 1)
shapes:
    circle 32 26 26 fill=glow blend=add
    poly 4,26 24,6 58,18 46,44 18,46 fill=crystal stroke=#e0ffff/2 join=round
    poly 24,6 38,24 18,46 12,26 fill=#d6fbff opacity=0.55
    line 14 26 48 22 stroke=#ffffff/2 cap=round opacity=0.8

@Sprite/cryo_drone
size = [64, 50]
origin = [32, 25]
defs:
    hull = linear(10 6 -> 54 44, #e0faff 0, #67c8eb 0.55, #1e4b75 1)
    core = radial(26 25 9, #ffffff 0, #7ef5ff 0.55, #1b6ca8 1)
shapes:
    poly 6,25 22,5 54,12 46,25 54,38 22,45 fill=hull stroke=#0c2640/2.2 join=round
    circle 26 25 8 fill=core stroke=#ffffff/1.5
    line 34 15 50 18 stroke=#ffffff/2 cap=round
    line 34 35 50 32 stroke=#ffffff/2 cap=round

@Sprite/boss_ice
size = [184, 156]
origin = [92, 78]
defs:
    prism = linear(24 8 -> 160 148, #f0fdff 0, #79daf5 0.45, #1d578a 1)
    wing  = linear(20 4 -> 160 152, #b8f5ff 0, #3898c9 0.55, #103259 1)
    core  = radial(70 78 28, #ffffff 0, #7ef5ff 0.45, #0077b6 0.85, #03254c 1)
    aura  = radial(70 78 48, #9ef8ff77 0, #38bdf822 0.6, #05081400 1)
shapes:
    circle 70 78 46 fill=aura blend=add
    poly 38,6 146,16 176,56 126,64 58,42 fill=wing stroke=#e0ffff/2 join=round
    poly 38,150 146,140 176,100 126,92 58,114 fill=wing stroke=#e0ffff/2 join=round
    poly 14,78 68,30 158,46 174,78 158,110 68,126 fill=prism stroke=#0c2947/2.8 join=round
    poly 70,50 96,78 70,106 44,78 fill=core stroke=#ffffff/2.5 join=round
    circle 70 78 10 fill=#ffffff opacity=0.9
    line 96 58 150 62 stroke=#ffffff/2.5 cap=round opacity=0.75
    line 96 98 150 94 stroke=#ffffff/2.5 cap=round opacity=0.75

@Sprite/boss_ice_hit
extends = boss_ice
shapes:
    poly 14,78 68,30 158,46 174,78 158,110 68,126 fill=#ffffff opacity=0.75

# --- NOXIOUS CLOUD SECTOR (Venom Nebula) ---

@Sprite/toxic_cloud
size = [180, 120]
origin = [90, 60]
defs:
    gas1 = radial(70 58 58, #a3ff4755 0, #4ea82a33 0.55, #0c261200 1)
    gas2 = radial(114 62 52, #d4ff5c44 0, #36802022 0.6, #0c261200 1)
shapes:
    circle 70 58 56 fill=gas1 blend=add
    circle 114 62 50 fill=gas2 blend=add
    circle 90 50 32 fill=gas1 blend=add

@Sprite/spore_pod
size = [58, 52]
origin = [29, 26]
defs:
    sac  = radial(26 26 22, #d9ff66 0, #5bbf2a 0.55, #1b4d18 1)
    glow = radial(26 26 26, #b8ff4d66 0, #2ecc7100 1)
shapes:
    circle 26 26 25 fill=glow blend=add
    ellipse 29 26 21 17 fill=sac stroke=#112e11/2.2
    circle 21 22 6 fill=#f0ff99 opacity=0.85
    circle 36 31 5 fill=#a3ff47 opacity=0.75
    line 8 18 16 22 stroke=#d9ff66/2.2 cap=round
    line 8 34 16 30 stroke=#d9ff66/2.2 cap=round

@Sprite/boss_venom
size = [184, 156]
origin = [92, 78]
defs:
    hive = linear(24 14 -> 160 142, #78c840 0, #2d6e22 0.55, #102b14 1)
    core = radial(68 78 28, #f7ffad 0, #a3ff33 0.45, #2e7d19 0.85, #0e2e0c 1)
    aura = radial(68 78 48, #a3ff3377 0, #2ecc7122 0.6, #05081400 1)
shapes:
    circle 68 78 46 fill=aura blend=add
    ellipse 104 42 54 24 fill=hive stroke=#0a1f0d/2.5
    ellipse 104 114 54 24 fill=hive stroke=#0a1f0d/2.5
    ellipse 96 78 74 44 fill=hive stroke=#0a1f0d/3
    circle 68 78 24 fill=core stroke=#eaff99/2.5
    circle 64 74 8 fill=#ffffff opacity=0.85
    circle 126 56 11 fill=#a3ff47 opacity=0.7
    circle 126 100 11 fill=#a3ff47 opacity=0.7
    rect 10 38 36 14 r=5 fill=#b8ff5c stroke=#133312/2
    rect 10 104 36 14 r=5 fill=#b8ff5c stroke=#133312/2

@Sprite/boss_venom_hit
extends = boss_venom
shapes:
    ellipse 96 78 74 44 fill=#ffffff opacity=0.72

# --- ASTEROID CAVE SECTOR (Hollow Rock + Space Worm Boss!) ---

@Sprite/cave_wall_top
size = [160, 110]
origin = [80, 0]
defs:
    rock = linear(80 0 -> 80 110, #261e2e 0, #4a3a52 0.55, #6e5573 1)
shapes:
    poly 0,0 160,0 160,48 134,88 102,58 76,104 44,64 18,92 0,52 fill=rock stroke=#140e1a/2.5 join=round
    line 76 96 86 58 stroke=#9c7fa3/2 cap=round opacity=0.55
    line 134 80 124 44 stroke=#9c7fa3/2 cap=round opacity=0.45

@Sprite/cave_wall_bot
size = [160, 110]
origin = [80, 110]
defs:
    rock = linear(80 110 -> 80 0, #261e2e 0, #4a3a52 0.55, #6e5573 1)
shapes:
    poly 0,110 160,110 160,56 132,20 104,56 72,8 42,52 16,26 0,62 fill=rock stroke=#140e1a/2.5 join=round
    line 72 16 82 54 stroke=#9c7fa3/2 cap=round opacity=0.55
    line 132 28 122 64 stroke=#9c7fa3/2 cap=round opacity=0.45

@Sprite/boss_worm_seg
size = [76, 76]
origin = [38, 38]
defs:
    carapace = radial(32 30 34, #b5836b 0, #6e3d3a 0.55, #2b151e 1)
    core     = radial(38 38 12, #ffcf70 0, #ff6b35 0.65, #6e1423 1)
shapes:
    circle 38 38 33 fill=carapace stroke=#170910/3
    poly 22,12 54,12 64,38 54,64 22,64 12,38 fill=none stroke=#d99b7e/2 opacity=0.55
    circle 38 38 10 fill=core stroke=#2b0b12/1.8

@Sprite/boss_worm_head
size = [120, 108]
origin = [60, 54]
defs:
    armor = radial(54 48 52, #d48c6a 0, #7d3338 0.55, #2b0f1c 1)
    maw   = radial(24 54 22, #ffffff 0, #ff5e4d 0.45, #6e0d25 1)
    eye   = radial(48 34 8, #fff5b8 0, #ff4d6d 0.6, #590a1d 1)
shapes:
    # Twin articulated mandibles
    poly 6,24 44,14 58,34 26,38 fill=#f2d5c4 stroke=#240a12/2.5 join=round
    poly 6,84 44,94 58,74 26,70 fill=#f2d5c4 stroke=#240a12/2.5 join=round
    # Glowing plasma maw
    ellipse 32 54 20 18 fill=maw blend=add
    # Armored head plate
    ellipse 68 54 46 42 fill=armor stroke=#1a0810/3
    # Glowing predator eyes
    circle 48 34 7 fill=eye stroke=#24080e/1.8
    circle 48 74 7 fill=eye stroke=#24080e/1.8
    circle 46 32 2.2 fill=#ffffff
    circle 46 72 2.2 fill=#ffffff
    line 74 28 102 36 stroke=#ff9f70/2.5 cap=round opacity=0.7
    line 74 80 102 72 stroke=#ff9f70/2.5 cap=round opacity=0.7

@Sprite/boss_worm_head_hit
extends = boss_worm_head
shapes:
    ellipse 68 54 46 42 fill=#ffffff opacity=0.78

# --- SOLAR FORGE & ECLIPSE CITADEL BOSSES ---

@Sprite/boss_solar
size = [184, 156]
origin = [92, 78]
defs:
    ring = linear(20 10 -> 164 146, #fff0a8 0, #ff8c2b 0.5, #b82514 1)
    sun  = radial(82 78 36, #ffffff 0, #ffe066 0.4, #ff6b2b 0.78, #8c140a00 1)
    aura = radial(82 78 58, #ffaa3b88 0, #ff450022 0.6, #05081400 1)
shapes:
    circle 82 78 56 fill=aura blend=add
    circle 82 78 58 fill=none stroke=ring/14
    poly 16,78 54,48 54,108 fill=#ff8c2b stroke=#3d0c06/2.2 join=round
    poly 148,78 110,48 110,108 fill=#ff8c2b stroke=#3d0c06/2.2 join=round
    circle 82 78 32 fill=sun blend=add
    circle 82 78 16 fill=#ffffff

@Sprite/boss_solar_hit
extends = boss_solar
shapes:
    circle 82 78 54 fill=#ffffff opacity=0.72

@Sprite/boss_eclipse
size = [204, 170]
origin = [102, 85]
defs:
    hull  = linear(20 10 -> 184 160, #5c337a 0, #28103d 0.55, #0d0517 1)
    blade = linear(24 4 -> 180 166, #ff2e63 0, #8a1442 0.6, #260618 1)
    core  = radial(76 85 30, #ffffff 0, #ff2e63 0.45, #6e0d4d 0.85, #1f031a 1)
    aura  = radial(76 85 52, #ff2e6388 0, #a855f733 0.6, #05081400 1)
shapes:
    circle 76 85 50 fill=aura blend=add
    poly 28,6 168,20 196,64 136,68 62,46 fill=blade stroke=#120414/3 join=round
    poly 28,164 168,150 196,106 136,102 62,124 fill=blade stroke=#120414/3 join=round
    poly 14,85 74,34 172,48 192,85 172,122 74,136 fill=hull stroke=#ff2e63/2.5 join=round
    rect 6 44 46 14 r=4 fill=#e4c7ff stroke=#1a0624/2
    rect 6 112 46 14 r=4 fill=#e4c7ff stroke=#1a0624/2
    line 10 51 46 51 stroke=#ff2e63/3 cap=round
    line 10 119 46 119 stroke=#ff2e63/3 cap=round
    ellipse 76 85 26 22 fill=core stroke=#ffb8cf/2.5
    ellipse 72 81 10 7 fill=#ffffff opacity=0.88
    line 114 64 166 68 stroke=#ff2e63/3 cap=round
    line 114 106 166 102 stroke=#ff2e63/3 cap=round

@Sprite/boss_eclipse_hit
extends = boss_eclipse
shapes:
    poly 14,85 74,34 172,48 192,85 172,122 74,136 fill=#ffffff opacity=0.75
sound.rune
#!RUNE
# Star Viper synth soundtrack — 16-bar main anthem, 8-bar boss theme, and SFX.

@Music/star_viper
type = 8bit
tempo = 138
time_signature = 4/4
bars = 16
loop = true
volume = 0.11
instruments = {"lead": "brass", "harmony": "strings", "bass": "triangle", "drums": "drums"}
lead:
    # A1: Heroic launch motif (bars 1-4)
    E4:8 -:8 G4:8 A4:8 B4:4 A4:8 G4:8 |
    F#4:8 G4:8 A4:4 E4:4 -:4 |
    C4:8 D4:8 E4:8 G4:8 A4:4 G4:8 E4:8 |
    B3:8 D4:8 F#4:8 A4:8 G4:4 E4:4 |
    # A2: Soaring variation (bars 5-8)
    E4:8 -:8 G4:8 A4:8 B4:4 D5:8 B4:8 |
    A4:8 B4:8 C5:4 B4:4 G4:4 |
    A4:8 G4:8 F#4:8 E4:8 D4:4 F#4:8 A4:8 |
    B4:2 -:4 G4:8 A4:8 |
    # B: Starfield bridge (bars 9-12)
    C5:4 B4:8 A4:8 G4:4 E4:4 |
    D5:4 C5:8 B4:8 A4:4 F#4:4 |
    E4:8 G4:8 B4:8 D5:8 C5:4 B4:8 A4:8 |
    B4:2. -:4 |
    # C: Full-throttle chorus (bars 13-16)
    E5:8 -:8 D5:8 B4:8 A4:4 G4:8 A4:8 |
    B4:8 A4:8 G4:8 F#4:8 E4:4 G4:4 |
    A4:8 B4:8 C5:8 D5:8 B4:4 A4:8 G4:8 |
    F#4:8 G4:8 A4:8 F#4:8 E4:2
harmony:
    [E3,G3,B3]:2 [E3,G3,B3]:2 |
    [D3,F#3,A3]:2 [E3,G3,B3]:2 |
    [C3,E3,G3]:2 [A3,C4,E4]:2 |
    [B2,D3,F#3]:2 [E3,G3,B3]:2 |
    [E3,G3,B3]:2 [G3,B3,D4]:2 |
    [A3,C4,E4]:2 [G3,B3,D4]:2 |
    [D3,F#3,A3]:2 [D3,F#3,A3]:2 |
    [B2,D#3,F#3]:2 [B2,D#3,F#3]:2 |
    [C3,E3,G3]:2 [E3,G3,B3]:2 |
    [D3,F#3,A3]:2 [D3,F#3,A3]:2 |
    [E3,G3,B3]:2 [A3,C4,E4]:2 |
    [B2,D#3,F#3]:2 [B2,D#3,F#3]:2 |
    [E3,G3,B3]:2 [A3,C4,E4]:2 |
    [G3,B3,D4]:2 [E3,G3,B3]:2 |
    [C3,E3,G3]:2 [G3,B3,D4]:2 |
    [B2,D#3,F#3]:2 [E3,G3,B3]:2
bass:
    E2:8 E2:8 E3:8 E2:8 E2:8 E2:8 D3:8 B2:8 |
    D2:8 D2:8 D3:8 D2:8 E2:8 E2:8 B2:8 G2:8 |
    C2:8 C2:8 C3:8 C2:8 A1:8 A1:8 A2:8 G2:8 |
    B1:8 B1:8 F#2:8 B1:8 E2:4 B1:4 |
    E2:8 E2:8 E3:8 E2:8 G2:8 G2:8 D3:8 B2:8 |
    A1:8 A1:8 A2:8 A1:8 G1:8 G1:8 G2:8 D2:8 |
    D2:8 D2:8 A2:8 D2:8 D2:8 D2:8 A2:8 F#2:8 |
    B1:8 B1:8 F#2:8 B1:8 B1:8 B1:8 D2:8 F#2:8 |
    C2:8 C2:8 G2:8 C2:8 E2:8 E2:8 B2:8 E2:8 |
    D2:8 D2:8 A2:8 D2:8 D2:8 D2:8 A2:8 F#2:8 |
    E2:8 E2:8 B2:8 E2:8 A1:8 A1:8 E2:8 A2:8 |
    B1:8 B1:8 F#2:8 B1:8 B1:8 D#2:8 F#2:8 B2:8 |
    E2:8 E2:8 E3:8 E2:8 A1:8 A1:8 A2:8 A1:8 |
    G1:8 G1:8 G2:8 G1:8 E2:8 E2:8 B2:8 E2:8 |
    C2:8 C2:8 G2:8 C2:8 G1:8 G1:8 D2:8 G2:8 |
    B1:8 B1:8 F#2:8 B1:8 E2:4 B1:4
drums:
    [kick,crash]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 kick:8 [snare,hihat]:8 tom:8 tom:8 hihat:8 |
    [kick,crash]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 kick:8 snare:8 snare:8 tom:8 crash:8 |
    [kick,crash]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 snare:8 tom:8 snare:8 tom:8 |
    [kick,crash]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 hihat:8 [snare,hihat]:8 hihat:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 [snare,hihat]:8 tom:8 [kick,crash]:4

@Music/boss_battle
type = 8bit
tempo = 152
time_signature = 4/4
bars = 8
loop = true
volume = 0.12
instruments = {"lead": "brass", "harmony": "pluck", "bass": "triangle", "drums": "drums"}
lead:
    E4:8 F4:8 E4:8 G4:8 F4:4 E4:4 |
    D4:8 E4:8 F4:8 A4:8 G4:4 E4:4 |
    B4:8 C5:8 B4:8 A4:8 G4:4 F4:4 |
    E4:4 G4:4 F4:8 E4:8 D4:4 |
    E4:8 G4:8 B4:8 C5:8 B4:4 A4:4 |
    G4:8 A4:8 B4:8 D5:8 C5:4 B4:4 |
    A4:8 G4:8 F4:8 E4:8 F4:4 G4:4 |
    E4:2 -:4 B3:4
harmony:
    E3:8 B3:8 E4:8 B3:8 F3:8 C4:8 E3:8 B3:8 |
    D3:8 A3:8 F3:8 C4:8 G3:8 D4:8 E3:8 B3:8 |
    G3:8 D4:8 B3:8 F4:8 C3:8 G3:8 F3:8 C4:8 |
    E3:8 B3:8 G3:8 D4:8 F3:8 C4:8 D3:8 A3:8 |
    E3:8 B3:8 E4:8 B3:8 A3:8 E4:8 C4:8 E4:8 |
    G3:8 D4:8 B3:8 D4:8 C4:8 G4:8 B3:8 E4:8 |
    A3:8 E4:8 F3:8 C4:8 D3:8 A3:8 G3:8 D4:8 |
    E3:8 B3:8 E4:8 B3:8 E3:4 B2:4
bass:
    E2:8 E2:8 E2:8 E2:8 F2:8 F2:8 E2:8 E2:8 |
    D2:8 D2:8 F2:8 F2:8 G2:8 G2:8 E2:8 E2:8 |
    G2:8 G2:8 B2:8 B2:8 C2:8 C2:8 F2:8 F2:8 |
    E2:8 E2:8 G2:8 G2:8 F2:8 F2:8 D2:8 D2:8 |
    E2:8 E2:8 E3:8 E2:8 A1:8 A1:8 A2:8 A1:8 |
    G1:8 G1:8 G2:8 G1:8 C2:8 C2:8 B1:8 B1:8 |
    A1:8 A1:8 F1:8 F1:8 D2:8 D2:8 G2:8 G2:8 |
    E2:8 E2:8 B1:8 B1:8 E2:4 B1:4
drums:
    [kick,crash]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 tom:8 snare:8 tom:8 snare:8 crash:8 |
    [kick,crash]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 [kick,hihat]:8 kick:8 [snare,hihat]:8 hihat:8 |
    [kick,hihat]:8 kick:8 [snare,hihat]:8 kick:8 tom:8 tom:8 [snare,crash]:4

@Sound/fire_pulse
wave = square
freq = 920 -> 360
duration = 45ms
volume = 0.045

@Sound/fire_laser
wave = sawtooth
freq = 1280 -> 480
duration = 70ms
volume = 0.05

@Sound/enemy_boom
wave = noise
filter = lowpass 1100 -> 80
duration = 150ms
volume = 0.12

@Sound/boss_boom
wave = noise
filter = lowpass 1800 -> 35
duration = 480ms
volume = 0.20

@Sound/boss_warning
wave = sawtooth
sequence = A4:110ms, E4:110ms, A4:110ms, E4:160ms
volume = 0.09

@Sound/capsule_pickup
wave = triangle
sequence = C5:45ms, E5:45ms, G5:70ms
volume = 0.08

@Sound/power_activate
wave = square
sequence = E5:50ms, G5:50ms, B5:60ms, E6:110ms
volume = 0.09

@Sound/player_hit
wave = noise
filter = lowpass 1600 -> 45
duration = 320ms
volume = 0.18

@Sound/barrel_roll
wave = triangle
freq = 280 -> 760
duration = 160ms
volume = 0.08

@Sound/roll_deflect
wave = sine
freq = 1400 -> 2200
duration = 65ms
volume = 0.07
sprites.rune
#!RUNE
# Compact Rune Vector sprites for Star Viper (default type = svg).

@Sprite/viper/idle
size = [96, 64]
origin = [48, 32]
defs:
    hull     = linear(0 12 -> 0 52, #f5faff 0, #9bc6ec 0.55, #3a618c 1)
    wing     = linear(18 8 -> 18 56, #4b78a8 0, #233f63 1)
    canopy   = radial(58 29 14, #e3ffff 0, #46dceb 0.5, #104e6e 1)
    thruster = radial(16 32 18, #ffffff 0, #5ce1ff 0.42, #2b7cff00 1)
shapes:
    circle 16 32 16 fill=thruster blend=add
    poly 18,7 66,26 18,57 30,32 fill=wing stroke=#0b1624/2 join=round
    poly 88,32 22,14 34,32 22,50 fill=hull stroke=#0b1624/2.5 join=round
    poly 94,25 58,23 64,28 94,28 fill=#eef6ff
    poly 94,39 58,41 64,36 94,36 fill=#eef6ff
    ellipse 56 32 13 6 fill=canopy stroke=#0b2538/1.5
    ellipse 58 29 6 2 fill=#ffffff opacity=0.78
    line 32 32 76 32 stroke=#ff5e4d/3 cap=round

@Sprite/viper/up
size = [96, 64]
origin = [48, 32]
defs:
    hull     = linear(0 10 -> 0 50, #ffffff 0, #a8d2f4 0.5, #345a84 1)
    wing     = linear(18 10 -> 18 54, #5989ba 0, #1f3959 1)
    canopy   = radial(58 27 13, #e8ffff 0, #46dceb 0.5, #104e6e 1)
    thruster = radial(16 32 18, #ffffff 0, #5ce1ff 0.45, #2b7cff00 1)
shapes:
    circle 16 32 16 fill=thruster blend=add
    poly 18,12 66,25 18,52 30,31 fill=wing stroke=#0b1624/2 join=round
    poly 88,30 22,16 34,31 22,47 fill=hull stroke=#0b1624/2.5 join=round
    poly 94,24 58,22 64,27 94,27 fill=#eef6ff
    poly 94,36 58,38 64,34 94,34 fill=#dcecff
    ellipse 56 29 13 5 fill=canopy stroke=#0b2538/1.5
    ellipse 58 27 6 1.8 fill=#ffffff opacity=0.82
    line 32 30 76 30 stroke=#ff5e4d/2.5 cap=round

@Sprite/viper/down
size = [96, 64]
origin = [48, 32]
defs:
    hull     = linear(0 14 -> 0 54, #d6ebff 0, #7daed8 0.55, #2a4c74 1)
    wing     = linear(18 10 -> 18 54, #3b6694 0, #1b324e 1)
    canopy   = radial(58 34 13, #e3ffff 0, #46dceb 0.5, #104e6e 1)
    thruster = radial(16 32 18, #ffffff 0, #5ce1ff 0.45, #2b7cff00 1)
shapes:
    circle 16 32 16 fill=thruster blend=add
    poly 18,12 66,39 18,52 30,33 fill=wing stroke=#0b1624/2 join=round
    poly 88,34 22,17 34,33 22,48 fill=hull stroke=#0b1624/2.5 join=round
    poly 94,28 58,26 64,30 94,30 fill=#dcecff
    poly 94,40 58,42 64,37 94,37 fill=#eef6ff
    ellipse 56 35 13 5 fill=canopy stroke=#0b2538/1.5
    ellipse 58 33 6 1.8 fill=#ffffff opacity=0.72
    line 32 34 76 34 stroke=#ff5e4d/2.5 cap=round

@Sprite/option/1
size = [36, 36]
origin = [18, 18]
defs:
    glow = radial(18 18 16, #fff4d1 0, #ff8b3d 0.45, #ff451a00 1)
    core = radial(16 16 8, #ffffff 0, #ffd166 0.6, #e85d04 1)
shapes:
    circle 18 18 16 fill=glow blend=add
    ellipse 18 18 11 7 fill=core stroke=#fff0c2/1.5

@Sprite/option/2
size = [36, 36]
origin = [18, 18]
defs:
    glow = radial(18 18 18, #fff8dc 0, #ff9f43 0.5, #ff451a00 1)
    core = radial(16 16 9, #ffffff 0, #ffe08a 0.65, #f46d1e 1)
shapes:
    circle 18 18 17 fill=glow blend=add
    ellipse 18 18 12 8 fill=core stroke=#ffffff/1.5

@Sprite/scout
size = [56, 44]
origin = [28, 22]
defs:
    armor = linear(8 6 -> 48 38, #ff9966 0, #d9483b 0.55, #6e1c28 1)
    eye   = radial(22 22 7, #fff5b8 0, #ffbe3b 0.6, #b83300 1)
shapes:
    poly 6,22 26,6 48,14 40,22 48,30 26,38 fill=armor stroke=#240912/2 join=round
    circle 22 22 6 fill=eye stroke=#380c12/1.5
    line 30 14 44 17 stroke=#ffd1b3/2 cap=round
    line 30 30 44 27 stroke=#ffd1b3/2 cap=round

@Sprite/interceptor
size = [72, 56]
origin = [36, 28]
defs:
    plate = linear(12 4 -> 60 52, #c792ff 0, #6d3fb8 0.55, #2b1457 1)
    core  = radial(30 28 10, #ffffff 0, #ff5ca8 0.55, #7d114d 1)
shapes:
    poly 8,28 32,6 64,14 52,28 64,42 32,50 fill=plate stroke=#16082e/2.5 join=round
    poly 20,28 36,16 46,28 36,40 fill=#3e1e73 stroke=#e4c7ff/1.5
    circle 30 28 7 fill=core
    line 44 16 60 19 stroke=#7ef5ff/2.5 cap=round
    line 44 40 60 37 stroke=#7ef5ff/2.5 cap=round

@Sprite/capsule/1
size = [34, 34]
origin = [17, 17]
defs:
    aura = radial(17 17 16, #ffe08a 0, #ff7b29 0.45, #ff450000 1)
    pod  = linear(7 7 -> 27 27, #fff1b8 0, #ff8c2b 0.55, #b83214 1)
shapes:
    circle 17 17 15 fill=aura blend=add
    rect 7 9 20 16 r=6 fill=pod stroke=#fff5d6/1.8
    circle 17 17 4 fill=#ffffff opacity=0.9

@Sprite/capsule/2
size = [34, 34]
origin = [17, 17]
defs:
    aura = radial(17 17 17, #fff5cc 0, #ff9c3b 0.55, #ff450000 1)
    pod  = linear(7 7 -> 27 27, #ffffff 0, #ffa63b 0.55, #c93b14 1)
shapes:
    circle 17 17 16 fill=aura blend=add
    rect 6 8 22 18 r=7 fill=pod stroke=#ffffff/2
    circle 17 17 5 fill=#fff8d6

@Sprite/planet
size = [220, 160]
origin = [110, 80]
defs:
    globe = radial(90 62 72, #4a6fa5 0, #23345e 0.55, #0b1124 1)
    ring  = linear(10 100 -> 210 60, #7ec8ff00 0, #7ec8ff66 0.35, #c792ff88 0.65, #7ec8ff00 1)
shapes:
    ellipse 110 80 96 22 fill=none stroke=ring/10
    circle 110 80 54 fill=globe stroke=#6998d644/2
    ellipse 110 80 96 22 fill=none stroke=ring/6 opacity=0.75

@Sprite/asteroid
size = [68, 68]
origin = [34, 34]
defs:
    rock   = radial(24 22 36, #96a4b8 0, #556175 0.55, #252c3b 1)
    crater = radial(34 34 12, #232a38 0, #3a4559 1)
shapes:
    poly 18,6 46,4 62,22 60,48 42,64 16,60 4,40 8,18 fill=rock stroke=#141a26/2.5 join=round
    circle 26 26 9 fill=crater stroke=#6e7d94/1.2
    circle 45 42 7 fill=crater stroke=#6e7d94/1
    circle 44 20 4 fill=#343f54
    line 16 14 38 11 stroke=#c4d1e3/2 cap=round opacity=0.45

@Sprite/turret
size = [64, 52]
origin = [32, 26]
defs:
    shell = linear(10 6 -> 54 46, #7be0d6 0, #2b8a89 0.55, #123c45 1)
    glow  = radial(20 26 10, #ffffff 0, #ff6b9d 0.55, #8a1646 1)
shapes:
    rect 20 8 36 36 r=10 fill=shell stroke=#091d24/2.5
    rect 4 14 22 8 r=3 fill=#d4f5f2 stroke=#0d2b33/1.8
    rect 4 30 22 8 r=3 fill=#d4f5f2 stroke=#0d2b33/1.8
    circle 34 26 10 fill=glow stroke=#091d24/2
    circle 32 24 3 fill=#ffffff opacity=0.8

@Sprite/boss_core
size = [180, 150]
origin = [90, 75]
defs:
    hull   = linear(20 10 -> 160 140, #9db4d4 0, #485f82 0.5, #1b273d 1)
    wing   = linear(40 4 -> 140 146, #5f79a1 0, #2a3a59 0.6, #11192b 1)
    core   = radial(68 75 28, #ffffff 0, #ff4fa3 0.45, #7d1157 0.85, #38072b 1)
    aura   = radial(68 75 44, #ff66c488 0, #5ce1ff33 0.55, #05081400 1)
shapes:
    circle 68 75 44 fill=aura blend=add
    # Upper & lower armored carrier wings
    poly 32,8 148,18 172,54 132,62 66,44 fill=wing stroke=#091120/3 join=round
    poly 32,142 148,132 172,96 132,88 66,106 fill=wing stroke=#091120/3 join=round
    # Central dreadnought hull
    poly 20,56 76,34 156,44 174,75 156,106 76,116 20,94 42,75 fill=hull stroke=#091120/3 join=round
    # Twin forward energy cannons
    rect 8 36 44 14 r=4 fill=#d8e8ff stroke=#0e1c30/2
    rect 8 100 44 14 r=4 fill=#d8e8ff stroke=#0e1c30/2
    line 12 43 44 43 stroke=#5ce1ff/3 cap=round
    line 12 107 44 107 stroke=#5ce1ff/3 cap=round
    # Exposed glowing weak-point core
    ellipse 68 75 24 20 fill=core stroke=#ffd6ef/2.5
    ellipse 64 71 9 6 fill=#ffffff opacity=0.8
    # Hull trim & vents
    line 104 54 148 58 stroke=#5ce1ff/3 cap=round
    line 104 96 148 92 stroke=#5ce1ff/3 cap=round
    rect 116 68 38 14 r=4 fill=#0d182b stroke=#7ea6d6/1.8

@Sprite/boss_core_hit
size = [180, 150]
origin = [90, 75]
defs:
    flash  = linear(20 10 -> 160 140, #ffffff 0, #ffd6f0 0.55, #ff70b8 1)
    aura   = radial(68 75 50, #ffffffaa 0, #ff66c455 0.55, #05081400 1)
shapes:
    circle 68 75 48 fill=aura blend=add
    poly 32,8 148,18 172,54 132,62 66,44 fill=flash stroke=#ffffff/2 join=round
    poly 32,142 148,132 172,96 132,88 66,106 fill=flash stroke=#ffffff/2 join=round
    poly 20,56 76,34 156,44 174,75 156,106 76,116 20,94 42,75 fill=flash stroke=#ffffff/2.5 join=round
    ellipse 68 75 26 22 fill=#ffffff

@Sprite/boom/1
size = [96, 96]
origin = [48, 48]
defs:
    flash = radial(48 48 44, #ffffff 0, #fff4b8 0.35, #ff9f4388 0.7, #ff450000 1)
shapes:
    circle 48 48 44 fill=flash blend=add
    poly 48,4 56,36 92,48 56,60 48,92 40,60 4,48 40,36 fill=#ffffff opacity=0.95
    circle 48 48 20 fill=#ffffff

@Sprite/boom/2
size = [112, 112]
origin = [56, 56]
defs:
    fire  = radial(56 56 50, #ffffff 0, #ffe066 0.3, #ff7b29 0.65, #d9263800 1)
    core  = radial(56 56 26, #ffffff 0, #fff0a8 0.55, #ff8c2b00 1)
shapes:
    circle 56 56 50 fill=fire blend=add
    poly 56,8 68,34 98,26 80,52 104,72 74,74 70,104 52,82 26,96 36,66 10,54 38,42 28,16 50,32 fill=#ff9f43 opacity=0.85
    circle 56 56 26 fill=core blend=add

@Sprite/boom/3
size = [120, 120]
origin = [60, 60]
defs:
    ring  = radial(60 60 56, #ff450000 0, #ff6b2b22 0.45, #ff8c2bcc 0.72, #ff2e5500 1)
    ember = radial(60 60 30, #fff0a888 0, #ff5e4d44 0.55, #00000000 1)
shapes:
    circle 60 60 56 fill=ring blend=add
    circle 60 60 32 fill=ember blend=add
    circle 36 38 14 fill=#ff7b29 opacity=0.55
    circle 82 44 12 fill=#ff5e4d opacity=0.5
    circle 64 84 15 fill=#ff9f43 opacity=0.5
    circle 34 74 10 fill=#ffd166 opacity=0.55

@Sprite/boom/4
size = [128, 128]
origin = [64, 64]
defs:
    fade = radial(64 64 60, #00000000 0, #ff450000 0.55, #ff6b2b66 0.8, #00000000 1)
shapes:
    circle 64 64 60 fill=fade blend=add
    circle 30 34 8 fill=#ff8c2b opacity=0.35
    circle 94 42 7 fill=#ff5e4d opacity=0.32
    circle 78 92 9 fill=#ffd166 opacity=0.3
    circle 36 86 6 fill=#ff7b29 opacity=0.3

# --- Weapon type change drop pods ---

@Sprite/drop/spread
size = [38, 38]
origin = [19, 19]
defs:
    aura = radial(19 19 18, #9effb8 0, #2ecc71 0.45, #0a4d2c00 1)
    orb  = radial(16 15 12, #e8fff0 0, #38e58d 0.55, #0d6e42 1)
shapes:
    circle 19 19 18 fill=aura blend=add
    poly 19,5 33,19 19,33 5,19 fill=orb stroke=#d6ffe4/2 join=round
    line 12 19 25 13 stroke=#ffffff/2 cap=round
    line 12 19 26 19 stroke=#ffffff/2 cap=round
    line 12 19 25 25 stroke=#ffffff/2 cap=round

@Sprite/drop/laser
size = [38, 38]
origin = [19, 19]
defs:
    aura = radial(19 19 18, #c8ffff 0, #38bdf8 0.45, #0a2d5e00 1)
    orb  = radial(16 15 12, #ffffff 0, #5ce1ff 0.55, #12588c 1)
shapes:
    circle 19 19 18 fill=aura blend=add
    poly 19,5 33,19 19,33 5,19 fill=orb stroke=#e0ffff/2 join=round
    line 10 19 28 19 stroke=#ffffff/3.5 cap=round

@Sprite/drop/plasma
size = [38, 38]
origin = [19, 19]
defs:
    aura = radial(19 19 18, #ffc2f0 0, #d946ef 0.45, #4a0a5e00 1)
    orb  = radial(16 15 12, #ffffff 0, #f472b6 0.55, #7e1975 1)
shapes:
    circle 19 19 18 fill=aura blend=add
    poly 19,5 33,19 19,33 5,19 fill=orb stroke=#ffe0f7/2 join=round
    circle 19 19 6 fill=#ffffff opacity=0.95

@Sprite/drop/double
size = [38, 38]
origin = [19, 19]
defs:
    aura = radial(19 19 18, #fff5b8 0, #fbbf24 0.45, #7a3e0000 1)
    orb  = radial(16 15 12, #ffffff 0, #ffd166 0.55, #b45309 1)
shapes:
    circle 19 19 18 fill=aura blend=add
    poly 19,5 33,19 19,33 5,19 fill=orb stroke=#fff8d6/2 join=round
    line 11 22 26 22 stroke=#ffffff/2.2 cap=round
    line 13 21 24 12 stroke=#ffffff/2.2 cap=round

# --- Dedicated 360-degree Barrel Roll frames using sprite group flip=y tooling ---

@Sprite/viper/roll1
size = [96, 64]
origin = [48, 32]
defs:
    hull     = linear(0 16 -> 0 48, #ffffff 0, #9bc6ec 0.5, #2b4c73 1)
    canopy   = radial(58 26 11, #e8ffff 0, #46dceb 0.5, #104e6e 1)
    thruster = radial(16 32 18, #ffffff 0, #7ef5ff 0.45, #2b7cff00 1)
shapes:
    circle 16 32 17 fill=thruster blend=add
    # Wings tilted steeply into the roll
    poly 18,16 66,27 18,46 30,31 fill=#325a87 stroke=#0b1624/2 join=round
    poly 88,30 22,19 34,31 22,42 fill=hull stroke=#0b1624/2.2 join=round
    poly 94,25 58,24 64,28 94,28 fill=#eef6ff
    ellipse 56 27 12 4 fill=canopy stroke=#0b2538/1.5
    line 32 30 76 30 stroke=#ff5e4d/2.5 cap=round

@Sprite/viper/roll2
size = [96, 64]
origin = [48, 32]
defs:
    edge     = linear(18 22 -> 92 42, #ffffff 0, #8ef6ff 0.45, #2a4f78 1)
    thruster = radial(14 32 20, #ffffff 0, #7ef5ff 0.5, #2b7cff00 1)
shapes:
    # 90-degree knife-edge profile mid-roll
    circle 14 32 19 fill=thruster blend=add
    poly 18,28 92,31 92,33 18,36 28,32 fill=edge stroke=#0b1624/2 join=round
    # Vertical wing silhouette seen edge-on + cyan roll streak
    rect 24 22 36 4 r=2 fill=#c8e8ff stroke=#0b1624/1.5
    rect 24 38 36 4 r=2 fill=#325a87 stroke=#0b1624/1.5
    line 22 32 88 32 stroke=#7ef5ff/2.5 cap=round blend=add

@Sprite/viper/roll3
size = [96, 64]
origin = [48, 32]
defs:
    belly    = linear(0 12 -> 0 52, #233f63 0, #5984b3 0.5, #cfe8ff 1)
    thruster = radial(16 32 18, #ffffff 0, #7ef5ff 0.45, #2b7cff00 1)
shapes:
    # Inverted 180-degree underside using group flip=y!
    group 48,32 flip=y:
        circle -32 0 17 fill=thruster blend=add
        poly -30,-25 18,-6 -30,25 -18,0 fill=#1d3657 stroke=#0b1624/2 join=round
        poly 40,0 -26,-18 -14,0 -26,18 fill=belly stroke=#0b1624/2.5 join=round
        poly 46,-7 10,-9 16,-4 46,-4 fill=#b8d8f5
        poly 46,7 10,9 16,4 46,4 fill=#b8d8f5
        # Ventral intake bay & cyan belly stabilizer
        rect -8 -5 24 10 r=3 fill=#10243d stroke=#5ce1ff/1.8
        line -14 0 28 0 stroke=#7ef5ff/2.5 cap=round

@Sprite/viper/roll4
size = [96, 64]
origin = [48, 32]
defs:
    hull     = linear(0 16 -> 0 48, #2b4c73 0, #9bc6ec 0.5, #ffffff 1)
    canopy   = radial(58 38 11, #e8ffff 0, #46dceb 0.5, #104e6e 1)
    thruster = radial(16 32 18, #ffffff 0, #7ef5ff 0.45, #2b7cff00 1)
shapes:
    # Completing 270-degree roll back upright using group flip=y
    group 48,32 flip=y:
        circle -32 0 17 fill=thruster blend=add
        poly -30,-16 18,-5 -30,14 -18,-1 fill=#325a87 stroke=#0b1624/2 join=round
        poly 40,-2 -26,-13 -14,-1 -26,10 fill=hull stroke=#0b1624/2.2 join=round
        poly 46,-7 10,-8 16,-4 46,-4 fill=#eef6ff
        ellipse 8 -5 12 4 fill=canopy stroke=#0b2538/1.5
        line -16 -2 28 -2 stroke=#ff5e4d/2.5 cap=round

Controles y armas

Vuela con las flechas o WASD, dispara con Espacio o Z, haz un giro de tonel para desviar balas con C, E o Q, y activa tu barra de poder con X o Shift. También incluye controles táctiles.

Recoge cápsulas naranjas para desbloquear Velocidad, Misiles, Doble, Láser, cápsulas Option y Escudo, o captura diamantes de arma (Dispersión, Láser, Plasma, Doble) en pleno vuelo.

Tu mejor puntuación y victorias se guardan en este navegador y se comparten entre la vista integrada y la página independiente.

Explorar el código Rune

Star Viper está creado con sprites vectoriales compactos de Rune, escenas declarativas, música sintetizada y @Logic compilado AOT.

vectrune examples/games/star_viper/star_viper.rune
vectrune examples/games/star_viper/star_viper.rune -o html > star-viper.html
Sitio creado íntegramente con Rune-Web