User prompt
Add an attack key. Sometimes the game stops and let's attack. But Sans should dodge the attacks, so that he can die after escaping 10 times. Asgore, on the other hand, can block attacks 12 times. After that, it may disappear. Flowey, on the other hand, destroys attacks until he dies by chance and asgo. After Sans and Asgore die, he changes to his strongest form and starts to send 10 İvy, which he destroys attacks 5 times, but dies after that. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Increase the number of gaster blasters to 10
User prompt
Increase the number of spears to 2. Let the number of Ivy be 5 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let it be a gaster blaster. (Sans's) And a white beam will come through it. (there will be a black line around it) damage:12 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Don't let the characters be themselves. Add assets to them
User prompt
There must be people who send them to us. Let there be 3 people 1.Sans 2.asgore 3.flowey Sans side (Bone thrower) asgore in the middle (The owner of the Hoe) Flowey on the other side (Ivy sender) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the Ivys go from top to bottom of the box ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the ivy go from the top of the box to the bottom ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
LET THE ANCHOR MOVE LEFT AND RIGHT. LET THE IVY MOVE UP AND DOWN ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the left move up and down, not the right
User prompt
Do Ivy Let it be like an anchor, but it should bend down from the top of the box (Let it be 800 Height) And let there be 2-3 of them ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the Ivy come sometimes (Let the Ivy deal 5 damage and slow it down for %25) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Our health is running low on its own. Remove self-reduction
User prompt
Delete yellow thing
User prompt
Delete the heart from moving itself
User prompt
Reduce irradiation of bones by 75%
User prompt
Make our health 92. Let the bones deal 4 damage. Anchor 6 Damage
User prompt
WhReduce the rate of bones coming out a lot, and reduce the bidet speed excessively
User prompt
Bones slow down bones very fast. Get us up to speed. And when we stop touching, let's slow down a little and stop ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
When the anchor is orange, we can move, but if we don't move, our health decreases. Blue is the opposite, ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
WHY THE ANCHOR SHOULD BE OUTSIDE THE BOX, IT SHOULD NOT BE OUTSIDE AT ALL ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
The anchor is only the longer the box, that is, the anchor does not go out of the box ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the anchor Height 1200 pixels ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Anchor Let it not be long, but thick. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the anchor be as long as the box. Don't let it be thick ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Anchor = Container.expand(function () { var self = Container.call(this); // Create anchor graphic var anchorGraphics = self.attachAsset('anchor', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 10 }); self.isBlue = true; // true = blue (stop), false = orange (move) self.damage = 6; self.lastX = 0; self.lastY = 0; self.colorChangeTimer = 0; self.colorChangeInterval = 180; // Change color every 3 seconds at 60fps self.speed = 3; self.movingRight = true; // Update anchor color self.updateColor = function () { if (self.isBlue) { anchorGraphics.tint = 0x0066ff; // Blue } else { anchorGraphics.tint = 0xff6600; // Orange } }; self.update = function () { self.lastX = self.x; self.lastY = self.y; // Move horizontally within the box boundaries var anchorHalfWidth = 60; // Half of 120px anchor width var minX = boxX + 8 + anchorHalfWidth; var maxX = boxX + boxWidth - 8 - anchorHalfWidth; if (self.movingRight) { self.x += self.speed; // Move right if (self.x >= maxX) { self.x = maxX; self.movingRight = false; // Switch to moving left } } else { self.x -= self.speed; // Move left if (self.x <= minX) { self.x = minX; self.movingRight = true; // Switch to moving right } } // Keep anchor within vertical bounds of the box var anchorHalfHeight = 600; // Half of 1200px anchor height var minY = boxY + 8 + anchorHalfHeight; var maxY = boxY + boxHeight - 8 - anchorHalfHeight; if (self.y < minY) { self.y = minY; } if (self.y > maxY) { self.y = maxY; } // Change color periodically self.colorChangeTimer++; if (self.colorChangeTimer >= self.colorChangeInterval) { self.isBlue = !self.isBlue; self.updateColor(); self.colorChangeTimer = 0; } }; // Initialize with blue color self.updateColor(); return self; }); var Asgore = Container.expand(function () { var self = Container.call(this); // Create Asgore using proper Asgore image asset var asgoreGraphics = self.attachAsset('asgore', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); self.attackTimer = 0; self.attackInterval = 240; // Attack every 4 seconds self.blocksLeft = 12; self.isDead = false; self.block = function () { if (self.blocksLeft > 0 && !self.isDead) { self.blocksLeft--; // Flash blue to indicate block tween(asgoreGraphics, { tint: 0x0066ff }, { duration: 100, onFinish: function onFinish() { tween(asgoreGraphics, { tint: 0xffffff }, { duration: 100 }); } }); if (self.blocksLeft <= 0) { self.isDead = true; tween(asgoreGraphics, { alpha: 0.3 }, { duration: 500 }); } return true; } return false; }; return self; }); var BoxBoundary = Container.expand(function () { var self = Container.call(this); // Create four walls for the box var topWall = self.attachAsset('boxBorder', { anchorX: 0, anchorY: 0, width: 1600, height: 8 }); var bottomWall = self.attachAsset('boxBorder', { anchorX: 0, anchorY: 0, width: 1600, height: 8 }); var leftWall = self.attachAsset('boxBorder', { anchorX: 0, anchorY: 0, width: 8, height: 1200 }); var rightWall = self.attachAsset('boxBorder', { anchorX: 0, anchorY: 0, width: 8, height: 1200 }); // Position walls topWall.x = 0; topWall.y = 0; bottomWall.x = 0; bottomWall.y = 1200 - 8; leftWall.x = 0; leftWall.y = 0; rightWall.x = 1600 - 8; rightWall.y = 0; return self; }); var Flowey = Container.expand(function () { var self = Container.call(this); // Create Flowey using proper Flowey image asset var floweyGraphics = self.attachAsset('flowey', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); self.attackTimer = 0; self.attackInterval = 600; // Attack every 10 seconds self.destroysLeft = 999; // Infinite until transformation self.finalFormDestroysLeft = 5; self.isFinalForm = false; self.isDead = false; self.destroyAttack = function () { if (self.isDead) return false; var destroysToUse = self.isFinalForm ? self.finalFormDestroysLeft : self.destroysLeft; if (destroysToUse > 0) { if (self.isFinalForm) { self.finalFormDestroysLeft--; if (self.finalFormDestroysLeft <= 0) { self.isDead = true; tween(floweyGraphics, { alpha: 0.3 }, { duration: 500 }); } } // Flash red to indicate destruction tween(floweyGraphics, { tint: 0xff0000 }, { duration: 100, onFinish: function onFinish() { tween(floweyGraphics, { tint: 0xffffff }, { duration: 100 }); } }); return true; } return false; }; self.transformToFinalForm = function () { if (!self.isFinalForm) { self.isFinalForm = true; self.attackInterval = 300; // Attack more frequently // Transform animation tween(floweyGraphics, { scaleX: 1.5, scaleY: 1.5, tint: 0xff00ff }, { duration: 1000, easing: tween.easeOut }); } }; return self; }); var GasterBeam = Container.expand(function () { var self = Container.call(this); // Create black border first (behind white beam) var beamBorder = self.attachAsset('beamBorder', { anchorX: 0.5, anchorY: 0.5 }); // Create white beam on top var whiteBeam = self.attachAsset('whiteBeam', { anchorX: 0.5, anchorY: 0.5 }); self.damage = 12; // Gaster beam damage self.speed = 4; self.lastX = 0; self.lastY = 0; self.targetX = 0; self.targetY = 0; self.isActive = false; self.fireBeam = function (targetX, targetY) { if (self.isActive) return; self.isActive = true; self.targetX = targetX; self.targetY = targetY; // Calculate direction to target var deltaX = targetX - self.x; var deltaY = targetY - self.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); // Set rotation to point towards target self.rotation = Math.atan2(deltaY, deltaX) + Math.PI / 2; // Add 90 degrees because beam asset points up // Move towards target tween(self, { x: targetX, y: targetY }, { duration: distance / self.speed * 16, // Adjust duration based on distance easing: tween.linear, onFinish: function onFinish() { self.isActive = false; } }); }; self.update = function () { self.lastX = self.x; self.lastY = self.y; }; return self; }); var GasterBlaster = Container.expand(function () { var self = Container.call(this); // Create Gaster Blaster using image asset var blasterGraphics = self.attachAsset('gasterBlaster', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); self.chargeTime = 60; // 1 second charge time at 60fps self.chargeTimer = 0; self.isCharging = false; self.isReady = false; self.beamDuration = 120; // 2 seconds beam duration self.beamTimer = 0; self.targetX = 0; self.targetY = 0; self.startCharge = function (targetX, targetY) { if (self.isCharging || self.isReady) return; self.isCharging = true; self.targetX = targetX; self.targetY = targetY; self.chargeTimer = 0; // Point towards target during charge var deltaX = targetX - self.x; var deltaY = targetY - self.y; self.rotation = Math.atan2(deltaY, deltaX); // Flash effect during charge tween(blasterGraphics, { alpha: 0.3 }, { duration: 100, easing: tween.linear, onFinish: function onFinish() { tween(blasterGraphics, { alpha: 1 }, { duration: 100, easing: tween.linear }); } }); }; self.fireBeam = function () { if (!self.isReady) return null; var beam = new GasterBeam(); beam.x = self.x; beam.y = self.y; beam.lastX = beam.x; beam.lastY = beam.y; beam.fireBeam(self.targetX, self.targetY); return beam; }; self.update = function () { if (self.isCharging) { self.chargeTimer++; if (self.chargeTimer >= self.chargeTime) { self.isCharging = false; self.isReady = true; self.beamTimer = 0; } } else if (self.isReady) { self.beamTimer++; if (self.beamTimer >= self.beamDuration) { self.isReady = false; } } }; return self; }); var Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Ivy = Container.expand(function () { var self = Container.call(this); // Create ivy graphic - anchor from top to hang down var ivyGraphics = self.attachAsset('ivy', { anchorX: 0.5, anchorY: 0 }); self.damage = 5; self.speed = 3; self.lastX = 0; self.lastY = 0; self.movingRight = true; self.update = function () { self.lastX = self.x; self.lastY = self.y; // Move downward from top to bottom of box self.y += self.speed; // Always move down }; return self; }); var PlayerAttack = Container.expand(function () { var self = Container.call(this); var attackGraphics = self.attachAsset('playerAttack', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.targetX = 0; self.targetY = 0; self.lastX = 0; self.lastY = 0; self.setTarget = function (targetX, targetY) { self.targetX = targetX; self.targetY = targetY; // Calculate direction var deltaX = targetX - self.x; var deltaY = targetY - self.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); if (distance > 0) { self.velocityX = deltaX / distance * self.speed; self.velocityY = deltaY / distance * self.speed; } }; self.update = function () { self.lastX = self.x; self.lastY = self.y; self.x += self.velocityX; self.y += self.velocityY; }; return self; }); var Sans = Container.expand(function () { var self = Container.call(this); // Create Sans using proper Sans image asset var sansGraphics = self.attachAsset('sans', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); self.attackTimer = 0; self.attackInterval = 720; // Attack every 12 seconds self.dodgesLeft = 10; self.isDead = false; self.originalX = 0; self.originalY = 0; self.dodge = function () { if (self.dodgesLeft > 0 && !self.isDead) { self.dodgesLeft--; // Move to random position near original location var dodgeDistance = 100; var angle = Math.random() * Math.PI * 2; var newX = self.originalX + Math.cos(angle) * dodgeDistance; var newY = self.originalY + Math.sin(angle) * dodgeDistance; tween(self, { x: newX, y: newY }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { // Return to original position tween(self, { x: self.originalX, y: self.originalY }, { duration: 300, easing: tween.easeIn }); } }); if (self.dodgesLeft <= 0) { self.isDead = true; tween(sansGraphics, { alpha: 0.3 }, { duration: 500 }); } return true; } return false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xf0f8ff }); /**** * Game Code ****/ // Box dimensions var boxX = 224; // Center the 1600px box in 2048px screen var boxY = 766; // Center the 1200px box in 2732px screen var boxWidth = 1600; var boxHeight = 1200; // Create box boundary var boundary = game.addChild(new BoxBoundary()); boundary.x = boxX; boundary.y = boxY; // Create heart character var heart = game.addChild(new Heart()); heart.x = boxX + boxWidth / 2; // Center of box heart.y = boxY + boxHeight / 2; // Center of box // Create the three characters // Sans on the left side (bone thrower) var sans = game.addChild(new Sans()); sans.x = boxX - 150; // Left side of box sans.y = boxY + boxHeight / 2; // Middle height // Asgore in the middle (anchor owner) var asgore = game.addChild(new Asgore()); asgore.x = boxX + boxWidth / 2; // Center of box horizontally asgore.y = boxY - 150; // Above the box // Flowey on the right side (ivy sender) var flowey = game.addChild(new Flowey()); flowey.x = boxX + boxWidth + 150; // Right side of box flowey.y = boxY + boxHeight / 2; // Middle height // Create lives display var livesTxt = new Text2('Lives: 92', { size: 80, fill: 0x000000 }); livesTxt.anchor.set(0.5, 0); LK.gui.top.addChild(livesTxt); // Create attack key (initially hidden) attackKey = LK.getAsset('attackKey', { anchorX: 0.5, anchorY: 0.5 }); attackKey.x = 2048 / 2; attackKey.y = 2732 - 200; attackKey.alpha = 0; var attackKeyText = new Text2('ATTACK!', { size: 40, fill: 0x000000 }); attackKeyText.anchor.set(0.5, 0.5); attackKey.addChild(attackKeyText); LK.gui.addChild(attackKey); // Store original positions for characters sans.originalX = sans.x; sans.originalY = sans.y; // Dragging variables var isDragging = false; var dragOffsetX = 0; var dragOffsetY = 0; // Constraint function to keep heart within boundaries function constrainHeartPosition() { var heartRadius = 50; // Half of heart width/height // Left boundary if (heart.x - heartRadius < boxX + 8) { heart.x = boxX + 8 + heartRadius; } // Right boundary if (heart.x + heartRadius > boxX + boxWidth - 8) { heart.x = boxX + boxWidth - 8 - heartRadius; } // Top boundary if (heart.y - heartRadius < boxY + 8) { heart.y = boxY + 8 + heartRadius; } // Bottom boundary if (heart.y + heartRadius > boxY + boxHeight - 8) { heart.y = boxY + boxHeight - 8 - heartRadius; } } // Player control variables var targetX = 0; var targetY = 0; var isPlayerControlling = false; // Touch/mouse down event game.down = function (x, y, obj) { if (isAttackMode && attackKeyVisible) { // Check if attack key was pressed var keyBounds = attackKey.getBounds(); var globalPos = LK.gui.toGlobal(attackKey.position); if (x >= globalPos.x - 100 && x <= globalPos.x + 100 && y >= globalPos.y - 50 && y <= globalPos.y + 50) { // Attack key pressed - create attack towards nearest enemy var nearestEnemy = null; var nearestDistance = Infinity; // Check Sans if (!sans.isDead) { var distToSans = Math.sqrt(Math.pow(heart.x - sans.x, 2) + Math.pow(heart.y - sans.y, 2)); if (distToSans < nearestDistance) { nearestDistance = distToSans; nearestEnemy = sans; } } // Check Asgore if (!asgore.isDead) { var distToAsgore = Math.sqrt(Math.pow(heart.x - asgore.x, 2) + Math.pow(heart.y - asgore.y, 2)); if (distToAsgore < nearestDistance) { nearestDistance = distToAsgore; nearestEnemy = asgore; } } // Check Flowey if (!flowey.isDead) { var distToFlowey = Math.sqrt(Math.pow(heart.x - flowey.x, 2) + Math.pow(heart.y - flowey.y, 2)); if (distToFlowey < nearestDistance) { nearestDistance = distToFlowey; nearestEnemy = flowey; } } // Create attack towards nearest enemy if (nearestEnemy) { var attack = new PlayerAttack(); attack.x = heart.x; attack.y = heart.y; attack.lastX = attack.x; attack.lastY = attack.y; attack.setTarget(nearestEnemy.x, nearestEnemy.y); playerAttacks.push(attack); game.addChild(attack); } return; } } if (!isAttackMode) { isPlayerControlling = true; targetX = x; targetY = y; } }; // Touch/mouse move event game.move = function (x, y, obj) { if (isPlayerControlling && !isAttackMode) { targetX = x; targetY = y; } }; // Touch/mouse up event game.up = function (x, y, obj) { if (!isAttackMode) { isPlayerControlling = false; } }; // Lives system var lives = 92; // Attack system variables var isAttackMode = false; var attackModeTimer = 0; var attackModeDuration = 300; // 5 seconds at 60fps var attackModeInterval = 1800; // Attack mode every 30 seconds var attackModeCountdown = attackModeInterval; var playerAttacks = []; var attackKey = null; var attackKeyVisible = false; // Movement variables var heartSpeed = 8; var movementDirection = { x: 1, y: 0.5 }; // Initial movement direction var lastDirectionChangeTime = 0; var directionChangeInterval = 2000; // Change direction every 2 seconds // Gaster Blaster and beam system var gasterBlasters = []; var gasterBeams = []; var maxBlasters = 10; var blasterSpawnTimer = 0; var blasterSpawnInterval = 720; // Spawn every 12 seconds at 60fps var waveIntensity = 1; // Anchor system var anchors = []; var maxAnchors = 2; var anchorSpawnTimer = 0; var anchorSpawnInterval = 240; // Spawn every 4 seconds at 60fps // Ivy system var ivies = []; var maxIvies = 5; var ivySpawnTimer = 0; var ivySpawnInterval = 600; // Spawn every 10 seconds at 60fps // Slow effect system var isSlowed = false; var slowEndTime = 0; var normalHeartSpeed = 8; // Function to spawn a new Gaster Blaster at random edge position function spawnGasterBlaster() { if (gasterBlasters.length >= maxBlasters) return; var blaster = new GasterBlaster(); var edge = Math.floor(Math.random() * 4); // 0=top, 1=right, 2=bottom, 3=left // Position blaster at random point on selected edge switch (edge) { case 0: // Top edge blaster.x = boxX + Math.random() * boxWidth; blaster.y = boxY - 100; break; case 1: // Right edge blaster.x = boxX + boxWidth + 100; blaster.y = boxY + Math.random() * boxHeight; break; case 2: // Bottom edge blaster.x = boxX + Math.random() * boxWidth; blaster.y = boxY + boxHeight + 100; break; case 3: // Left edge blaster.x = boxX - 100; blaster.y = boxY + Math.random() * boxHeight; break; } gasterBlasters.push(blaster); game.addChild(blaster); // Start charging to attack the heart blaster.startCharge(heart.x, heart.y); } // Function to spawn a new anchor at random position within the box function spawnAnchor() { if (anchors.length >= maxAnchors) return; var anchor = new Anchor(); // Position anchor within the box boundaries for horizontal movement var anchorHalfWidth = 60; // Half of 120px anchor width var startFromLeft = Math.random() < 0.5; if (startFromLeft) { anchor.x = boxX + 8 + anchorHalfWidth; // Start from left edge inside box anchor.movingRight = true; // Moving right } else { anchor.x = boxX + boxWidth - 8 - anchorHalfWidth; // Start from right edge inside box anchor.movingRight = false; // Moving left } // Random Y position within the box, constrained to keep full anchor height inside var anchorHalfHeight = 600; // Half of 1200px anchor height anchor.y = boxY + anchorHalfHeight + Math.random() * (boxHeight - 2 * anchorHalfHeight); anchor.lastX = anchor.x; anchor.lastY = anchor.y; anchors.push(anchor); game.addChild(anchor); } // Function to spawn a new ivy hanging from top of box like an anchor function spawnIvy() { if (ivies.length >= maxIvies) return; var ivy = new Ivy(); // Position ivy at the very top of box to move downward (anchor point is at top of ivy) ivy.y = boxY + 8; // Start from top edge inside box // Random X position within the box, constrained to keep full ivy width inside var ivyHalfWidth = 60; // Half of 120px ivy width ivy.x = boxX + ivyHalfWidth + Math.random() * (boxWidth - 2 * ivyHalfWidth); ivy.lastX = ivy.x; ivy.lastY = ivy.y; ivies.push(ivy); game.addChild(ivy); } // Game update loop game.update = function () { // Handle attack mode timing if (!isAttackMode) { attackModeCountdown--; if (attackModeCountdown <= 0) { // Enter attack mode isAttackMode = true; attackModeTimer = 0; attackKeyVisible = true; // Show attack key tween(attackKey, { alpha: 1 }, { duration: 300 }); // Reset countdown attackModeCountdown = attackModeInterval; } } else { attackModeTimer++; if (attackModeTimer >= attackModeDuration) { // Exit attack mode isAttackMode = false; attackKeyVisible = false; isPlayerControlling = false; // Hide attack key tween(attackKey, { alpha: 0 }, { duration: 300 }); } } // Check if Sans and Asgore are both dead for Flowey transformation if (sans.isDead && asgore.isDead && !flowey.isFinalForm && !flowey.isDead) { flowey.transformToFinalForm(); // Update ivy system for final form maxIvies = 10; flowey.attackInterval = 300; } // Update player attacks for (var a = playerAttacks.length - 1; a >= 0; a--) { var attack = playerAttacks[a]; // Check collision with Sans if (!sans.isDead && attack.intersects(sans)) { if (sans.dodge()) { // Attack dodged attack.destroy(); playerAttacks.splice(a, 1); continue; } } // Check collision with Asgore if (!asgore.isDead && attack.intersects(asgore)) { if (asgore.block()) { // Attack blocked attack.destroy(); playerAttacks.splice(a, 1); continue; } } // Check collision with Flowey if (!flowey.isDead && attack.intersects(flowey)) { if (flowey.destroyAttack()) { // Attack destroyed attack.destroy(); playerAttacks.splice(a, 1); continue; } } // Remove attacks that are too far away var distFromCenter = Math.sqrt(Math.pow(attack.x - 1024, 2) + Math.pow(attack.y - 1366, 2)); if (distFromCenter > 3000) { attack.destroy(); playerAttacks.splice(a, 1); } } // Increase wave intensity over time if (LK.ticks % 600 === 0) { // Every 10 seconds waveIntensity = Math.min(waveIntensity + 0.5, 4); maxBlasters = Math.min(Math.floor(2 + waveIntensity), 10); blasterSpawnInterval = Math.max(Math.floor(720 - waveIntensity * 120), 300); } // Update Sans attack timer and spawn Gaster Blasters (only if alive and not in attack mode) if (!sans.isDead && !isAttackMode) { sans.attackTimer++; if (sans.attackTimer >= sans.attackInterval) { // Sans spawns Gaster Blasters var spawnCount = Math.random() < 0.4 ? Math.floor(waveIntensity) : 1; for (var s = 0; s < spawnCount && gasterBlasters.length < maxBlasters; s++) { spawnGasterBlaster(); } sans.attackTimer = 0; } } // Update Asgore attack timer and spawn anchors (only if alive and not in attack mode) if (!asgore.isDead && !isAttackMode) { asgore.attackTimer++; if (asgore.attackTimer >= asgore.attackInterval) { // Asgore sends anchors spawnAnchor(); asgore.attackTimer = 0; } } // Update Flowey attack timer and spawn ivies (only if alive and not in attack mode) if (!flowey.isDead && !isAttackMode) { flowey.attackTimer++; if (flowey.attackTimer >= flowey.attackInterval) { // Flowey sends ivies var spawnCount = flowey.isFinalForm ? 10 : Math.floor(Math.random() * 2) + 2; // Final form sends 10, normal sends 2-3 for (var i = 0; i < spawnCount && ivies.length < maxIvies; i++) { spawnIvy(); } flowey.attackTimer = 0; } } // Handle slow effect expiry if (isSlowed && LK.ticks >= slowEndTime) { isSlowed = false; heartSpeed = normalHeartSpeed; } // Update all Gaster Blasters and spawn beams when ready for (var i = gasterBlasters.length - 1; i >= 0; i--) { var blaster = gasterBlasters[i]; // Check if blaster is ready to fire if (blaster.isReady && blaster.beamTimer === 0) { var beam = blaster.fireBeam(); if (beam) { gasterBeams.push(beam); game.addChild(beam); } } // Remove blasters that have finished their attack cycle if (!blaster.isCharging && !blaster.isReady) { blaster.destroy(); gasterBlasters.splice(i, 1); continue; } } // Update all beams and check for collisions for (var j = gasterBeams.length - 1; j >= 0; j--) { var beam = gasterBeams[j]; // Check if beam hit the heart if (beam.intersects(heart)) { // Reduce lives by beam damage (12) lives -= beam.damage; livesTxt.setText('Lives: ' + lives); // Flash screen white to indicate beam damage LK.effects.flashScreen(0xffffff, 600); // Check for game over if (lives <= 0) { LK.showGameOver(); return; } // Remove the beam that hit us beam.destroy(); gasterBeams.splice(j, 1); continue; } // Remove beams that are too far from the play area or inactive var distanceFromCenter = Math.sqrt(Math.pow(beam.x - (boxX + boxWidth / 2), 2) + Math.pow(beam.y - (boxY + boxHeight / 2), 2)); if (distanceFromCenter > 2000 || !beam.isActive) { beam.destroy(); gasterBeams.splice(j, 1); continue; } } // Update all anchors and check for collisions for (var j = anchors.length - 1; j >= 0; j--) { var anchor = anchors[j]; // Removed health decrease timer initialization // Removed anchor-based health decrease mechanic // Check if anchor hit the heart if (anchor.intersects(heart)) { var shouldTakeDamage = false; // Blue anchor: damage if player is moving if (anchor.isBlue && isPlayerControlling) { shouldTakeDamage = true; } // Orange anchor: damage if player is not moving else if (!anchor.isBlue && !isPlayerControlling) { shouldTakeDamage = true; } if (shouldTakeDamage) { // Reduce lives by anchor damage (2) lives -= anchor.damage; livesTxt.setText('Lives: ' + lives); // Flash screen purple to indicate anchor damage LK.effects.flashScreen(0x8800ff, 700); // Check for game over if (lives <= 0) { LK.showGameOver(); return; } } // Remove the anchor that hit us anchor.destroy(); anchors.splice(j, 1); continue; } // Anchors now stay within box bounds, so no need to remove them for going off screen // They will only be removed when hitting the heart } // Update all ivies and check for collisions for (var k = ivies.length - 1; k >= 0; k--) { var ivy = ivies[k]; // Check if ivy hit the heart if (ivy.intersects(heart)) { // Reduce lives by 5 lives -= ivy.damage; livesTxt.setText('Lives: ' + lives); // Apply slow effect (25% speed reduction) isSlowed = true; heartSpeed = normalHeartSpeed * 0.75; slowEndTime = LK.ticks + 300; // Slow for 5 seconds at 60fps // Flash screen green to indicate ivy damage and slow LK.effects.flashScreen(0x00ff00, 600); // Check for game over if (lives <= 0) { LK.showGameOver(); return; } // Remove the ivy that hit us ivy.destroy(); ivies.splice(k, 1); continue; } // Remove ivies that have reached the bottom of the box // Since ivy anchor is at top (anchorY: 0), check when ivy top + height reaches bottom if (ivy.y + 800 >= boxY + boxHeight - 8) { ivy.destroy(); ivies.splice(k, 1); continue; } } if (isPlayerControlling && !isAttackMode) { // Calculate direction toward target var deltaX = targetX - heart.x; var deltaY = targetY - heart.y; var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); // Move toward target if not already there if (distance > 5) { // Normalize direction and apply speed movementDirection.x = deltaX / distance; movementDirection.y = deltaY / distance; heart.x += movementDirection.x * heartSpeed; heart.y += movementDirection.y * heartSpeed; } } // Ensure heart stays within bounds each frame constrainHeartPosition(); };
===================================================================
--- original.js
+++ change.js
@@ -83,8 +83,38 @@
scaleY: 1
});
self.attackTimer = 0;
self.attackInterval = 240; // Attack every 4 seconds
+ self.blocksLeft = 12;
+ self.isDead = false;
+ self.block = function () {
+ if (self.blocksLeft > 0 && !self.isDead) {
+ self.blocksLeft--;
+ // Flash blue to indicate block
+ tween(asgoreGraphics, {
+ tint: 0x0066ff
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(asgoreGraphics, {
+ tint: 0xffffff
+ }, {
+ duration: 100
+ });
+ }
+ });
+ if (self.blocksLeft <= 0) {
+ self.isDead = true;
+ tween(asgoreGraphics, {
+ alpha: 0.3
+ }, {
+ duration: 500
+ });
+ }
+ return true;
+ }
+ return false;
+ };
return self;
});
var BoxBoundary = Container.expand(function () {
var self = Container.call(this);
@@ -134,8 +164,59 @@
scaleY: 1
});
self.attackTimer = 0;
self.attackInterval = 600; // Attack every 10 seconds
+ self.destroysLeft = 999; // Infinite until transformation
+ self.finalFormDestroysLeft = 5;
+ self.isFinalForm = false;
+ self.isDead = false;
+ self.destroyAttack = function () {
+ if (self.isDead) return false;
+ var destroysToUse = self.isFinalForm ? self.finalFormDestroysLeft : self.destroysLeft;
+ if (destroysToUse > 0) {
+ if (self.isFinalForm) {
+ self.finalFormDestroysLeft--;
+ if (self.finalFormDestroysLeft <= 0) {
+ self.isDead = true;
+ tween(floweyGraphics, {
+ alpha: 0.3
+ }, {
+ duration: 500
+ });
+ }
+ }
+ // Flash red to indicate destruction
+ tween(floweyGraphics, {
+ tint: 0xff0000
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(floweyGraphics, {
+ tint: 0xffffff
+ }, {
+ duration: 100
+ });
+ }
+ });
+ return true;
+ }
+ return false;
+ };
+ self.transformToFinalForm = function () {
+ if (!self.isFinalForm) {
+ self.isFinalForm = true;
+ self.attackInterval = 300; // Attack more frequently
+ // Transform animation
+ tween(floweyGraphics, {
+ scaleX: 1.5,
+ scaleY: 1.5,
+ tint: 0xff00ff
+ }, {
+ duration: 1000,
+ easing: tween.easeOut
+ });
+ }
+ };
return self;
});
var GasterBeam = Container.expand(function () {
var self = Container.call(this);
@@ -283,8 +364,39 @@
self.y += self.speed; // Always move down
};
return self;
});
+var PlayerAttack = Container.expand(function () {
+ var self = Container.call(this);
+ var attackGraphics = self.attachAsset('playerAttack', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 8;
+ self.targetX = 0;
+ self.targetY = 0;
+ self.lastX = 0;
+ self.lastY = 0;
+ self.setTarget = function (targetX, targetY) {
+ self.targetX = targetX;
+ self.targetY = targetY;
+ // Calculate direction
+ var deltaX = targetX - self.x;
+ var deltaY = targetY - self.y;
+ var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+ if (distance > 0) {
+ self.velocityX = deltaX / distance * self.speed;
+ self.velocityY = deltaY / distance * self.speed;
+ }
+ };
+ self.update = function () {
+ self.lastX = self.x;
+ self.lastY = self.y;
+ self.x += self.velocityX;
+ self.y += self.velocityY;
+ };
+ return self;
+});
var Sans = Container.expand(function () {
var self = Container.call(this);
// Create Sans using proper Sans image asset
var sansGraphics = self.attachAsset('sans', {
@@ -294,8 +406,49 @@
scaleY: 1
});
self.attackTimer = 0;
self.attackInterval = 720; // Attack every 12 seconds
+ self.dodgesLeft = 10;
+ self.isDead = false;
+ self.originalX = 0;
+ self.originalY = 0;
+ self.dodge = function () {
+ if (self.dodgesLeft > 0 && !self.isDead) {
+ self.dodgesLeft--;
+ // Move to random position near original location
+ var dodgeDistance = 100;
+ var angle = Math.random() * Math.PI * 2;
+ var newX = self.originalX + Math.cos(angle) * dodgeDistance;
+ var newY = self.originalY + Math.sin(angle) * dodgeDistance;
+ tween(self, {
+ x: newX,
+ y: newY
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ // Return to original position
+ tween(self, {
+ x: self.originalX,
+ y: self.originalY
+ }, {
+ duration: 300,
+ easing: tween.easeIn
+ });
+ }
+ });
+ if (self.dodgesLeft <= 0) {
+ self.isDead = true;
+ tween(sansGraphics, {
+ alpha: 0.3
+ }, {
+ duration: 500
+ });
+ }
+ return true;
+ }
+ return false;
+ };
return self;
});
/****
@@ -340,8 +493,26 @@
fill: 0x000000
});
livesTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(livesTxt);
+// Create attack key (initially hidden)
+attackKey = LK.getAsset('attackKey', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+attackKey.x = 2048 / 2;
+attackKey.y = 2732 - 200;
+attackKey.alpha = 0;
+var attackKeyText = new Text2('ATTACK!', {
+ size: 40,
+ fill: 0x000000
+});
+attackKeyText.anchor.set(0.5, 0.5);
+attackKey.addChild(attackKeyText);
+LK.gui.addChild(attackKey);
+// Store original positions for characters
+sans.originalX = sans.x;
+sans.originalY = sans.y;
// Dragging variables
var isDragging = false;
var dragOffsetX = 0;
var dragOffsetY = 0;
@@ -370,25 +541,84 @@
var targetY = 0;
var isPlayerControlling = false;
// Touch/mouse down event
game.down = function (x, y, obj) {
- isPlayerControlling = true;
- targetX = x;
- targetY = y;
+ if (isAttackMode && attackKeyVisible) {
+ // Check if attack key was pressed
+ var keyBounds = attackKey.getBounds();
+ var globalPos = LK.gui.toGlobal(attackKey.position);
+ if (x >= globalPos.x - 100 && x <= globalPos.x + 100 && y >= globalPos.y - 50 && y <= globalPos.y + 50) {
+ // Attack key pressed - create attack towards nearest enemy
+ var nearestEnemy = null;
+ var nearestDistance = Infinity;
+ // Check Sans
+ if (!sans.isDead) {
+ var distToSans = Math.sqrt(Math.pow(heart.x - sans.x, 2) + Math.pow(heart.y - sans.y, 2));
+ if (distToSans < nearestDistance) {
+ nearestDistance = distToSans;
+ nearestEnemy = sans;
+ }
+ }
+ // Check Asgore
+ if (!asgore.isDead) {
+ var distToAsgore = Math.sqrt(Math.pow(heart.x - asgore.x, 2) + Math.pow(heart.y - asgore.y, 2));
+ if (distToAsgore < nearestDistance) {
+ nearestDistance = distToAsgore;
+ nearestEnemy = asgore;
+ }
+ }
+ // Check Flowey
+ if (!flowey.isDead) {
+ var distToFlowey = Math.sqrt(Math.pow(heart.x - flowey.x, 2) + Math.pow(heart.y - flowey.y, 2));
+ if (distToFlowey < nearestDistance) {
+ nearestDistance = distToFlowey;
+ nearestEnemy = flowey;
+ }
+ }
+ // Create attack towards nearest enemy
+ if (nearestEnemy) {
+ var attack = new PlayerAttack();
+ attack.x = heart.x;
+ attack.y = heart.y;
+ attack.lastX = attack.x;
+ attack.lastY = attack.y;
+ attack.setTarget(nearestEnemy.x, nearestEnemy.y);
+ playerAttacks.push(attack);
+ game.addChild(attack);
+ }
+ return;
+ }
+ }
+ if (!isAttackMode) {
+ isPlayerControlling = true;
+ targetX = x;
+ targetY = y;
+ }
};
// Touch/mouse move event
game.move = function (x, y, obj) {
- if (isPlayerControlling) {
+ if (isPlayerControlling && !isAttackMode) {
targetX = x;
targetY = y;
}
};
// Touch/mouse up event
game.up = function (x, y, obj) {
- isPlayerControlling = false;
+ if (!isAttackMode) {
+ isPlayerControlling = false;
+ }
};
// Lives system
var lives = 92;
+// Attack system variables
+var isAttackMode = false;
+var attackModeTimer = 0;
+var attackModeDuration = 300; // 5 seconds at 60fps
+var attackModeInterval = 1800; // Attack mode every 30 seconds
+var attackModeCountdown = attackModeInterval;
+var playerAttacks = [];
+var attackKey = null;
+var attackKeyVisible = false;
// Movement variables
var heartSpeed = 8;
var movementDirection = {
x: 1,
@@ -487,41 +717,123 @@
game.addChild(ivy);
}
// Game update loop
game.update = function () {
+ // Handle attack mode timing
+ if (!isAttackMode) {
+ attackModeCountdown--;
+ if (attackModeCountdown <= 0) {
+ // Enter attack mode
+ isAttackMode = true;
+ attackModeTimer = 0;
+ attackKeyVisible = true;
+ // Show attack key
+ tween(attackKey, {
+ alpha: 1
+ }, {
+ duration: 300
+ });
+ // Reset countdown
+ attackModeCountdown = attackModeInterval;
+ }
+ } else {
+ attackModeTimer++;
+ if (attackModeTimer >= attackModeDuration) {
+ // Exit attack mode
+ isAttackMode = false;
+ attackKeyVisible = false;
+ isPlayerControlling = false;
+ // Hide attack key
+ tween(attackKey, {
+ alpha: 0
+ }, {
+ duration: 300
+ });
+ }
+ }
+ // Check if Sans and Asgore are both dead for Flowey transformation
+ if (sans.isDead && asgore.isDead && !flowey.isFinalForm && !flowey.isDead) {
+ flowey.transformToFinalForm();
+ // Update ivy system for final form
+ maxIvies = 10;
+ flowey.attackInterval = 300;
+ }
+ // Update player attacks
+ for (var a = playerAttacks.length - 1; a >= 0; a--) {
+ var attack = playerAttacks[a];
+ // Check collision with Sans
+ if (!sans.isDead && attack.intersects(sans)) {
+ if (sans.dodge()) {
+ // Attack dodged
+ attack.destroy();
+ playerAttacks.splice(a, 1);
+ continue;
+ }
+ }
+ // Check collision with Asgore
+ if (!asgore.isDead && attack.intersects(asgore)) {
+ if (asgore.block()) {
+ // Attack blocked
+ attack.destroy();
+ playerAttacks.splice(a, 1);
+ continue;
+ }
+ }
+ // Check collision with Flowey
+ if (!flowey.isDead && attack.intersects(flowey)) {
+ if (flowey.destroyAttack()) {
+ // Attack destroyed
+ attack.destroy();
+ playerAttacks.splice(a, 1);
+ continue;
+ }
+ }
+ // Remove attacks that are too far away
+ var distFromCenter = Math.sqrt(Math.pow(attack.x - 1024, 2) + Math.pow(attack.y - 1366, 2));
+ if (distFromCenter > 3000) {
+ attack.destroy();
+ playerAttacks.splice(a, 1);
+ }
+ }
// Increase wave intensity over time
if (LK.ticks % 600 === 0) {
// Every 10 seconds
waveIntensity = Math.min(waveIntensity + 0.5, 4);
maxBlasters = Math.min(Math.floor(2 + waveIntensity), 10);
blasterSpawnInterval = Math.max(Math.floor(720 - waveIntensity * 120), 300);
}
- // Update Sans attack timer and spawn Gaster Blasters
- sans.attackTimer++;
- if (sans.attackTimer >= sans.attackInterval) {
- // Sans spawns Gaster Blasters
- var spawnCount = Math.random() < 0.4 ? Math.floor(waveIntensity) : 1;
- for (var s = 0; s < spawnCount && gasterBlasters.length < maxBlasters; s++) {
- spawnGasterBlaster();
+ // Update Sans attack timer and spawn Gaster Blasters (only if alive and not in attack mode)
+ if (!sans.isDead && !isAttackMode) {
+ sans.attackTimer++;
+ if (sans.attackTimer >= sans.attackInterval) {
+ // Sans spawns Gaster Blasters
+ var spawnCount = Math.random() < 0.4 ? Math.floor(waveIntensity) : 1;
+ for (var s = 0; s < spawnCount && gasterBlasters.length < maxBlasters; s++) {
+ spawnGasterBlaster();
+ }
+ sans.attackTimer = 0;
}
- sans.attackTimer = 0;
}
- // Update Asgore attack timer and spawn anchors
- asgore.attackTimer++;
- if (asgore.attackTimer >= asgore.attackInterval) {
- // Asgore sends anchors
- spawnAnchor();
- asgore.attackTimer = 0;
+ // Update Asgore attack timer and spawn anchors (only if alive and not in attack mode)
+ if (!asgore.isDead && !isAttackMode) {
+ asgore.attackTimer++;
+ if (asgore.attackTimer >= asgore.attackInterval) {
+ // Asgore sends anchors
+ spawnAnchor();
+ asgore.attackTimer = 0;
+ }
}
- // Update Flowey attack timer and spawn ivies
- flowey.attackTimer++;
- if (flowey.attackTimer >= flowey.attackInterval) {
- // Flowey sends ivies - spawn 2-3 ivies at once
- var spawnCount = Math.floor(Math.random() * 2) + 2; // 2 or 3 ivies
- for (var i = 0; i < spawnCount && ivies.length < maxIvies; i++) {
- spawnIvy();
+ // Update Flowey attack timer and spawn ivies (only if alive and not in attack mode)
+ if (!flowey.isDead && !isAttackMode) {
+ flowey.attackTimer++;
+ if (flowey.attackTimer >= flowey.attackInterval) {
+ // Flowey sends ivies
+ var spawnCount = flowey.isFinalForm ? 10 : Math.floor(Math.random() * 2) + 2; // Final form sends 10, normal sends 2-3
+ for (var i = 0; i < spawnCount && ivies.length < maxIvies; i++) {
+ spawnIvy();
+ }
+ flowey.attackTimer = 0;
}
- flowey.attackTimer = 0;
}
// Handle slow effect expiry
if (isSlowed && LK.ticks >= slowEndTime) {
isSlowed = false;
@@ -640,9 +952,9 @@
ivies.splice(k, 1);
continue;
}
}
- if (isPlayerControlling) {
+ if (isPlayerControlling && !isAttackMode) {
// Calculate direction toward target
var deltaX = targetX - heart.x;
var deltaY = targetY - heart.y;
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
Undertale Heart. In-Game asset. 2d. High contrast. No shadows
Undertale bone with black outline. In-Game asset. 2d. High contrast. No shadows
Undertale asgore spear. In-Game asset. 2d. High contrast. No shadows
Ivy. In-Game asset. 2d. High contrast. No shadows
Sans Undertale. In-Game asset. 2d. High contrast. No shadows
Asgore Undertale. In-Game asset. 2d. High contrast. No shadows
Flowey Undertale but with 6 souls (Orange,Green,Yellow,blue,Purple, Light Blue). In-Game asset. 2d. High contrast. No shadows
Flat staring gaster blaster Undertale. In-Game asset. 2d. High contrast. No shadows
Undertale heart but blue. In-Game asset. 2d. High contrast. No shadows
Green Heart Undertale. In-Game asset. 2d. High contrast. No shadows
Yellow heart Undertale. In-Game asset. 2d. High contrast. No shadows