User prompt
çocuk adeasında canımızda gitmeyecek
User prompt
çocuk odasına geçince daha yukarıdan birşeyler gelmesin
User prompt
3 canımız bitince bir anda 2 boyutlu kuş bakışı bir çocuk odasına at
User prompt
oyun 3000 puandan sonra bir anda acayip zorlansın
User prompt
oyun yavaş yavaş hızlansın
User prompt
kaleyi biraz daha büyüt ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Castle Ball Collector
Initial prompt
Collecting balls that come from above with a castle moving on the same axis
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballColors = ['ball', 'ballBlue', 'ballGreen', 'ballYellow'];
var randomColor = ballColors[Math.floor(Math.random() * ballColors.length)];
var ballGraphics = self.attachAsset(randomColor, {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = Math.random() * 3 + 2; // Random speed between 2-5
self.lastY = 0;
self.lastIntersecting = false;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Castle = Container.expand(function () {
var self = Container.call(this);
var castleGraphics = self.attachAsset('castle', {
anchorX: 0.5,
anchorY: 1.0
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var castle = game.addChild(new Castle());
castle.x = 1024; // Center horizontally
castle.y = 2732 - 50; // Near bottom with some padding
var balls = [];
var lives = 3;
var ballSpawnTimer = 0;
var ballSpawnRate = 60; // Spawn every 60 ticks initially
var dragNode = null;
// Score display
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Lives display
var livesTxt = new Text2('Lives: 3', {
size: 60,
fill: 0xFFFFFF
});
livesTxt.anchor.set(0, 0);
livesTxt.x = 100;
livesTxt.y = 100;
LK.gui.topLeft.addChild(livesTxt);
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = x;
// Keep castle within screen bounds
if (dragNode.x < 100) dragNode.x = 100;
if (dragNode.x > 1948) dragNode.x = 1948;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = castle;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
game.update = function () {
// Spawn balls
ballSpawnTimer++;
if (ballSpawnTimer >= ballSpawnRate) {
var newBall = new Ball();
newBall.x = Math.random() * 1848 + 100; // Random x position within screen bounds
newBall.y = -50; // Start above screen
newBall.lastY = newBall.y;
newBall.lastIntersecting = false;
balls.push(newBall);
game.addChild(newBall);
ballSpawnTimer = 0;
// Gradually increase difficulty
if (ballSpawnRate > 30) {
ballSpawnRate = Math.max(30, ballSpawnRate - 0.1);
}
}
// Update balls
for (var i = balls.length - 1; i >= 0; i--) {
var ball = balls[i];
// Check if ball went off screen (missed)
if (ball.lastY < 2732 && ball.y >= 2732) {
// Ball hit ground
lives--;
livesTxt.setText('Lives: ' + lives);
LK.getSound('miss').play();
LK.effects.flashScreen(0xFF0000, 300);
if (lives <= 0) {
LK.showGameOver();
}
ball.destroy();
balls.splice(i, 1);
continue;
}
// Check collision with castle
var currentIntersecting = ball.intersects(castle);
if (!ball.lastIntersecting && currentIntersecting) {
// Ball caught
LK.setScore(LK.getScore() + 10);
scoreTxt.setText('Score: ' + LK.getScore());
LK.getSound('catch').play();
// Flash castle green briefly
LK.effects.flashObject(castle, 0x00FF00, 200);
ball.destroy();
balls.splice(i, 1);
continue;
}
// Update tracking variables
ball.lastY = ball.y;
ball.lastIntersecting = currentIntersecting;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,135 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Ball = Container.expand(function () {
+ var self = Container.call(this);
+ var ballColors = ['ball', 'ballBlue', 'ballGreen', 'ballYellow'];
+ var randomColor = ballColors[Math.floor(Math.random() * ballColors.length)];
+ var ballGraphics = self.attachAsset(randomColor, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = Math.random() * 3 + 2; // Random speed between 2-5
+ self.lastY = 0;
+ self.lastIntersecting = false;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+var Castle = Container.expand(function () {
+ var self = Container.call(this);
+ var castleGraphics = self.attachAsset('castle', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+var castle = game.addChild(new Castle());
+castle.x = 1024; // Center horizontally
+castle.y = 2732 - 50; // Near bottom with some padding
+var balls = [];
+var lives = 3;
+var ballSpawnTimer = 0;
+var ballSpawnRate = 60; // Spawn every 60 ticks initially
+var dragNode = null;
+// Score display
+var scoreTxt = new Text2('Score: 0', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Lives display
+var livesTxt = new Text2('Lives: 3', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+livesTxt.anchor.set(0, 0);
+livesTxt.x = 100;
+livesTxt.y = 100;
+LK.gui.topLeft.addChild(livesTxt);
+function handleMove(x, y, obj) {
+ if (dragNode) {
+ dragNode.x = x;
+ // Keep castle within screen bounds
+ if (dragNode.x < 100) dragNode.x = 100;
+ if (dragNode.x > 1948) dragNode.x = 1948;
+ }
+}
+game.move = handleMove;
+game.down = function (x, y, obj) {
+ dragNode = castle;
+ handleMove(x, y, obj);
+};
+game.up = function (x, y, obj) {
+ dragNode = null;
+};
+game.update = function () {
+ // Spawn balls
+ ballSpawnTimer++;
+ if (ballSpawnTimer >= ballSpawnRate) {
+ var newBall = new Ball();
+ newBall.x = Math.random() * 1848 + 100; // Random x position within screen bounds
+ newBall.y = -50; // Start above screen
+ newBall.lastY = newBall.y;
+ newBall.lastIntersecting = false;
+ balls.push(newBall);
+ game.addChild(newBall);
+ ballSpawnTimer = 0;
+ // Gradually increase difficulty
+ if (ballSpawnRate > 30) {
+ ballSpawnRate = Math.max(30, ballSpawnRate - 0.1);
+ }
+ }
+ // Update balls
+ for (var i = balls.length - 1; i >= 0; i--) {
+ var ball = balls[i];
+ // Check if ball went off screen (missed)
+ if (ball.lastY < 2732 && ball.y >= 2732) {
+ // Ball hit ground
+ lives--;
+ livesTxt.setText('Lives: ' + lives);
+ LK.getSound('miss').play();
+ LK.effects.flashScreen(0xFF0000, 300);
+ if (lives <= 0) {
+ LK.showGameOver();
+ }
+ ball.destroy();
+ balls.splice(i, 1);
+ continue;
+ }
+ // Check collision with castle
+ var currentIntersecting = ball.intersects(castle);
+ if (!ball.lastIntersecting && currentIntersecting) {
+ // Ball caught
+ LK.setScore(LK.getScore() + 10);
+ scoreTxt.setText('Score: ' + LK.getScore());
+ LK.getSound('catch').play();
+ // Flash castle green briefly
+ LK.effects.flashObject(castle, 0x00FF00, 200);
+ ball.destroy();
+ balls.splice(i, 1);
+ continue;
+ }
+ // Update tracking variables
+ ball.lastY = ball.y;
+ ball.lastIntersecting = currentIntersecting;
+ }
+};
\ No newline at end of file
beyaz ağlardan olusan direkleri olan bir futbol kalesi. In-Game asset. 2d. High contrast. No shadows
v. . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
kulak . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
araba . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bir dolabın üst kısmını çiz. In-Game asset. 2d. High contrast. No shadows
kuş bakışı üstünde kitaplar olan bir masa çiz. In-Game asset. 2d. High contrast. No shadows
. . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
. . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
gun. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bulut . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
yıldırım . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat