User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 457
User prompt
Please fix the bug: 'setInterval is not a function' in or related to this line: 'setInterval(function () {' Line Number: 765
User prompt
life look more exotic โช๐ก Consider importing and using the following plugins: @upit/tween.v1
User prompt
Fix freezing and crashing issues in the game.
User prompt
Optimize the running performance of the game.
User prompt
Adding "Cosmic Elements" Beyond just stars, the AI can introduce more variety. How it works: The AI can periodically spawn non-repeating elements like: Distant Planets/Moons: Static or very slow-moving large celestial bodies. Nebulae/Gas Clouds: Large, diffuse, semi-transparent images that scroll by slowly. Asteroid Fields (Sparse): Small, individual asteroids that pass by at various speeds, potentially with their own simple collision detection if they are interactive. Comets/Shooting Stars: Fast-moving, temporary elements that appear and disappear quickly. AI's role: The AI would manage the spawning, movement, and despawning of these elements, often on a separate layer for parallax effect.
User prompt
Dynamic Starfield Generation For a more randomized and "alive" feel. How it works: Instead of pre-made images, the AI can dynamically generate individual "star" particles on the fly. AI's role: Spawning: The AI randomly generates new star particles just off-screen on the side the player is moving towards. Movement: Each star has its own x and y coordinates and a movement speed. The AI updates these each frame. Removal: When stars move off-screen, the AI removes them to save resources. Variations: The AI can vary star sizes, colors, and even add a subtle twinkle effect. For depth, some stars can move faster (closer) and others slower (further). Visuals: A continuous stream of individual stars, offering a sense of constant motion.
User prompt
Tile-Based Background with Repeating Patterns For a simpler approach, especially if resources are limited. How it works: The AI can use a large, repeating tile (or a few different tiles that seamlessly connect) to form the background. As the player moves, the AI simply shifts the visible portion of this tilemap or repositions the tiles as they go off-screen. AI's role: The AI maintains the position of the tiles. When a tile moves completely off-screen, it's recycled and moved to the opposite side of the screen, creating an infinite scroll. Visuals: A repeating pattern of stars, or a starry field that seamlessly tiles. This method is less dynamic but very efficient.
User prompt
Parallax Scrolling Backgrounds This is the most common and effective method for creating a sense of depth and movement in 2D games. How it works: Create multiple layers of background images (stars, nebulae, distant planets, asteroid fields). The AI then scrolls these layers at different speeds. Layers closer to the player scroll faster, while those further away scroll slower. AI's role: The AI will manage the x and y coordinates of each background layer, updating them in each game frame based on a predefined scroll speed for that layer and the player's movement (if the background scrolls with the player). Visuals: Layer 1 (Furthest): Slow-moving, tiny, numerous stars. Layer 2 (Middle): Larger, fewer stars, perhaps some faint nebulae. Layer 3 (Closest): Even larger, sparser stars, maybe some faint, distant planet silhouettes or very slow-moving asteroid fields.
User prompt
set up a life system.
User prompt
The Void Beckons: Battle Arena Showdown The year is 2742. Humanity, having long exhausted Earth's resources, initiated Project Starfall, colonizing beyond the Sol system. We then encountered the Battle Arena Showdown โ a cosmic coliseum. Our AI analysis indicates its construction by a Type III civilization, now absent. It drifts within the Great Nebula of Xylos, its anomalous energy signatures consistent with gravitic-containment fields. From your perspective, visual sensors register swirling nebulae, rendering as calibrated spectral data in hues of violet and emerald. Distant galaxies are resolved as discrete star systems, their luminosity patterns consistent with Population II and III stellar formations. Unidentified celestial objects, classified as "meteors", are tracked as high-velocity debris, their trajectories continuously computed. Your starship's reactor core hums at optimal output, its energy signature a minimal blip in the surrounding dark matter density. This environment is designated for combat simulations. Opposing combatants are identified as "enemy AI units", their vessels rendered against backgrounds consistent with stellar events (e.g., thermal emissions from a dying sun, electromagnetic radiation from a neutron star). Incoming projectiles are identified as "hostile energy ordnance", their trajectories logged as crimson plasma and azure energy, requiring predictive evasive maneuvers. Your onboard systems detect optimal thruster output, indicating maximal maneuverability. Projectile launch protocols are initiated, targeting enemy heat signatures. The arena's acoustic dampeners register combat events: weapon discharge signatures, impact reverberations, and target destruction confirmations. This is not a human conflict; it is a data-driven combat simulation within a spatiotemporal anomaly. Cognitive subroutines indicate a high probability of success. The computational expanse is vast, but the arena is your assigned operational zone. Only the most efficient combat algorithm will prevail in the Battle Arena Showdown. Commence engagement.
User prompt
Boss Roster (20 Bosses) These bosses will appear every 10 levels, each building on previous challenges and introducing new twists. Their health, attack frequency, and projectile speed will increase as the game progresses (i.e., Boss 19 will be significantly tougher than Boss 1). Overlord Drone (Level 10) Description: The standard boss, a large, heavily armored drone. Features: Health: High (15-20 HP initially). Movement: Patrols horizontally, occasionally performs a quick side-strafe. Attacks: Barrage Fire: Shoots 3 bullets in a narrow spread. Targeted Strike: Fires a single, faster bullet directly at player's current X-position (on cooldown). Sentinel Overseer (Level 20) Description: A boss with two small, indestructible orbiting mini-drones. Features: Health: High. Movement: Slow horizontal patrol. Attacks: Orbital Shield: Two small drones constantly orbit the boss, intercepting player bullets. They cannot be destroyed. Dual Stream: Boss fires two bullet streams slightly offset from its center. Pulse Mortar (Level 30) Description: A ground-based boss that remains stationary but lobs arcing projectiles. Features: Health: Very High (stationary target). Movement: Stationary (only X-position will be fixed, Y at enemy top area). Attacks: Lobbing Grenades: Fires slow-moving projectiles that arc downwards and explode into 3 smaller bullets upon reaching player's Y-axis. Shockwave (Rare): Emits a small, unavoidable shockwave (1 damage) when its health drops below certain thresholds. Twin Viper (Level 40) Description: Two smaller, interconnected boss units that move in sync. Features: Health: Moderate per unit, but both must be destroyed. They share a single health pool visually, but shots on either count. Movement: They move horizontally together, maintaining a fixed distance. Attacks: Synchronized Fire: Both units fire their own bullets simultaneously, creating a denser bullet pattern. Pincer Maneuver: Occasionally, one unit will briefly move closer to the center while the other stays wide, then they snap back. Reconstructor (Level 50) Description: A boss that can briefly disable the player's automatic shooting. Features: Health: High. Movement: Erratic, short bursts of horizontal movement. Attacks: Disruptor Pulse: Every 10-15 seconds, fires a wave that, if it hits the player (no damage), disables automatic shooting for 2-3 seconds. Player must rely on tapping. Rapid Fire: Shoots single bullets at a very high rate when not using Disruptor Pulse. Gladius Swarm Master (Level 60) Description: A boss that periodically deploys small, fast-moving drones. Features: Health: Moderate. Movement: Standard horizontal patrol. Attacks: Drone Deployment: Every 7 seconds, releases 2 small, fast, low-HP (1 HP) drones that fly straight down and shoot once before disappearing or being destroyed. Scatter Shot: Fires 5 bullets in a wide arc. Phalanx Guardian (Level 70) Description: A boss with a rotating shield that must be circumvented. Features: Health: High. Movement: Slow horizontal patrol. Attacks: Rotating Shield: Has a small, invulnerable segment (or 2) that rotates around its body, blocking player bullets. Player must shoot when the opening aligns. Piercing Shot: Fires a single, slow-moving bullet that can pass through 1-2 player bullets. Vortex Core (Level 80) Description: A central boss that pulls player bullets towards it before releasing them. Features: Health: High. Movement: Stationary or very limited horizontal drift. Attacks: Bullet Absorption: Periodically activates a field that slowly pulls all player bullets within a radius towards it for 1 second, then deactivates. (Player bullets are paused and then resume their path). Repulse Blast: After absorbing bullets, fires a large, slow-moving energy ball. Echo Striker (Level 90) Description: A boss that leaves behind "ghost" images that also shoot. Features: Health: High. Movement: Teleports short distances horizontally. Attacks: Echo Trail: Each time it teleports, it leaves a stationary "echo" image for 1-2 seconds. These echoes fire 1-2 bullets downwards before disappearing. Focused Burst: Fires 3 bullets in quick succession at the player's last known position. Apex Predator (Level 100) Description: The first major "gatekeeper" boss. Combines speed with burst damage. Features: Health: Very High. Movement: Very fast horizontal dashes with short pauses. Attacks: Predatory Dash: After a dash, unleashes a quick 5-bullet spread. Targeting Laser: Briefly projects a laser line downwards, then fires a very fast bullet along that line. Forces immediate evasion. Cryo-Bombard (Level 110) Description: A boss that slows player movement. Features: Health: High. Movement: Slow, deliberate horizontal movement. Attacks: Frost Bloom: Fires large, slow projectiles. If these hit the player (deal 1 damage), they also apply a 1-second "slow" debuff (player movement speed reduced by 50%). Ice Shard Volley: Fires 4-5 fast, narrow bullets in a cone. Plasma Cannonade (Level 120) Description: A boss with a powerful, charging main weapon. Features: Health: Very High. Movement: Relatively slow, but strategic positioning. Attacks: Charge Shot: The boss periodically charges a large plasma ball (visual cue). After 1.5 seconds, it fires a wide, damaging (2 damage) projectile that moves slowly but covers a large area. Suppressive Fire: During cooldowns for Charge Shot, fires multiple single bullets rapidly. Warp Sentinel (Level 130) Description: A boss that warps player bullets. Features: Health: High. Movement: Random short teleports, sometimes appearing slightly closer to the player. Attacks: Bullet Distortion Field: Periodically activates a field that distorts the path of player bullets passing through it (making them swerve slightly off course). Warp Shot: Fires a bullet that briefly vanishes and reappears closer to the player's last position before continuing its path. Kinetic Ram (Level 140) Description: A physically aggressive boss that attempts to collide with the player area. Features: Health: High. Movement: Standard horizontal, but occasionally performs a fast, downward lunge towards the player's Y-line before retreating. (It won't enter player's movement area, but comes very close). Attacks: Ground Slam (Lunge Attack): During a lunge, if player is under it, takes 1 damage. Leaves a small, temporary hazard area. Shockwave Pulse: After retreating from a lunge, fires a horizontal wave of 3-4 bullets. Artillery Core (Level 150) Description: A stationary boss that covers a large area with projectiles. Features: Health: Extremely High (being stationary). Movement: Stationary. Attacks: Grid Fire: Fires bullets in a systematic grid pattern, slowly moving the pattern across the screen. Player must find gaps. Flare Drop: Drops 2-3 slow-moving flares that explode into 4 bullets in a cross pattern when they reach the player's Y-axis. Phantasm Shifter (Level 160) Description: A boss that temporarily becomes invulnerable. Features: Health: High. Movement: Erratic horizontal bursts, with brief periods of becoming semi-transparent. Attacks: Ethereal Phase: Becomes semi-transparent and invulnerable to player bullets for 1.5-2 seconds, during which it can still fire. Shadow Barrage: During ethereal phase, fires a wider, more unpredictable spread of bullets. Reflector Unit (Level 170) Description: A boss that can bounce player bullets back. Features: Health: High. Movement: Slow, steady horizontal patrol. Attacks: Deflector Shield: Activates a temporary shield (1 second) that reflects the first 2-3 player bullets back at the player. These reflected bullets deal damage to the player if hit. Piercing Beam: Fires a single, very fast, thin beam that pierces through player bullets. Chrono Weaver (Level 180) Description: A boss that can temporarily speed up its own bullets. Features: Health: Very High. Movement: Smooth, undulating horizontal movement. Attacks: Time Surge: Every 8-10 seconds, fires a burst of 5-6 bullets that travel at double speed for 1 second before reverting to normal speed. Disorienting Arc: Fires bullets in a wide, slowly curving arc pattern. Annihilator Core (Level 190) Description: A highly aggressive boss with minimal cooldowns and overlapping attacks. Features: Health: Extremely High. Movement: Constant, unpredictable high-speed horizontal movement with short pauses. Attacks: Relentless Fire: Fires multiple bullet streams simultaneously with very low cooldowns. Area Denial Grenades: Occasionally lobs grenades that create small, brief (1-second) damaging zones on the player's ground area. Targeted Pulse: A very fast, single bullet directly aimed at the player after a brief warning flash. Omega Dominator (Level 200 - Final Boss) Description: The ultimate challenge, combining elements from previous bosses. Features: Health: Colossal. Movement: Complex, alternating between fast dashes, slow patrols, and short teleports. Attacks: Multi-Phase: The fight might have 2-3 distinct phases, each with new attack patterns or enhanced versions of previous attacks. Combinatorial Attacks: Fires combinations of "Barrage Fire" and "Targeted Strikes" simultaneously. Summon Minions: Periodically summons 1-2 stronger regular enemies or unique 1-HP drones (like the Gladius Swarm Master). Ultimate Barrage: When health is very low, unleashes a truly screen-filling, intense bullet pattern that requires perfect dodging. Disabling Field: Briefly disables player auto-fire AND reduces manual fire rate for 2 seconds. Regular Enemy Roster (Design & Features) These enemies will cycle through, and their base speed, shooting frequency, and potentially projectile speed will increase with each difficulty level. Basic Drone Description: Standard, entry-level enemy. Features: Health: 3 HP. Movement: Slow, predictable horizontal patrol (left-to-right, then right-to-left). Attacks: Fires single bullets downwards at a fixed frequency. Swift Scourer Description: Faster, but still basic, drone. Features: Health: 3 HP. Movement: Faster horizontal patrol. Attacks: Fires single bullets downwards, slightly more frequently than Basic Drone. Burst Shooter Description: An enemy that fires in short bursts. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Fires 3 bullets in a quick burst, then a short cooldown before the next burst. Erratic Striker Description: Unpredictable movement. Features: Health: 3 HP. Movement: Horizontal patrol with random, short stops or changes in direction. Attacks: Fires single bullets at a slightly variable frequency. Charger (Mini-Boss Variant - Occasional) Description: A slightly tougher enemy that periodically attempts to "charge" downwards. Features: Health: 5 HP. Movement: Standard horizontal, but every 5-7 seconds, it will make a quick, short vertical lunge downwards (still within the enemy Y-area, not touching player area) then snap back up. Attacks: Fires single bullets more frequently. If player is in its lunge path, 1 damage taken on impact (before it snaps back). Disperser Description: Fires a spread of bullets. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Fires 3 bullets in a narrow spread (similar to boss Barrage Fire, but less frequent). Sniper Unit Description: Trades fire rate for accuracy. Features: Health: 3 HP. Movement: Slow, deliberate horizontal movement. Attacks: Fires single bullets less frequently, but each bullet is aimed directly at the player's current X-position. Requires quicker horizontal dodging. Resilient Guard Description: Has more health than standard enemies. Features: Health: 5 HP. Movement: Slow horizontal patrol. Attacks: Fires single bullets at standard frequency. Designed to absorb more hits. Minelayer Description: Drops stationary hazards. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Periodically "drops" a small, stationary mine that floats slowly down to the player's Y-axis. If not destroyed (1 HP), it explodes into 4 small bullets upon reaching the bottom or after a set time. Shielded Vanguard (Rare) Description: Has a temporary front-facing shield. Features: Health: 4 HP. Movement: Standard horizontal. Attacks: Fires single bullets. Every few seconds, deploys a small, invulnerable front shield for 1-1.5 seconds, blocking incoming player bullets. Players must time their shots.
Code edit (1 edits merged)
Please save this source code
User prompt
Battle Arena Showdown: Boss Evolution
User prompt
Boss Mechanic: The "Overlord Drone" Every 10 levels (e.g., at level 10, 20, 30, etc.), instead of a standard enemy, the player will face the "Overlord Drone." This boss fight will incorporate new elements while building on existing mechanics. Boss Features: Increased Durability (Health): The Overlord Drone has significantly more health than regular enemies. Instead of 3 HP, it will have 15-20 HP (adjustable for balancing). This makes the fight a sustained challenge. Unique Movement Pattern: "Patrol & Strafe" Instead of simple left-to-right movement, the Overlord Drone will employ a more dynamic pattern: Patrol Phase: Moves horizontally like regular enemies, but faster. Strafe Phase: Periodically, it will briefly stop its horizontal movement and quickly dart to one side (left or right) before resuming its patrol. This makes it harder to predict and hit consistently. Enhanced Offensive Capabilities: "Barrage Fire" (Main Attack): The Overlord Drone will shoot a spread of 3 bullets simultaneously in a narrow arc, rather than single bullets. This significantly increases the area denial and the chance of hitting the player. "Targeted Strike" (Special Attack - Every 5 seconds): Every 5 seconds (on a cooldown independent of its Barrage Fire), the Overlord Drone will launch a single, faster bullet directly at the player's current X-position. This forces the player to react quickly and move to avoid precision shots. No Respawn (Single Encounter): Unlike regular enemies, the Overlord Drone does not respawn upon defeat. Once its health reaches 0, the boss is defeated, and the game progresses to the next set of 9 regular levels. Visual and Audio Cues: Appearance: The Overlord Drone will have a distinct visual model, larger than regular enemies, possibly with a unique color or glowing parts to signify its boss status. Health Bar: It will have its own, larger health bar displayed prominently during the fight. Sound Effects: Unique sound effects for its special attacks (e.g., a charging sound before "Targeted Strike," a louder, more impactful shooting sound for "Barrage Fire"). Player Interaction & Strategy: Dodging Emphasis: The player must be highly agile and utilize the horizontal movement effectively to dodge the wider "Barrage Fire" spreads and the precise "Targeted Strikes." Sustained Damage Output: The player will need to maintain consistent fire to chip away at the boss's high health. Both automatic and manual tapping will be crucial. Pattern Recognition: Players will learn to anticipate the "Strafe Phase" and the timing of the "Targeted Strike" to maximize their dodges and aim. Progression & Reward: Significant Score Boost: Defeating the Overlord Drone grants a large score bonus (e.g., +100 or +200 points) to mark the achievement. Difficulty Reset/Moderate Increase: After defeating a boss, the regular enemy difficulty can either reset to a slightly lower level or increment at a slower pace for the next 9 levels, giving the player a brief reprieve before the difficulty ramps up again. This prevents an overly steep curve after a challenging boss. This boss mechanic introduces complexity and variety to the "Battle Arena Showdown" loop, demanding more strategic dodging and sustained damage from the player, making every 10th level a significant milestone. Identify 20 bosses for this game and describe their features. Design the enemies and describe their features. Got it! Based on the "Battle Arena Showdown" mechanics, here are 20 unique bosses and a variety of regular enemies, designed to fit the game's theme and provide escalating challenges. Boss Roster (20 Bosses) These bosses will appear every 10 levels, each building on previous challenges and introducing new twists. Their health, attack frequency, and projectile speed will increase as the game progresses (i.e., Boss 19 will be significantly tougher than Boss 1). Overlord Drone (Level 10) Description: The standard boss, a large, heavily armored drone. Features: Health: High (15-20 HP initially). Movement: Patrols horizontally, occasionally performs a quick side-strafe. Attacks: Barrage Fire: Shoots 3 bullets in a narrow spread. Targeted Strike: Fires a single, faster bullet directly at player's current X-position (on cooldown). Sentinel Overseer (Level 20) Description: A boss with two small, indestructible orbiting mini-drones. Features: Health: High. Movement: Slow horizontal patrol. Attacks: Orbital Shield: Two small drones constantly orbit the boss, intercepting player bullets. They cannot be destroyed. Dual Stream: Boss fires two bullet streams slightly offset from its center. Pulse Mortar (Level 30) Description: A ground-based boss that remains stationary but lobs arcing projectiles. Features: Health: Very High (stationary target). Movement: Stationary (only X-position will be fixed, Y at enemy top area). Attacks: Lobbing Grenades: Fires slow-moving projectiles that arc downwards and explode into 3 smaller bullets upon reaching player's Y-axis. Shockwave (Rare): Emits a small, unavoidable shockwave (1 damage) when its health drops below certain thresholds. Twin Viper (Level 40) Description: Two smaller, interconnected boss units that move in sync. Features: Health: Moderate per unit, but both must be destroyed. They share a single health pool visually, but shots on either count. Movement: They move horizontally together, maintaining a fixed distance. Attacks: Synchronized Fire: Both units fire their own bullets simultaneously, creating a denser bullet pattern. Pincer Maneuver: Occasionally, one unit will briefly move closer to the center while the other stays wide, then they snap back. Reconstructor (Level 50) Description: A boss that can briefly disable the player's automatic shooting. Features: Health: High. Movement: Erratic, short bursts of horizontal movement. Attacks: Disruptor Pulse: Every 10-15 seconds, fires a wave that, if it hits the player (no damage), disables automatic shooting for 2-3 seconds. Player must rely on tapping. Rapid Fire: Shoots single bullets at a very high rate when not using Disruptor Pulse. Gladius Swarm Master (Level 60) Description: A boss that periodically deploys small, fast-moving drones. Features: Health: Moderate. Movement: Standard horizontal patrol. Attacks: Drone Deployment: Every 7 seconds, releases 2 small, fast, low-HP (1 HP) drones that fly straight down and shoot once before disappearing or being destroyed. Scatter Shot: Fires 5 bullets in a wide arc. Phalanx Guardian (Level 70) Description: A boss with a rotating shield that must be circumvented. Features: Health: High. Movement: Slow horizontal patrol. Attacks: Rotating Shield: Has a small, invulnerable segment (or 2) that rotates around its body, blocking player bullets. Player must shoot when the opening aligns. Piercing Shot: Fires a single, slow-moving bullet that can pass through 1-2 player bullets. Vortex Core (Level 80) Description: A central boss that pulls player bullets towards it before releasing them. Features: Health: High. Movement: Stationary or very limited horizontal drift. Attacks: Bullet Absorption: Periodically activates a field that slowly pulls all player bullets within a radius towards it for 1 second, then deactivates. (Player bullets are paused and then resume their path). Repulse Blast: After absorbing bullets, fires a large, slow-moving energy ball. Echo Striker (Level 90) Description: A boss that leaves behind "ghost" images that also shoot. Features: Health: High. Movement: Teleports short distances horizontally. Attacks: Echo Trail: Each time it teleports, it leaves a stationary "echo" image for 1-2 seconds. These echoes fire 1-2 bullets downwards before disappearing. Focused Burst: Fires 3 bullets in quick succession at the player's last known position. Apex Predator (Level 100) Description: The first major "gatekeeper" boss. Combines speed with burst damage. Features: Health: Very High. Movement: Very fast horizontal dashes with short pauses. Attacks: Predatory Dash: After a dash, unleashes a quick 5-bullet spread. Targeting Laser: Briefly projects a laser line downwards, then fires a very fast bullet along that line. Forces immediate evasion. Cryo-Bombard (Level 110) Description: A boss that slows player movement. Features: Health: High. Movement: Slow, deliberate horizontal movement. Attacks: Frost Bloom: Fires large, slow projectiles. If these hit the player (deal 1 damage), they also apply a 1-second "slow" debuff (player movement speed reduced by 50%). Ice Shard Volley: Fires 4-5 fast, narrow bullets in a cone. Plasma Cannonade (Level 120) Description: A boss with a powerful, charging main weapon. Features: Health: Very High. Movement: Relatively slow, but strategic positioning. Attacks: Charge Shot: The boss periodically charges a large plasma ball (visual cue). After 1.5 seconds, it fires a wide, damaging (2 damage) projectile that moves slowly but covers a large area. Suppressive Fire: During cooldowns for Charge Shot, fires multiple single bullets rapidly. Warp Sentinel (Level 130) Description: A boss that warps player bullets. Features: Health: High. Movement: Random short teleports, sometimes appearing slightly closer to the player. Attacks: Bullet Distortion Field: Periodically activates a field that distorts the path of player bullets passing through it (making them swerve slightly off course). Warp Shot: Fires a bullet that briefly vanishes and reappears closer to the player's last position before continuing its path. Kinetic Ram (Level 140) Description: A physically aggressive boss that attempts to collide with the player area. Features: Health: High. Movement: Standard horizontal, but occasionally performs a fast, downward lunge towards the player's Y-line before retreating. (It won't enter player's movement area, but comes very close). Attacks: Ground Slam (Lunge Attack): During a lunge, if player is under it, takes 1 damage. Leaves a small, temporary hazard area. Shockwave Pulse: After retreating from a lunge, fires a horizontal wave of 3-4 bullets. Artillery Core (Level 150) Description: A stationary boss that covers a large area with projectiles. Features: Health: Extremely High (being stationary). Movement: Stationary. Attacks: Grid Fire: Fires bullets in a systematic grid pattern, slowly moving the pattern across the screen. Player must find gaps. Flare Drop: Drops 2-3 slow-moving flares that explode into 4 bullets in a cross pattern when they reach the player's Y-axis. Phantasm Shifter (Level 160) Description: A boss that temporarily becomes invulnerable. Features: Health: High. Movement: Erratic horizontal bursts, with brief periods of becoming semi-transparent. Attacks: Ethereal Phase: Becomes semi-transparent and invulnerable to player bullets for 1.5-2 seconds, during which it can still fire. Shadow Barrage: During ethereal phase, fires a wider, more unpredictable spread of bullets. Reflector Unit (Level 170) Description: A boss that can bounce player bullets back. Features: Health: High. Movement: Slow, steady horizontal patrol. Attacks: Deflector Shield: Activates a temporary shield (1 second) that reflects the first 2-3 player bullets back at the player. These reflected bullets deal damage to the player if hit. Piercing Beam: Fires a single, very fast, thin beam that pierces through player bullets. Chrono Weaver (Level 180) Description: A boss that can temporarily speed up its own bullets. Features: Health: Very High. Movement: Smooth, undulating horizontal movement. Attacks: Time Surge: Every 8-10 seconds, fires a burst of 5-6 bullets that travel at double speed for 1 second before reverting to normal speed. Disorienting Arc: Fires bullets in a wide, slowly curving arc pattern. Annihilator Core (Level 190) Description: A highly aggressive boss with minimal cooldowns and overlapping attacks. Features: Health: Extremely High. Movement: Constant, unpredictable high-speed horizontal movement with short pauses. Attacks: Relentless Fire: Fires multiple bullet streams simultaneously with very low cooldowns. Area Denial Grenades: Occasionally lobs grenades that create small, brief (1-second) damaging zones on the player's ground area. Targeted Pulse: A very fast, single bullet directly aimed at the player after a brief warning flash. Omega Dominator (Level 200 - Final Boss) Description: The ultimate challenge, combining elements from previous bosses. Features: Health: Colossal. Movement: Complex, alternating between fast dashes, slow patrols, and short teleports. Attacks: Multi-Phase: The fight might have 2-3 distinct phases, each with new attack patterns or enhanced versions of previous attacks. Combinatorial Attacks: Fires combinations of "Barrage Fire" and "Targeted Strikes" simultaneously. Summon Minions: Periodically summons 1-2 stronger regular enemies or unique 1-HP drones (like the Gladius Swarm Master). Ultimate Barrage: When health is very low, unleashes a truly screen-filling, intense bullet pattern that requires perfect dodging. Disabling Field: Briefly disables player auto-fire AND reduces manual fire rate for 2 seconds. Regular Enemy Roster (Design & Features) These enemies will cycle through, and their base speed, shooting frequency, and potentially projectile speed will increase with each difficulty level. Basic Drone Description: Standard, entry-level enemy. Features: Health: 3 HP. Movement: Slow, predictable horizontal patrol (left-to-right, then right-to-left). Attacks: Fires single bullets downwards at a fixed frequency. Swift Scourer Description: Faster, but still basic, drone. Features: Health: 3 HP. Movement: Faster horizontal patrol. Attacks: Fires single bullets downwards, slightly more frequently than Basic Drone. Burst Shooter Description: An enemy that fires in short bursts. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Fires 3 bullets in a quick burst, then a short cooldown before the next burst. Erratic Striker Description: Unpredictable movement. Features: Health: 3 HP. Movement: Horizontal patrol with random, short stops or changes in direction. Attacks: Fires single bullets at a slightly variable frequency. Charger (Mini-Boss Variant - Occasional) Description: A slightly tougher enemy that periodically attempts to "charge" downwards. Features: Health: 5 HP. Movement: Standard horizontal, but every 5-7 seconds, it will make a quick, short vertical lunge downwards (still within the enemy Y-area, not touching player area) then snap back up. Attacks: Fires single bullets more frequently. If player is in its lunge path, 1 damage taken on impact (before it snaps back). Disperser Description: Fires a spread of bullets. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Fires 3 bullets in a narrow spread (similar to boss Barrage Fire, but less frequent). Sniper Unit Description: Trades fire rate for accuracy. Features: Health: 3 HP. Movement: Slow, deliberate horizontal movement. Attacks: Fires single bullets less frequently, but each bullet is aimed directly at the player's current X-position. Requires quicker horizontal dodging. Resilient Guard Description: Has more health than standard enemies. Features: Health: 5 HP. Movement: Slow horizontal patrol. Attacks: Fires single bullets at standard frequency. Designed to absorb more hits. Minelayer Description: Drops stationary hazards. Features: Health: 3 HP. Movement: Standard horizontal patrol. Attacks: Periodically "drops" a small, stationary mine that floats slowly down to the player's Y-axis. If not destroyed (1 HP), it explodes into 4 small bullets upon reaching the bottom or after a set time. Shielded Vanguard (Rare) Description: Has a temporary front-facing shield. Features: Health: 4 HP. Movement: Standard horizontal. Attacks: Fires single bullets. Every few seconds, deploys a small, invulnerable front shield for 1-1.5 seconds, blocking incoming player bullets. Players must time their shots.
Initial prompt
Based on the source code provided, here are the **game mechanics** of "Battle Arena Showdown": ## Core Gameplay Mechanics **Player vs AI Combat System:** - Player controls a character positioned at the bottom of the screen - AI enemy operates autonomously at the top of the screen - Real-time combat with both sides shooting projectiles at each other **Movement & Controls:** - Touch/drag controls to move the player character horizontally - Player movement is constrained to the bottom area of the screen (Y: 2200-2600) - Player can move left-right across most of the screen width (X: 40-2008) - Tapping anywhere shoots a bullet immediately **Combat Mechanics:** - **Player Bullets**: Travel upward (-12 speed) to hit the enemy - **Enemy Bullets**: Travel downward (+8 speed) to hit the player - **Automatic Shooting**: Player automatically shoots every 30 game ticks (~0.5 seconds) - **Manual Shooting**: Player can also shoot by tapping the screen - **Collision Detection**: Bullets are removed when they hit their target **Health & Damage System:** - **Player**: 5 health points, takes 1 damage per enemy bullet hit - **Enemy**: 3 health points, takes 1 damage per player bullet hit - Visual feedback with red flash effects when taking damage - Health bar changes color based on player's remaining health (green โ yellow โ red) **AI Behavior:** - **Movement**: Enemy moves horizontally back and forth across the top area - **Shooting**: AI shoots randomly with increasing frequency based on difficulty - **Respawn System**: When enemy is defeated, it respawns with increased difficulty **Progression & Difficulty:** - **Score System**: +10 points for each enemy defeat - **Dynamic Difficulty**: Each enemy respawn increases difficulty level - **Adaptive AI**: Enemy shoots more frequently as difficulty increases - **Faster Cooldowns**: Enemy reload time decreases with each difficulty level **Win/Lose Conditions:** - **Victory**: Kill 5 enemies total - **Defeat**: Player health reaches 0 - **Visual UI**: Score display at top, health indicator with color coding **Technical Features:** - 60 FPS gameplay with smooth bullet movement - Automatic cleanup of off-screen bullets - State tracking for collision detection - Sound effects for shooting and hitting targets This creates an intense, arcade-style shooter where players must survive increasingly difficult waves while aiming for precision shots against a moving AI opponent.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var AnnihilatorCore = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss15', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 40; self.maxHp = 40; self.moveDirection = 1; self.shootTimer = 0; self.grenadeTimer = 0; self.pulseTimer = 0; self.update = function () { self.x += self.moveDirection * (3 + Math.random() * 3); if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } // Relentless fire (reduced frequency) self.shootTimer++; if (self.shootTimer >= 20) { for (var i = -1; i <= 1; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 50; bullet.y = self.y + 75; bullet.speed = 8; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; } // Area denial grenades self.grenadeTimer++; if (self.grenadeTimer >= 120) { var grenade = new BossBullet(); grenade.x = Math.random() * 1500 + 250; grenade.y = self.y + 75; grenade.speed = 5; grenade.targetY = 2300; grenade.exploded = false; grenade.update = function () { this.y += this.speed; if (this.y >= this.targetY && !this.exploded) { this.exploded = true; this.destroy(); } }; bossBullets.push(grenade); game.addChild(grenade); self.grenadeTimer = 0; } // Targeted pulse self.pulseTimer++; if (self.pulseTimer >= 90 && player) { var pulse = new BossBullet(); pulse.x = self.x; pulse.y = self.y + 75; pulse.speed = 15; var dx = player.x - pulse.x; pulse.speedX = dx > 0 ? 8 : -8; pulse.tint = 0xffff00; pulse.update = function () { this.x += this.speedX; this.y += this.speed; }; bossBullets.push(pulse); game.addChild(pulse); self.pulseTimer = 0; } }; return self; }); var ApexPredator = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss6', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 35; self.maxHp = 35; self.dashTimer = 0; self.dashInterval = 120; self.laserTimer = 0; self.laserInterval = 240; self.dashSpeed = 0; self.dashDirection = 1; self.update = function () { // Fast dash movement self.dashTimer++; if (self.dashTimer >= self.dashInterval) { self.dashSpeed = 12; self.dashDirection = Math.random() > 0.5 ? 1 : -1; self.dashTimer = 0; } if (self.dashSpeed > 0) { self.x += self.dashDirection * self.dashSpeed; self.dashSpeed *= 0.9; if (self.x <= 200 || self.x >= 1848) { self.dashDirection *= -1; } // Predatory dash attack if (self.dashSpeed < 2) { for (var i = -2; i <= 2; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 30; bullet.y = self.y + 75; bullet.speed = 10; bossBullets.push(bullet); game.addChild(bullet); } self.dashSpeed = 0; } } // Targeting laser self.laserTimer++; if (self.laserTimer >= self.laserInterval && player) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bullet.speed = 15; var dx = player.x - bullet.x; bullet.speedX = dx > 0 ? 10 : -10; bullet.update = function () { this.x += this.speedX; this.y += this.speed; }; bossBullets.push(bullet); game.addChild(bullet); self.laserTimer = 0; } }; return self; }); var ArtilleryCore = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss11', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 50; self.maxHp = 50; self.shootTimer = 0; self.shootInterval = 45; self.gridOffset = 0; self.flareTimer = 0; self.flareInterval = 180; self.update = function () { self.shootTimer++; if (self.shootTimer >= self.shootInterval) { // Grid fire for (var i = 0; i < 8; i++) { var bullet = new BossBullet(); bullet.x = 200 + i * 200 + self.gridOffset; bullet.y = self.y + 75; bullet.speed = 5; if (bullet.x >= 100 && bullet.x <= 1948) { bossBullets.push(bullet); game.addChild(bullet); } } self.gridOffset = (self.gridOffset + 50) % 200; self.shootTimer = 0; } self.flareTimer++; if (self.flareTimer >= self.flareInterval) { for (var i = 0; i < 3; i++) { var flare = new BossBullet(); flare.x = self.x + (i - 1) * 150; flare.y = self.y + 75; flare.speed = 3; flare.isFlare = true; flare.targetY = 2200; flare.exploded = false; flare.update = function () { this.y += this.speed; if (this.y >= this.targetY && !this.exploded) { this.exploded = true; for (var j = 0; j < 4; j++) { var fragment = new BossBullet(); fragment.x = this.x; fragment.y = this.y; fragment.speed = 4; fragment.angle = j * Math.PI / 2; fragment.update = function () { this.x += Math.cos(this.angle) * 3; this.y += Math.sin(this.angle) * 3; }; bossBullets.push(fragment); game.addChild(fragment); } this.destroy(); } }; bossBullets.push(flare); game.addChild(flare); } self.flareTimer = 0; } }; return self; }); var AsteroidField = Container.expand(function () { var self = Container.call(this); self.speed = 1 + Math.random() * 2; self.rotationSpeed = (Math.random() - 0.5) * 0.05; var graphics = self.attachAsset('mine', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0x666666; var scale = 0.5 + Math.random() * 1.0; graphics.scaleX = scale; graphics.scaleY = scale; self.update = function () { self.y += self.speed; graphics.rotation += self.rotationSpeed; }; return self; }); var BasicDrone = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('basicDrone', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.hp = 3; self.maxHp = 3; self.shootTimer = 0; self.shootInterval = 90; self.update = function () { self.y += self.speed; self.shootTimer++; if (self.shootTimer >= self.shootInterval) { self.shootTimer = 0; var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y + 30; enemyBullets.push(bullet); game.addChild(bullet); LK.getSound('enemyShoot').play(); } }; return self; }); var BossBullet = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('bossBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.update = function () { self.y += self.speed; }; return self; }); var BurstShooter = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('burstShooter', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.5; self.hp = 4; self.maxHp = 4; self.shootTimer = 0; self.shootInterval = 120; self.burstCount = 0; self.update = function () { self.y += self.speed; self.shootTimer++; if (self.shootTimer >= self.shootInterval) { for (var i = 0; i < 3; i++) { var bullet = new EnemyBullet(); bullet.x = self.x + (i - 1) * 20; bullet.y = self.y + 35; enemyBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; LK.getSound('enemyShoot').play(); } }; return self; }); var ChronoWeaver = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss14', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 34; self.maxHp = 34; self.surgeTimer = 0; self.surgeInterval = 480; self.shootTimer = 0; self.wavePhase = 0; self.update = function () { self.wavePhase += 0.02; self.x = 1024 + Math.sin(self.wavePhase) * 300; self.surgeTimer++; if (self.surgeTimer >= self.surgeInterval) { for (var i = -2; i <= 2; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 30; bullet.y = self.y + 75; bullet.speed = 4; bullet.surgeSpeed = 12; bullet.surgeTime = 60; bullet.surgeTimer = 0; bullet.update = function () { this.surgeTimer++; var speed = this.surgeTimer < this.surgeTime ? this.surgeSpeed : this.speed; this.y += speed; }; bossBullets.push(bullet); game.addChild(bullet); } self.surgeTimer = 0; } self.shootTimer++; if (self.shootTimer >= 80) { for (var i = 0; i < 3; i++) { var bullet = new BossBullet(); bullet.x = self.x + (i - 1) * 40; bullet.y = self.y + 75; bullet.speed = 5; bullet.curve = i * 0.02; bullet.update = function () { this.x += Math.sin(this.y * 0.01 + this.curve) * 2; this.y += this.speed; }; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; } }; return self; }); var CosmicComet = Container.expand(function () { var self = Container.call(this); self.speed = 8 + Math.random() * 6; self.lifetime = 60 + Math.random() * 120; self.age = 0; var graphics = self.attachAsset('starField3', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0xffffcc; graphics.scaleX = 2; graphics.scaleY = 2; // Random diagonal movement self.speedX = (Math.random() - 0.5) * 4; self.speedY = self.speed; self.update = function () { self.x += self.speedX; self.y += self.speedY; self.age++; // Fade out over lifetime graphics.alpha = 1 - self.age / self.lifetime; // Mark for removal when lifetime exceeded if (self.age >= self.lifetime) { self.expired = true; } }; return self; }); var CosmicPlanet = Container.expand(function (size, color, speed) { var self = Container.call(this); self.speed = speed || 0.3; self.rotationSpeed = 0.001 + Math.random() * 0.002; var graphics = self.attachAsset('nebula', { anchorX: 0.5, anchorY: 0.5 }); if (color) { graphics.tint = color; } var scale = size || 0.8 + Math.random() * 1.5; graphics.scaleX = scale; graphics.scaleY = scale; graphics.alpha = 0.4 + Math.random() * 0.3; // Start exotic breathing effect tween(graphics, { scaleX: scale * 1.2, scaleY: scale * 1.2 }, { duration: 4000 + Math.random() * 6000, easing: tween.easeInOut, onFinish: function onFinish() { tween(graphics, { scaleX: scale, scaleY: scale }, { duration: 4000 + Math.random() * 6000, easing: tween.easeInOut }); } }); // Color shifting effect var colorShiftTimer = Math.random() * 8000; LK.setTimeout(function () { var colors = [0x4444aa, 0xaa4444, 0x44aa44, 0xaaaa44, 0xaa44aa, 0x44aaaa]; var newColor = colors[Math.floor(Math.random() * colors.length)]; tween(graphics, { tint: newColor }, { duration: 3000, easing: tween.easeInOut }); }, colorShiftTimer); self.update = function () { // Move planet slowly downward self.y += self.speed; // Add subtle rotation graphics.rotation += self.rotationSpeed; }; return self; }); var CryoBombard = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss7', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0x4488ff; self.hp = 26; self.maxHp = 26; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 90; self.update = function () { self.x += self.moveDirection * 1.5; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { // Frost bloom - large slow projectiles var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bullet.speed = 3; bullet.isFrost = true; bullet.scaleX = 2; bullet.scaleY = 2; bullet.tint = 0x88ccff; bossBullets.push(bullet); game.addChild(bullet); // Ice shard volley for (var i = -2; i <= 2; i++) { var shard = new BossBullet(); shard.x = self.x + i * 20; shard.y = self.y + 75; shard.speed = 8; shard.tint = 0xccffff; bossBullets.push(shard); game.addChild(shard); } self.shootTimer = 0; } }; return self; }); var EchoStriker = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss5', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 24; self.maxHp = 24; self.shootTimer = 0; self.shootInterval = 60; self.teleportTimer = 0; self.teleportInterval = 180; self.echos = []; self.update = function () { // Teleport movement self.teleportTimer++; if (self.teleportTimer >= self.teleportInterval) { // Leave echo at current position var echo = { x: self.x, y: self.y, lifetime: 120, shootTimer: 0 }; self.echos.push(echo); // Teleport to new position self.x = Math.random() * 1400 + 300; self.teleportTimer = 0; } // Update echos for (var i = self.echos.length - 1; i >= 0; i--) { var echo = self.echos[i]; echo.lifetime--; echo.shootTimer++; if (echo.shootTimer >= 60) { var bullet = new BossBullet(); bullet.x = echo.x; bullet.y = echo.y + 50; bossBullets.push(bullet); game.addChild(bullet); echo.shootTimer = 0; } if (echo.lifetime <= 0) { self.echos.splice(i, 1); } } // Main shooting self.shootTimer++; if (self.shootTimer >= self.shootInterval && player) { for (var i = 0; i < 3; i++) { var bullet = new BossBullet(); bullet.x = self.x + (i - 1) * 25; bullet.y = self.y + 75; bullet.speed = 8; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; } }; return self; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('enemyBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.update = function () { self.y += self.speed; }; return self; }); var GladiusSwarmMaster = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0xff8800; self.hp = 18; self.maxHp = 18; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 80; self.droneTimer = 0; self.droneInterval = 420; self.update = function () { self.x += self.moveDirection * 2; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { for (var i = -2; i <= 2; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 25; bullet.y = self.y + 75; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; LK.getSound('enemyShoot').play(); } self.droneTimer++; if (self.droneTimer >= self.droneInterval) { for (var i = 0; i < 2; i++) { var drone = new BasicDrone(); drone.x = self.x + (i - 0.5) * 100; drone.y = self.y + 100; drone.hp = 1; drone.speed = 8; enemies.push(drone); game.addChild(drone); } self.droneTimer = 0; } }; return self; }); var KineticRam = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss10', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 30; self.maxHp = 30; self.moveDirection = 1; self.lungeTimer = 0; self.lungeInterval = 300; self.lunging = false; self.lungeY = 0; self.update = function () { if (!self.lunging) { self.x += self.moveDirection * 2; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.lungeTimer++; if (self.lungeTimer >= self.lungeInterval) { self.lunging = true; self.lungeY = self.y; self.lungeTimer = 0; } } else { self.y += 8; if (self.y >= 1800) { // Shockwave pulse for (var i = -1; i <= 1; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 60; bullet.y = self.y; bullet.speed = 6; bossBullets.push(bullet); game.addChild(bullet); } self.y = self.lungeY; self.lunging = false; } } }; return self; }); var Mine = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('mine', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 3; self.armed = false; self.armTimer = 0; self.update = function () { self.y += self.speed; self.armTimer++; if (self.armTimer > 60) { self.armed = true; graphics.tint = 0xff0000; } }; return self; }); var Minelayer = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('minelayer', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2.5; self.hp = 5; self.maxHp = 5; self.mineTimer = 0; self.mineInterval = 150; self.update = function () { self.y += self.speed; self.mineTimer++; if (self.mineTimer >= self.mineInterval) { var mine = new Mine(); mine.x = self.x; mine.y = self.y + 30; mines.push(mine); game.addChild(mine); self.mineTimer = 0; } }; return self; }); var NebulaLayer = Container.expand(function () { var self = Container.call(this); self.scrollSpeed = 0.2; self.nebulae = []; // Create nebula clouds for (var i = 0; i < 3; i++) { var nebula = self.attachAsset('nebula', { anchorX: 0.5, anchorY: 0.5, x: Math.random() * 2048, y: Math.random() * 2732 }); nebula.alpha = 0.1 + Math.random() * 0.2; nebula.scaleX = 1 + Math.random() * 2; nebula.scaleY = 1 + Math.random() * 2; // Add exotic pulsing and color shifting to nebula var pulseScale = nebula.scaleX; tween(nebula, { scaleX: pulseScale * 1.3, scaleY: pulseScale * 1.3 }, { duration: 8000 + Math.random() * 12000, easing: tween.easeInOut, onFinish: function onFinish() { tween(nebula, { scaleX: pulseScale, scaleY: pulseScale }, { duration: 8000 + Math.random() * 12000, easing: tween.easeInOut }); } }); // Color cycling effect var colors = [0x330066, 0x663300, 0x006633, 0x660033, 0x336600, 0x003366]; var colorIndex = 0; LK.setInterval(function () { if (nebula && !nebula.destroyed) { colorIndex = (colorIndex + 1) % colors.length; tween(nebula, { tint: colors[colorIndex] }, { duration: 5000, easing: tween.easeInOut }); } }, 6000 + Math.random() * 4000); self.nebulae.push(nebula); } self.update = function () { // Scroll nebulae very slowly for (var i = 0; i < self.nebulae.length; i++) { var nebula = self.nebulae[i]; nebula.y += self.scrollSpeed; // Reset nebula position when it goes off screen if (nebula.y > 2732 + 300) { nebula.y = -300; nebula.x = Math.random() * 2048; nebula.alpha = 0.1 + Math.random() * 0.2; nebula.scaleX = 1 + Math.random() * 2; nebula.scaleY = 1 + Math.random() * 2; } } }; return self; }); var OmegaDominator = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0xff0000; graphics.scaleX = 1.5; graphics.scaleY = 1.5; self.hp = 100; self.maxHp = 100; self.phase = 1; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 15; self.specialTimer = 0; self.specialInterval = 180; self.teleportTimer = 0; self.teleportInterval = 300; self.minionTimer = 0; self.minionInterval = 900; self.update = function () { // Phase transitions if (self.hp <= self.maxHp * 0.66 && self.phase === 1) { self.phase = 2; self.shootInterval = 10; } if (self.hp <= self.maxHp * 0.33 && self.phase === 2) { self.phase = 3; self.shootInterval = 8; } // Movement if (self.phase < 3) { self.x += self.moveDirection * 4; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } } // Teleport in phase 3 self.teleportTimer++; if (self.phase === 3 && self.teleportTimer >= self.teleportInterval) { self.x = Math.random() * 1400 + 300; self.teleportTimer = 0; } // Combinatorial attacks self.shootTimer++; if (self.shootTimer >= self.shootInterval) { // Barrage fire for (var i = -2; i <= 2; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 30; bullet.y = self.y + 75; bossBullets.push(bullet); game.addChild(bullet); } // Targeted strike if (player) { var targeted = new BossBullet(); targeted.x = self.x; targeted.y = self.y + 75; var dx = player.x - targeted.x; targeted.speedX = dx > 0 ? 8 : -8; targeted.speed = 12; targeted.update = function () { this.x += this.speedX; this.y += this.speed; }; bossBullets.push(targeted); game.addChild(targeted); } self.shootTimer = 0; } // Special attacks self.specialTimer++; if (self.specialTimer >= self.specialInterval) { if (self.phase >= 2) { // Ultimate barrage in later phases for (var row = 0; row < 3; row++) { for (var col = -4; col <= 4; col++) { var bullet = new BossBullet(); bullet.x = self.x + col * 40; bullet.y = self.y + 75 + row * 30; bullet.speed = 4 + row; bossBullets.push(bullet); game.addChild(bullet); } } } self.specialTimer = 0; } // Summon minions self.minionTimer++; if (self.minionTimer >= self.minionInterval && self.phase >= 2) { for (var i = 0; i < 2; i++) { var minion = new BasicDrone(); minion.x = self.x + (i - 0.5) * 200; minion.y = self.y + 150; minion.hp = 2; enemies.push(minion); game.addChild(minion); } self.minionTimer = 0; } }; return self; }); var OrbitalDrone = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('orbitalDrone', { anchorX: 0.5, anchorY: 0.5 }); self.angle = 0; self.radius = 120; self.boss = null; self.hp = 2; self.maxHp = 2; self.update = function () { if (self.boss) { self.angle += 0.05; self.x = self.boss.x + Math.cos(self.angle) * self.radius; self.y = self.boss.y + Math.sin(self.angle) * self.radius; } }; return self; }); // Boss Classes var OverlordDrone = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 20; self.maxHp = 20; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 45; self.targetedTimer = 0; self.targetedInterval = 300; self.strafeTimer = 0; self.update = function () { self.x += self.moveDirection * 3; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } // Strafe maneuver self.strafeTimer++; if (self.strafeTimer > 240) { self.x += Math.random() > 0.5 ? 100 : -100; self.strafeTimer = 0; } // Barrage fire self.shootTimer++; if (self.shootTimer >= self.shootInterval) { for (var i = -1; i <= 1; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 30; bullet.y = self.y + 75; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; LK.getSound('enemyShoot').play(); } // Targeted strike self.targetedTimer++; if (self.targetedTimer >= self.targetedInterval && player) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bullet.speed = 10; var dx = player.x - bullet.x; bullet.speedX = dx > 0 ? 8 : -8; bullet.update = function () { this.x += this.speedX; this.y += this.speed; }; bossBullets.push(bullet); game.addChild(bullet); self.targetedTimer = 0; } }; return self; }); var PhantasmShifter = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss12', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 26; self.maxHp = 26; self.moveDirection = 1; self.phaseTimer = 0; self.phaseInterval = 240; self.ethereal = false; self.shootTimer = 0; self.update = function () { self.x += self.moveDirection * (2 + Math.random() * 2); if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.phaseTimer++; if (self.phaseTimer >= self.phaseInterval) { self.ethereal = !self.ethereal; graphics.alpha = self.ethereal ? 0.5 : 1.0; self.phaseTimer = 0; } self.shootTimer++; var interval = self.ethereal ? 30 : 60; if (self.shootTimer >= interval) { var spread = self.ethereal ? 5 : 3; for (var i = -(spread - 1) / 2; i <= (spread - 1) / 2; i++) { var bullet = new BossBullet(); bullet.x = self.x + i * 25; bullet.y = self.y + 75; bullet.speed = 6; bossBullets.push(bullet); game.addChild(bullet); } self.shootTimer = 0; } }; return self; }); var PlasmaCannonade = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss8', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0xff8800; self.hp = 32; self.maxHp = 32; self.moveDirection = 1; self.chargeTimer = 0; self.chargeInterval = 180; self.suppressiveTimer = 0; self.charging = false; self.update = function () { self.x += self.moveDirection * 1; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.chargeTimer++; if (self.chargeTimer >= self.chargeInterval && !self.charging) { self.charging = true; graphics.tint = 0xffff00; self.chargeTimer = 0; } if (self.charging) { self.chargeTimer++; if (self.chargeTimer >= 90) { // Fire large plasma ball var plasma = new BossBullet(); plasma.x = self.x; plasma.y = self.y + 75; plasma.speed = 4; plasma.damage = 2; plasma.scaleX = 3; plasma.scaleY = 3; plasma.tint = 0xffff00; bossBullets.push(plasma); game.addChild(plasma); self.charging = false; graphics.tint = 0xff8800; self.chargeTimer = 0; } } else { // Suppressive fire self.suppressiveTimer++; if (self.suppressiveTimer >= 20) { var bullet = new BossBullet(); bullet.x = self.x + (Math.random() - 0.5) * 100; bullet.y = self.y + 75; bullet.speed = 7; bossBullets.push(bullet); game.addChild(bullet); self.suppressiveTimer = 0; } } }; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('playerShip', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.shootTimer = 0; self.shootInterval = 8; // Add exotic pulsing glow effect tween(graphics, { tint: 0x88ccff }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(graphics, { tint: 0xffffff }, { duration: 2000, easing: tween.easeInOut }); } }); // Subtle breathing scale effect tween(graphics, { scaleX: 1.05, scaleY: 1.05 }, { duration: 1500, easing: tween.easeInOut, onFinish: function onFinish() { tween(graphics, { scaleX: 1, scaleY: 1 }, { duration: 1500, easing: tween.easeInOut }); } }); self.update = function () { self.shootTimer++; // Check if disrupted by boss ability var canAutoShoot = !self.disruptedUntil || LK.ticks > self.disruptedUntil; if (self.shootTimer >= self.shootInterval && canAutoShoot) { var bullet = new PlayerBullet(); bullet.x = self.x; bullet.y = self.y - 40; playerBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; LK.getSound('shoot').play(); } }; return self; }); var PlayerBullet = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('playerBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -12; self.damage = 1; self.update = function () { self.y += self.speed; }; return self; }); var PulseMortar = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0x888888; self.hp = 30; self.maxHp = 30; self.shootTimer = 0; self.shootInterval = 90; self.update = function () { self.shootTimer++; if (self.shootTimer >= self.shootInterval) { var grenade = new BossBullet(); grenade.x = self.x; grenade.y = self.y + 75; grenade.speed = 4; grenade.targetY = player ? player.y - 100 : 2200; grenade.exploded = false; grenade.update = function () { this.y += this.speed; if (this.y >= this.targetY && !this.exploded) { this.exploded = true; for (var i = -1; i <= 1; i++) { var fragment = new BossBullet(); fragment.x = this.x + i * 40; fragment.y = this.y; fragment.speed = 6; bossBullets.push(fragment); game.addChild(fragment); } this.destroy(); } }; bossBullets.push(grenade); game.addChild(grenade); self.shootTimer = 0; } }; return self; }); var Reconstructor = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); graphics.tint = 0x00ff88; self.hp = 22; self.maxHp = 22; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 20; self.disruptorTimer = 0; self.disruptorInterval = 600; self.update = function () { self.x += self.moveDirection * (Math.random() * 4 + 1); if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bossBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; } self.disruptorTimer++; if (self.disruptorTimer >= self.disruptorInterval && player) { var disruptor = new BossBullet(); disruptor.x = self.x; disruptor.y = self.y + 75; disruptor.isDisruptor = true; disruptor.tint = 0x00ffff; bossBullets.push(disruptor); game.addChild(disruptor); self.disruptorTimer = 0; } }; return self; }); var ReflectorUnit = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss13', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 28; self.maxHp = 28; self.moveDirection = 1; self.shieldTimer = 0; self.shieldInterval = 180; self.shielded = false; self.shootTimer = 0; self.update = function () { self.x += self.moveDirection * 1.5; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shieldTimer++; if (self.shieldTimer >= self.shieldInterval) { self.shielded = !self.shielded; graphics.tint = self.shielded ? 0x4488ff : 0xffffff; self.shieldTimer = 0; } self.shootTimer++; if (self.shootTimer >= 90) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bullet.speed = 12; bullet.scaleX = 0.5; bullet.scaleY = 2; bossBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; } }; return self; }); var SentinelOverseer = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 15; self.maxHp = 15; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 60; self.drones = []; // Create orbital drones for (var i = 0; i < 3; i++) { var drone = new OrbitalDrone(); drone.boss = self; drone.angle = i / 3 * Math.PI * 2; self.drones.push(drone); game.addChild(drone); } self.update = function () { self.x += self.moveDirection * 2; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bossBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; LK.getSound('enemyShoot').play(); } }; return self; }); var ShieldedVanguard = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('shieldedVanguard', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1.2; self.hp = 6; self.maxHp = 6; self.shielded = true; self.shieldTimer = 0; self.shootTimer = 0; self.shootInterval = 100; self.update = function () { self.y += self.speed; self.shieldTimer++; self.shootTimer++; if (self.shieldTimer > 300) { self.shielded = false; graphics.tint = 0xffffff; } if (self.shootTimer >= self.shootInterval) { var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y + 35; enemyBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; LK.getSound('enemyShoot').play(); } }; return self; }); var Sniper = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('sniper', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 1; self.hp = 2; self.maxHp = 2; self.shootTimer = 0; self.shootInterval = 180; self.update = function () { self.y += self.speed; self.shootTimer++; if (self.shootTimer >= self.shootInterval && player) { var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y + 40; var dx = player.x - bullet.x; var dy = player.y - bullet.y; var distance = Math.sqrt(dx * dx + dy * dy); bullet.speedX = dx / distance * 10; bullet.speedY = dy / distance * 10; bullet.update = function () { this.x += this.speedX; this.y += this.speedY; }; enemyBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; LK.getSound('enemyShoot').play(); } }; return self; }); // Dynamic star particle class var StarParticle = Container.expand(function (size, color, speed) { var self = Container.call(this); self.speed = speed || 2; self.twinklePhase = Math.random() * Math.PI * 2; self.twinkleSpeed = 0.02 + Math.random() * 0.03; self.baseAlpha = 0.3 + Math.random() * 0.7; var graphics = self.attachAsset(size, { anchorX: 0.5, anchorY: 0.5 }); if (color) { graphics.tint = color; } graphics.alpha = self.baseAlpha; self.update = function () { // Move star downward self.y += self.speed; // Add subtle twinkle effect self.twinklePhase += self.twinkleSpeed; graphics.alpha = self.baseAlpha + Math.sin(self.twinklePhase) * 0.3; // Random exotic color shifts if (Math.random() < 0.003) { var colors = [0xffffff, 0xaaaaff, 0xffffaa, 0xffaaff, 0xaaffaa, 0xffaaaa]; var newColor = colors[Math.floor(Math.random() * colors.length)]; tween(graphics, { tint: newColor }, { duration: 2000 + Math.random() * 3000, easing: tween.easeInOut }); } // Random scale pulsing if (Math.random() < 0.001) { var targetScale = 0.5 + Math.random() * 2; tween(graphics, { scaleX: targetScale, scaleY: targetScale }, { duration: 1500 + Math.random() * 2500, easing: tween.elasticOut, onFinish: function onFinish() { tween(graphics, { scaleX: 1, scaleY: 1 }, { duration: 1000, easing: tween.bounceOut }); } }); } }; return self; }); var TwinViper = Container.expand(function () { var self = Container.call(this); self.unit1 = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5, x: -80 }); self.unit2 = self.attachAsset('boss1', { anchorX: 0.5, anchorY: 0.5, x: 80 }); self.unit1.tint = 0x440088; self.unit2.tint = 0x440088; self.hp = 25; self.maxHp = 25; self.moveDirection = 1; self.shootTimer = 0; self.shootInterval = 60; self.update = function () { self.x += self.moveDirection * 2; if (self.x <= 200 || self.x >= 1848) { self.moveDirection *= -1; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { var bullet1 = new BossBullet(); bullet1.x = self.x - 80; bullet1.y = self.y + 75; var bullet2 = new BossBullet(); bullet2.x = self.x + 80; bullet2.y = self.y + 75; bossBullets.push(bullet1); bossBullets.push(bullet2); game.addChild(bullet1); game.addChild(bullet2); self.shootTimer = 0; LK.getSound('enemyShoot').play(); } }; return self; }); var WarpSentinel = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('boss9', { anchorX: 0.5, anchorY: 0.5 }); self.hp = 28; self.maxHp = 28; self.shootTimer = 0; self.shootInterval = 70; self.warpTimer = 0; self.warpInterval = 200; self.update = function () { self.warpTimer++; if (self.warpTimer >= self.warpInterval) { self.x = Math.random() * 1400 + 300; if (Math.random() > 0.5) { self.y = Math.max(200, self.y - 50); } self.warpTimer = 0; } self.shootTimer++; if (self.shootTimer >= self.shootInterval) { var bullet = new BossBullet(); bullet.x = self.x; bullet.y = self.y + 75; bullet.speed = 6; bullet.warpDistance = 200; bullet.warped = false; bullet.originalUpdate = bullet.update; bullet.update = function () { this.y += this.speed; if (!this.warped && this.y > this.warpDistance) { this.y += 150; this.warped = true; } }; bossBullets.push(bullet); game.addChild(bullet); self.shootTimer = 0; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000022 }); /**** * Game Code ****/ // Game variables // Background layer assets for parallax effect var player; var playerBullets = []; var enemies = []; var enemyBullets = []; var bossBullets = []; var mines = []; var currentBoss = null; var bossActive = false; var level = 1; var enemiesKilled = 0; var enemiesNeeded = 10; var spawnTimer = 0; var spawnInterval = 120; var dragNode = null; var playerMaxHealth = 5; var playerHealth = 5; // Dynamic starfield arrays var farStars = []; var midStars = []; var nearStars = []; var maxFarStars = 60; var maxMidStars = 35; var maxNearStars = 20; var starSpawnTimer = 0; var nebulaLayer; // Cosmic elements arrays var cosmicPlanets = []; var cosmicComets = []; var asteroidFields = []; var maxPlanets = 3; var maxComets = 5; var maxAsteroids = 8; var cosmicSpawnTimer = 0; // UI Elements var levelText = new Text2('Level: 1', { size: 60, fill: 0xFFFFFF }); levelText.anchor.set(0.5, 0); LK.gui.top.addChild(levelText); levelText.y = 80; var scoreText = new Text2('Score: 0', { size: 50, fill: 0xFFFFFF }); scoreText.anchor.set(0, 0); LK.gui.topRight.addChild(scoreText); scoreText.x = -300; scoreText.y = 20; var hpText = new Text2('', { size: 40, fill: 0xFF4444 }); hpText.anchor.set(0.5, 0); LK.gui.center.addChild(hpText); hpText.y = -300; var playerHealthText = new Text2('Health: 5/5', { size: 50, fill: 0x00FF00 }); playerHealthText.anchor.set(0, 0); LK.gui.topLeft.addChild(playerHealthText); playerHealthText.x = 120; playerHealthText.y = 20; // Initialize nebula layer nebulaLayer = new NebulaLayer(); game.addChild(nebulaLayer); // Initialize starting stars for (var i = 0; i < maxFarStars; i++) { var star = new StarParticle('starField1', 0xffffff, 0.5 + Math.random() * 0.5); star.x = Math.random() * 2048; star.y = Math.random() * 2732; farStars.push(star); game.addChild(star); } for (var i = 0; i < maxMidStars; i++) { var star = new StarParticle('starField2', 0xaaaaff, 1.0 + Math.random() * 0.8); star.x = Math.random() * 2048; star.y = Math.random() * 2732; midStars.push(star); game.addChild(star); } for (var i = 0; i < maxNearStars; i++) { var star = new StarParticle('starField3', 0xffffaa, 1.5 + Math.random() * 1.0); star.x = Math.random() * 2048; star.y = Math.random() * 2732; nearStars.push(star); game.addChild(star); } // Initialize player player = new Player(); player.x = 1024; player.y = 2500; game.addChild(player); // Enemy spawn functions function spawnRandomEnemy() { var enemyType = Math.floor(Math.random() * 5); var enemy; switch (enemyType) { case 0: enemy = new BasicDrone(); break; case 1: enemy = new BurstShooter(); break; case 2: enemy = new Sniper(); break; case 3: enemy = new Minelayer(); break; case 4: enemy = new ShieldedVanguard(); break; } enemy.x = Math.random() * 1500 + 250; enemy.y = -100; // Scale stats based on level var levelMultiplier = 1 + (level - 1) * 0.1; enemy.speed *= levelMultiplier; enemy.hp = Math.floor(enemy.hp * levelMultiplier); enemy.maxHp = enemy.hp; enemies.push(enemy); game.addChild(enemy); } function spawnBoss() { if (level % 10 === 0) { bossActive = true; var bossIndex = Math.floor(level / 10); // Scale boss health based on level var healthMultiplier = 1 + (bossIndex - 1) * 0.3; switch (bossIndex) { case 1: currentBoss = new OverlordDrone(); break; case 2: currentBoss = new SentinelOverseer(); break; case 3: currentBoss = new PulseMortar(); break; case 4: currentBoss = new TwinViper(); break; case 5: currentBoss = new Reconstructor(); break; case 6: currentBoss = new GladiusSwarmMaster(); break; case 7: currentBoss = new OverlordDrone(); break; case 8: currentBoss = new SentinelOverseer(); break; case 9: currentBoss = new EchoStriker(); break; case 10: currentBoss = new ApexPredator(); break; case 11: currentBoss = new CryoBombard(); break; case 12: currentBoss = new PlasmaCannonade(); break; case 13: currentBoss = new WarpSentinel(); break; case 14: currentBoss = new KineticRam(); break; case 15: currentBoss = new ArtilleryCore(); break; case 16: currentBoss = new PhantasmShifter(); break; case 17: currentBoss = new ReflectorUnit(); break; case 18: currentBoss = new ChronoWeaver(); break; case 19: currentBoss = new AnnihilatorCore(); break; default: currentBoss = new OmegaDominator(); } // Apply health scaling currentBoss.hp = Math.floor(currentBoss.hp * healthMultiplier); currentBoss.maxHp = currentBoss.hp; currentBoss.x = 1024; currentBoss.y = 400; game.addChild(currentBoss); // Exotic boss entrance effect currentBoss.scaleX = 0; currentBoss.scaleY = 0; currentBoss.alpha = 0; currentBoss.rotation = Math.PI * 4; tween(currentBoss, { scaleX: 1, scaleY: 1, alpha: 1, rotation: 0 }, { duration: 2000, easing: tween.elasticOut }); // Add dramatic tint flash tween(currentBoss, { tint: 0xff0000 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { tween(currentBoss, { tint: 0xffffff }, { duration: 1500, easing: tween.easeInOut }); } }); hpText.setText('Boss HP: ' + currentBoss.hp + '/' + currentBoss.maxHp); } } var lastLevel = 0; var lastScore = 0; var lastBossHp = 0; var lastPlayerHealth = 0; function updateUI() { if (level !== lastLevel) { levelText.setText('Level: ' + level); lastLevel = level; } var currentScore = LK.getScore(); if (currentScore !== lastScore) { scoreText.setText('Score: ' + currentScore); lastScore = currentScore; } if (currentBoss) { if (currentBoss.hp !== lastBossHp) { hpText.setText('Boss HP: ' + currentBoss.hp + '/' + currentBoss.maxHp); lastBossHp = currentBoss.hp; } } else if (lastBossHp !== 0) { hpText.setText(''); lastBossHp = 0; } // Update player health display with color coding if (playerHealth !== lastPlayerHealth) { playerHealthText.setText('Health: ' + playerHealth + '/' + playerMaxHealth); var healthPercent = playerHealth / playerMaxHealth; if (healthPercent > 0.6) { playerHealthText.fill = 0x00FF00; // Green } else if (healthPercent > 0.3) { playerHealthText.fill = 0xFFFF00; // Yellow } else { playerHealthText.fill = 0xFF0000; // Red } lastPlayerHealth = playerHealth; } } // Touch controls game.move = function (x, y, obj) { if (dragNode && player) { player.x = Math.max(40, Math.min(2008, x)); player.y = Math.max(1000, Math.min(2700, y)); } }; game.down = function (x, y, obj) { dragNode = player; if (player) { player.x = Math.max(40, Math.min(2008, x)); player.y = Math.max(1000, Math.min(2700, y)); } }; game.up = function (x, y, obj) { dragNode = null; }; // Main game update game.update = function () { // Update dynamic starfield starSpawnTimer++; cosmicSpawnTimer++; // Manage cosmic planets for (var i = cosmicPlanets.length - 1; i >= 0; i--) { var planet = cosmicPlanets[i]; if (planet.y > 2732 + 400) { planet.destroy(); cosmicPlanets.splice(i, 1); } } // Spawn new cosmic planets occasionally (less frequently) if (cosmicSpawnTimer % 900 === 0 && cosmicPlanets.length < maxPlanets) { var planet = new CosmicPlanet(0.6 + Math.random() * 1.2, [0x4444aa, 0xaa4444, 0x44aa44, 0xaaaa44][Math.floor(Math.random() * 4)], 0.2 + Math.random() * 0.4); planet.x = Math.random() * 2048; planet.y = -300; cosmicPlanets.push(planet); game.addChild(planet); } // Manage cosmic comets for (var i = cosmicComets.length - 1; i >= 0; i--) { var comet = cosmicComets[i]; if (comet.y > 2732 + 50 || comet.x < -50 || comet.x > 2098 || comet.expired) { comet.destroy(); cosmicComets.splice(i, 1); } } // Spawn new comets occasionally (less frequently) if (cosmicSpawnTimer % 360 === 0 && cosmicComets.length < maxComets) { var comet = new CosmicComet(); comet.x = Math.random() * 2048; comet.y = -50; cosmicComets.push(comet); game.addChild(comet); } // Manage asteroid fields for (var i = asteroidFields.length - 1; i >= 0; i--) { var asteroid = asteroidFields[i]; if (asteroid.y > 2732 + 50) { asteroid.destroy(); asteroidFields.splice(i, 1); } } // Spawn new asteroids occasionally (less frequently) if (cosmicSpawnTimer % 270 === 0 && asteroidFields.length < maxAsteroids) { var asteroid = new AsteroidField(); asteroid.x = Math.random() * 2048; asteroid.y = -25; asteroidFields.push(asteroid); game.addChild(asteroid); } // Manage far stars (small, slow) for (var i = farStars.length - 1; i >= 0; i--) { var star = farStars[i]; if (star.y > 2732 + 50) { star.destroy(); farStars.splice(i, 1); } } // Spawn new far stars (less frequently) if (starSpawnTimer % 20 === 0 && farStars.length < maxFarStars) { var star = new StarParticle('starField1', 0xffffff, 0.5 + Math.random() * 0.5); star.x = Math.random() * 2048; star.y = -20; farStars.push(star); game.addChild(star); } // Manage mid stars (medium, faster) for (var i = midStars.length - 1; i >= 0; i--) { var star = midStars[i]; if (!star || star.y > 2732 + 50) { if (star) star.destroy(); midStars.splice(i, 1); } } // Spawn new mid stars (less frequently) if (starSpawnTimer % 30 === 0 && midStars.length < maxMidStars) { var star = new StarParticle('starField2', 0xaaaaff, 1.0 + Math.random() * 0.8); star.x = Math.random() * 2048; star.y = -20; midStars.push(star); game.addChild(star); } // Manage near stars (large, fastest) for (var i = nearStars.length - 1; i >= 0; i--) { var star = nearStars[i]; if (!star || star.y > 2732 + 50) { if (star) star.destroy(); nearStars.splice(i, 1); } } // Spawn new near stars (less frequently) if (starSpawnTimer % 40 === 0 && nearStars.length < maxNearStars) { var star = new StarParticle('starField3', 0xffffaa, 1.5 + Math.random() * 1.0); star.x = Math.random() * 2048; star.y = -20; nearStars.push(star); game.addChild(star); } updateUI(); // Spawn logic if (!bossActive) { spawnTimer++; if (spawnTimer >= spawnInterval && enemies.length < 8) { spawnRandomEnemy(); spawnTimer = 0; } // Check if level should advance if (enemiesKilled >= enemiesNeeded) { level++; enemiesKilled = 0; enemiesNeeded += 5; spawnInterval = Math.max(30, spawnInterval - 5); // Check for boss level if (level % 10 === 0) { spawnBoss(); } } } // Update player bullets for (var i = playerBullets.length - 1; i >= 0; i--) { var bullet = playerBullets[i]; if (!bullet || bullet.y < -50) { if (bullet) bullet.destroy(); playerBullets.splice(i, 1); continue; } var bulletHit = false; // Check collision with enemies (limit to prevent performance issues) var maxEnemyChecks = Math.min(enemies.length, 15); for (var j = 0; j < maxEnemyChecks && j < enemies.length; j++) { var enemy = enemies[j]; if (!enemy) continue; if (bullet.intersects(enemy)) { // Check if shielded if (enemy.shielded) { bullet.destroy(); playerBullets.splice(i, 1); bulletHit = true; break; } enemy.hp -= bullet.damage || 1; bullet.destroy(); playerBullets.splice(i, 1); bulletHit = true; if (enemy.hp <= 0) { LK.setScore(LK.getScore() + 100); LK.getSound('explosion').play(); // Exotic destruction effect tween(enemy, { scaleX: 2, scaleY: 2, alpha: 0, rotation: Math.PI * 2 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { enemy.destroy(); } }); enemies.splice(j, 1); enemiesKilled++; } break; } } if (bulletHit) continue; // Check collision with boss if (currentBoss && bullet.intersects(currentBoss)) { // Check if boss has reflector shield active if (currentBoss.shielded && currentBoss.constructor.name === 'ReflectorUnit') { // Reflect bullet back at player var reflected = new BossBullet(); reflected.x = bullet.x; reflected.y = bullet.y; reflected.speed = 8; reflected.isReflected = true; bossBullets.push(reflected); game.addChild(reflected); bullet.destroy(); playerBullets.splice(i, 1); continue; } else if (currentBoss.ethereal && currentBoss.constructor.name === 'PhantasmShifter') { // Bullet passes through ethereal boss continue; } currentBoss.hp -= bullet.damage || 1; bullet.destroy(); playerBullets.splice(i, 1); LK.getSound('bossHit').play(); if (currentBoss.hp <= 0) { LK.setScore(LK.getScore() + 1000); LK.getSound('explosion').play(); // Destroy boss drones if (currentBoss.drones) { for (var d = 0; d < currentBoss.drones.length; d++) { if (currentBoss.drones[d]) currentBoss.drones[d].destroy(); } currentBoss.drones = []; } // Destroy boss echos if (currentBoss.echos) { currentBoss.echos = []; } currentBoss.destroy(); currentBoss = null; bossActive = false; level++; enemiesKilled = 0; enemiesNeeded += 5; } continue; } // Check collision with boss drones (limit checks) if (currentBoss && currentBoss.drones && currentBoss.drones.length > 0) { for (var d = Math.min(currentBoss.drones.length - 1, 2); d >= 0; d--) { var drone = currentBoss.drones[d]; if (!drone) continue; if (bullet.intersects(drone)) { drone.hp -= bullet.damage || 1; bullet.destroy(); playerBullets.splice(i, 1); if (drone.hp <= 0) { LK.setScore(LK.getScore() + 200); LK.getSound('explosion').play(); drone.destroy(); currentBoss.drones.splice(d, 1); } break; } } } } // Prevent array overflow - limit bullet counts if (enemyBullets.length > 100) { for (var cleanup = 0; cleanup < 20; cleanup++) { if (enemyBullets[cleanup]) { enemyBullets[cleanup].destroy(); enemyBullets.splice(cleanup, 1); } } } if (bossBullets.length > 150) { for (var cleanup = 0; cleanup < 30; cleanup++) { if (bossBullets[cleanup]) { bossBullets[cleanup].destroy(); bossBullets.splice(cleanup, 1); } } } // Update enemy bullets for (var i = enemyBullets.length - 1; i >= 0; i--) { var bullet = enemyBullets[i]; if (!bullet || bullet.y > 2800) { if (bullet) bullet.destroy(); enemyBullets.splice(i, 1); continue; } // Check collision with player if (player && bullet.intersects(player)) { playerHealth--; bullet.destroy(); enemyBullets.splice(i, 1); LK.effects.flashObject(player, 0xff0000, 500); // Exotic hit effect - dramatic scale bounce and rotation tween(player, { scaleX: 1.3, scaleY: 1.3, rotation: 0.3 }, { duration: 200, easing: tween.elasticOut, onFinish: function onFinish() { tween(player, { scaleX: 1, scaleY: 1, rotation: 0 }, { duration: 300, easing: tween.bounceOut }); } }); // Screen shake simulation through game scaling tween(game, { scaleX: 1.02, scaleY: 1.02 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(game, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.bounceOut }); } }); if (playerHealth <= 0) { LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); return; } continue; } } // Update boss bullets for (var i = bossBullets.length - 1; i >= 0; i--) { var bullet = bossBullets[i]; if (!bullet || bullet.y > 2800 || bullet.x < -100 || bullet.x > 2148) { if (bullet) bullet.destroy(); bossBullets.splice(i, 1); continue; } // Check collision with player if (player && bullet.intersects(player)) { if (bullet.isDisruptor) { // Disruptor bullet - disable auto-shooting temporarily player.disruptedUntil = LK.ticks + 180; // 3 seconds at 60 FPS bullet.destroy(); bossBullets.splice(i, 1); LK.effects.flashObject(player, 0x00ffff, 500); continue; } else if (bullet.isFrost) { // Frost bullet - slow player movement temporarily player.slowedUntil = LK.ticks + 60; // 1 second slow effect bullet.destroy(); bossBullets.splice(i, 1); LK.effects.flashObject(player, 0x4488ff, 500); continue; } var damage = bullet.damage || 1; playerHealth -= damage; bullet.destroy(); bossBullets.splice(i, 1); LK.effects.flashObject(player, 0xff0000, 500); if (playerHealth <= 0) { LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); return; } continue; } } // Update mines for (var i = mines.length - 1; i >= 0; i--) { var mine = mines[i]; if (mine.y > 2800) { mine.destroy(); mines.splice(i, 1); continue; } // Check collision with player if (mine.armed && mine.intersects(player)) { playerHealth--; mine.destroy(); mines.splice(i, 1); LK.effects.flashObject(player, 0xff0000, 800); LK.getSound('explosion').play(); if (playerHealth <= 0) { LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); return; } continue; } } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.y > 2800) { enemy.destroy(); enemies.splice(i, 1); continue; } // Check collision with player if (enemy.intersects(player)) { playerHealth--; enemy.destroy(); enemies.splice(i, 1); LK.effects.flashObject(player, 0xff0000, 600); if (playerHealth <= 0) { LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); return; } continue; } } // Victory condition if (level > 200) { LK.showYouWin(); } };
===================================================================
--- original.js
+++ change.js
@@ -407,9 +407,9 @@
}
});
// Color shifting effect
var colorShiftTimer = Math.random() * 8000;
- setTimeout(function () {
+ LK.setTimeout(function () {
var colors = [0x4444aa, 0xaa4444, 0x44aa44, 0xaaaa44, 0xaa44aa, 0x44aaaa];
var newColor = colors[Math.floor(Math.random() * colors.length)];
tween(graphics, {
tint: newColor
white good guys spaceship top view.
Drone spaceship top view.
mine spaceship top view.
crazy spaceship top view.
crazy spaceship top view.
poison laser spaceship top view.
poisonous yellow laser spaceship top view.
poisonous yellow laser spaceship top view.
toxic yellow lava spaceship top view.
yellow lava spaceship top view.
crazy yellow lava spaceship top view.
crazy blue lava spaceship top view.
crazy blue lava spider spaceship top view.
crazy blue lava cat spaceship top view.
crazy blue cat spaceship top view.
combat drone spaceship top view.
war drone spaceship skull tip top view.
war drone spaceship skull tip top view.
Combat space helicopter skull tip top view.
battle drone spear tip top view.
Top view of space cloud.
Shielded Vanguard spaceship top view.
yellow bullet top view
yellow lava poisonous bullet top view
bomber drone top view
toxic lava bomber drone top view
fat bullet bomb top view
sniper spaceship top view
sniper spaceship top view
barrel bomb top view
lightning bullet top view