User prompt
Eğer coin top tarafından yok olmazsa 10 saniyede bir yer değistirsin
User prompt
Yazı 10 saniye sonra yok olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sağ üstte neden oyunu bitirmeye çalışmıyorsun? yazsın ingilizce olarak
User prompt
Oyun 1000 scorede bitsin
User prompt
Top platform'a çarpınca ses sesi olsun
User prompt
Arka planda müzik;1 olsun ve hep tekrar etsin!!!!!!! aynı zamanda ses;1 in ses seviyesini biraz daha arttır
User prompt
Her 10 scorede hız %5 artsın
User prompt
Top madeni paraya geldiğinde ses;2 olsun
User prompt
Top platforma deydiği zaman ses ; 1 çalışşın
User prompt
Coin yok olunca ekranın başka bir yerinde yeni bir coin oluşşsun
User prompt
Sadece bir tane coin olsun
User prompt
Üstte 1 coin olsun coin'e top geldiği zaman ekranın başka bir yerinde yeni bir top oluşsun
User prompt
Üstte coinler olsun Coine top değidiği zaman coin yok olsun ve Score de +10 artsın
User prompt
Plaform un değil topun renği değissin
User prompt
Please fix the bug: 'ReferenceError: platformGraphics is not defined' in or related to this line: 'platformGraphics.tint = Math.random() * 0xFFFFFF; // Change platform color to a random color' Line Number: 37
User prompt
Top platforma her değdiğinde renki değişssin
User prompt
Harita arka planı kaplasın!
Code edit (4 edits merged)
Please save this source code
User prompt
Kodlarda hata var mı diye bak
Code edit (1 edits merged)
Please save this source code
/**** * Classes ****/ // Ball class to represent the bouncing ball var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 7; // Başlangıçta biraz daha hızlı (artırıldı) self.speedX = 5; // Başlangıçta biraz daha hızlı (artırıldı) self.platformHits = 0; // Platforma çarpma sayacı self.update = function () { self.x += self.speedX; self.y += self.speedY; // Bounce off the left and right walls if (self.x <= 0 || self.x >= 2048) { self.speedX *= -1; // Just reverse direction, no speed increase } // Bounce off the top wall if (self.y <= 0) { self.speedY *= -1; // Just reverse direction, no speed increase } // Bounce off the platform if (self.y >= platform.y - platform.height / 2 && self.y <= platform.y + platform.height / 2 && self.x >= platform.x - platform.width / 2 && self.x <= platform.x + platform.width / 2) { self.speedY *= -1; self.platformHits += 1; // Platforma çarpma sayısını artır // Eğer platforma 5. kez çarptıysa, hız %15 artsın if (self.platformHits % 5 === 0) { self.speedY *= 1.15; // %15 hız artışı self.speedX *= 1.15; // %15 hız artışı } LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); } // Game over if the ball falls below the platform if (self.y > 2732) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }; }); // Platform class to represent the platform var Platform = Container.expand(function () { var self = Container.call(this); var platformGraphics = self.attachAsset('platform', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Platform movement logic can be added here if needed }; }); /**** * Initialize Game ****/ // Initialize the game with black background var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Top ve platform şekilleri tanımlı // Start screen for difficulty selection var startScreen = new Container(); var easyButton = new Text2('Kolay', { size: 60, fill: 0xFFFFFF }); var mediumButton = new Text2('Orta', { size: 60, fill: 0xFFFFFF }); var hardButton = new Text2('Zor', { size: 60, fill: 0xFFFFFF }); easyButton.x = 1024; easyButton.y = 500; mediumButton.x = 1024; mediumButton.y = 650; hardButton.x = 1024; hardButton.y = 800; startScreen.addChild(easyButton); startScreen.addChild(mediumButton); startScreen.addChild(hardButton); // Display the start screen LK.gui.top.addChild(startScreen); // Variables for selected difficulty level var selectedDifficulty = 'medium'; // Default is medium // Event listeners for buttons easyButton.onClick = function () { selectedDifficulty = 'easy'; startGame(); }; mediumButton.onClick = function () { selectedDifficulty = 'medium'; startGame(); }; hardButton.onClick = function () { selectedDifficulty = 'hard'; startGame(); }; // Function to start the game function startGame() { LK.gui.top.removeChild(startScreen); // Remove start screen startGameLevel(selectedDifficulty); // Start the game with the selected difficulty } // Function to initialize the game with selected difficulty function startGameLevel(difficulty) { // Initialize the ball and platform based on difficulty var ball = game.addChild(new Ball()); ball.x = 1024; // Center horizontally ball.y = 1366; // Start above the platform var platform = game.addChild(new Platform()); platform.x = 1024; // Center horizontally platform.y = 2100; // Platform position near the bottom (adjusted lower) // Adjust ball speed based on difficulty if (difficulty === 'easy') { ball.speedX = 4; ball.speedY = 6; } else if (difficulty === 'medium') { ball.speedX = 5; ball.speedY = 7; } else if (difficulty === 'hard') { ball.speedX = 6; ball.speedY = 8; } // Initialize score display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Handle game updates game.update = function () { ball.update(); platform.update(); }; // Handle touch/mouse movement to control the platform game.move = function (x, y, obj) { platform.x = x; }; }
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,7 @@
/****
* Classes
****/
-// Platform boyutları değiştirildi
// Ball class to represent the bouncing ball
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
@@ -11,9 +10,8 @@
});
self.speedY = 7; // Başlangıçta biraz daha hızlı (artırıldı)
self.speedX = 5; // Başlangıçta biraz daha hızlı (artırıldı)
self.platformHits = 0; // Platforma çarpma sayacı
- self.lastY = self.y; // Initialize lastY to track previous Y position
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
// Bounce off the left and right walls
@@ -24,9 +22,9 @@
if (self.y <= 0) {
self.speedY *= -1; // Just reverse direction, no speed increase
}
// Bounce off the platform
- if (self.lastY < platform.y - platform.height / 2 && self.y >= platform.y - platform.height / 2 && self.x >= platform.x - platform.width / 2 && self.x <= platform.x + platform.width / 2) {
+ if (self.y >= platform.y - platform.height / 2 && self.y <= platform.y + platform.height / 2 && self.x >= platform.x - platform.width / 2 && self.x <= platform.x + platform.width / 2) {
self.speedY *= -1;
self.platformHits += 1; // Platforma çarpma sayısını artır
// Eğer platforma 5. kez çarptıysa, hız %15 artsın
if (self.platformHits % 5 === 0) {
@@ -40,9 +38,8 @@
if (self.y > 2732) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
- self.lastY = self.y; // Update lastY after each update
};
});
// Platform class to represent the platform
var Platform = Container.expand(function () {
@@ -67,27 +64,86 @@
/****
* Game Code
****/
// Top ve platform şekilleri tanımlı
-// Initialize the ball and platform
-var ball = game.addChild(new Ball());
-ball.x = 1024; // Center horizontally
-ball.y = 1366; // Start above the platform
-var platform = game.addChild(new Platform());
-platform.x = 1024; // Center horizontally
-platform.y = 2100; // Platform position near the bottom (adjusted lower)
-// Initialize score display
-var scoreTxt = new Text2('0', {
- size: 150,
+// Start screen for difficulty selection
+var startScreen = new Container();
+var easyButton = new Text2('Kolay', {
+ size: 60,
fill: 0xFFFFFF
});
-scoreTxt.anchor.set(0.5, 0);
-LK.gui.top.addChild(scoreTxt);
-// Handle game updates
-game.update = function () {
- ball.update();
- platform.update();
+var mediumButton = new Text2('Orta', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+var hardButton = new Text2('Zor', {
+ size: 60,
+ fill: 0xFFFFFF
+});
+easyButton.x = 1024;
+easyButton.y = 500;
+mediumButton.x = 1024;
+mediumButton.y = 650;
+hardButton.x = 1024;
+hardButton.y = 800;
+startScreen.addChild(easyButton);
+startScreen.addChild(mediumButton);
+startScreen.addChild(hardButton);
+// Display the start screen
+LK.gui.top.addChild(startScreen);
+// Variables for selected difficulty level
+var selectedDifficulty = 'medium'; // Default is medium
+// Event listeners for buttons
+easyButton.onClick = function () {
+ selectedDifficulty = 'easy';
+ startGame();
};
-// Handle touch/mouse movement to control the platform
-game.move = function (x, y, obj) {
- platform.x = x;
-};
\ No newline at end of file
+mediumButton.onClick = function () {
+ selectedDifficulty = 'medium';
+ startGame();
+};
+hardButton.onClick = function () {
+ selectedDifficulty = 'hard';
+ startGame();
+};
+// Function to start the game
+function startGame() {
+ LK.gui.top.removeChild(startScreen); // Remove start screen
+ startGameLevel(selectedDifficulty); // Start the game with the selected difficulty
+}
+// Function to initialize the game with selected difficulty
+function startGameLevel(difficulty) {
+ // Initialize the ball and platform based on difficulty
+ var ball = game.addChild(new Ball());
+ ball.x = 1024; // Center horizontally
+ ball.y = 1366; // Start above the platform
+ var platform = game.addChild(new Platform());
+ platform.x = 1024; // Center horizontally
+ platform.y = 2100; // Platform position near the bottom (adjusted lower)
+ // Adjust ball speed based on difficulty
+ if (difficulty === 'easy') {
+ ball.speedX = 4;
+ ball.speedY = 6;
+ } else if (difficulty === 'medium') {
+ ball.speedX = 5;
+ ball.speedY = 7;
+ } else if (difficulty === 'hard') {
+ ball.speedX = 6;
+ ball.speedY = 8;
+ }
+ // Initialize score display
+ var scoreTxt = new Text2('0', {
+ size: 150,
+ fill: 0xFFFFFF
+ });
+ scoreTxt.anchor.set(0.5, 0);
+ LK.gui.top.addChild(scoreTxt);
+ // Handle game updates
+ game.update = function () {
+ ball.update();
+ platform.update();
+ };
+ // Handle touch/mouse movement to control the platform
+ game.move = function (x, y, obj) {
+ platform.x = x;
+ };
+}
\ No newline at end of file