User prompt
Let the anchor be as long as the box ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the anchor be Huge and come from the other side of the box to the other side and only 1 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Add an anchor, sometimes it's blue, sometimes it's orange (When it's blue you have to stop, when it's orange you have to move. Damage:2) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Delete The Bone outline
User prompt
Let the text be at the top of the screen and be black
User prompt
Add lives (let us have 10 lives and bones hit 1)
User prompt
Let the bones come like an Undertale sans fight and draw a black line around the bones ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Let the bones come and try to attack us, and we will run away ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Speed up character
User prompt
Let the player control
User prompt
Add movement to character
Code edit (1 edits merged)
Please save this source code
User prompt
Heart in a Box
Initial prompt
Create a box and our character (Heart) Let him travel, but not go outside the box
/**** * Classes ****/ 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 Heart = Container.expand(function () { var self = Container.call(this); var heartGraphics = self.attachAsset('heart', { anchorX: 0.5, anchorY: 0.5 }); 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 // 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; } } // Touch/mouse down event game.down = function (x, y, obj) { // Check if touch is on the heart var heartBounds = { left: heart.x - 50, right: heart.x + 50, top: heart.y - 50, bottom: heart.y + 50 }; if (x >= heartBounds.left && x <= heartBounds.right && y >= heartBounds.top && y <= heartBounds.bottom) { isDragging = true; dragOffsetX = x - heart.x; dragOffsetY = y - heart.y; } }; // Touch/mouse move event game.move = function (x, y, obj) { if (isDragging) { heart.x = x - dragOffsetX; heart.y = y - dragOffsetY; constrainHeartPosition(); } }; // Touch/mouse up event game.up = function (x, y, obj) { isDragging = false; dragOffsetX = 0; dragOffsetY = 0; }; // Movement variables var heartSpeed = 3; var movementDirection = { x: 1, y: 0.5 }; // Initial movement direction var lastDirectionChangeTime = 0; var directionChangeInterval = 2000; // Change direction every 2 seconds // Game update loop game.update = function () { // Auto movement - change direction periodically if (LK.ticks % 120 === 0) { // Every 2 seconds at 60fps movementDirection.x = (Math.random() - 0.5) * 2; // Random x direction between -1 and 1 movementDirection.y = (Math.random() - 0.5) * 2; // Random y direction between -1 and 1 } // Apply movement if not being dragged if (!isDragging) { heart.x += movementDirection.x * heartSpeed; heart.y += movementDirection.y * heartSpeed; } // Ensure heart stays within bounds each frame constrainHeartPosition(); // Bounce off walls by reversing direction var heartRadius = 50; if (heart.x - heartRadius <= boxX + 8 || heart.x + heartRadius >= boxX + boxWidth - 8) { movementDirection.x *= -1; // Reverse horizontal direction } if (heart.y - heartRadius <= boxY + 8 || heart.y + heartRadius >= boxY + boxHeight - 8) { movementDirection.y *= -1; // Reverse vertical direction } };
===================================================================
--- original.js
+++ change.js
@@ -123,9 +123,36 @@
isDragging = false;
dragOffsetX = 0;
dragOffsetY = 0;
};
+// Movement variables
+var heartSpeed = 3;
+var movementDirection = {
+ x: 1,
+ y: 0.5
+}; // Initial movement direction
+var lastDirectionChangeTime = 0;
+var directionChangeInterval = 2000; // Change direction every 2 seconds
// Game update loop
game.update = function () {
+ // Auto movement - change direction periodically
+ if (LK.ticks % 120 === 0) {
+ // Every 2 seconds at 60fps
+ movementDirection.x = (Math.random() - 0.5) * 2; // Random x direction between -1 and 1
+ movementDirection.y = (Math.random() - 0.5) * 2; // Random y direction between -1 and 1
+ }
+ // Apply movement if not being dragged
+ if (!isDragging) {
+ heart.x += movementDirection.x * heartSpeed;
+ heart.y += movementDirection.y * heartSpeed;
+ }
// Ensure heart stays within bounds each frame
constrainHeartPosition();
+ // Bounce off walls by reversing direction
+ var heartRadius = 50;
+ if (heart.x - heartRadius <= boxX + 8 || heart.x + heartRadius >= boxX + boxWidth - 8) {
+ movementDirection.x *= -1; // Reverse horizontal direction
+ }
+ if (heart.y - heartRadius <= boxY + 8 || heart.y + heartRadius >= boxY + boxHeight - 8) {
+ movementDirection.y *= -1; // Reverse vertical direction
+ }
};
\ No newline at end of file
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