User prompt
Please fix the bug: 'Timeout.tick error: choice1.pause is not a function' in or related to this line: 'choice1.pause();' Line Number: 54
Code edit (1 edits merged)
Please save this source code
User prompt
joue choice1 au lancement
Code edit (1 edits merged)
Please save this source code
User prompt
creΜe une variable globale pour choice1
User prompt
Please fix the bug: 'LK.pauseMusic is not a function' in or related to this line: 'LK.pauseMusic();' Line Number: 114
User prompt
pause music
Code edit (5 edits merged)
Please save this source code
User prompt
add track1 to the game
Code edit (5 edits merged)
Please save this source code
User prompt
cree une variable globale pour la vitesse
Code edit (2 edits merged)
Please save this source code
User prompt
handle tile missed in PianoTile class instead of game update
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'down')' in or related to this line: 'self.down = function (x, y, obj) {' Line Number: 122
User prompt
don't handle tile tap at game level but at Tile level, in PianoTile class
Code edit (1 edits merged)
Please save this source code
User prompt
lanes should be respectively at 1024-200-3 and 1024+200+3
User prompt
make lanes closer to center
User prompt
don't spawn 2 consecutives tiles on the same lane
User prompt
use column asset to separete lanes
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: tile.containsPoint is not a function' in or related to this line: 'if (tile.containsPoint({' Line Number: 86
Initial prompt
Piano Test
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Define a class for the PianoTile var PianoTile = Container.expand(function () { var self = Container.call(this); // Create and attach a black rectangle as the tile var tileGraphics = self.attachAsset('tile', { anchorX: 0.5, anchorY: 0.5 }); // Set the speed of the tile self.speed = globalSpeed; self.isTapped = false; // Update function to move the tile downwards self.update = function () { self.y += self.speed; // Check if tile is off-screen if (self.y > 2732) { // End game if a tile is missed if (self.isTapped) { if (self.y > 2732 + self.height) { self.destroy(); } return; } LK.showGameOver(); return; } }; // Handle tap events self.down = function (x, y, obj) { // Increase score and destroy the tile LK.setScore(LK.getScore() + 1); self.isTapped = true; self.alpha = 0.1; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x4169e1 //Init game with black background }); /**** * Game Code ****/ // Initialize global speed variable var globalSpeed = 15; var globalTickRate = 900 / globalSpeed; // Initialize global variable for choice1 var choice1 = LK.getSound('choice1'); // Initialize score display var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create column assets to separate lanes var column1 = LK.getAsset('column', { anchorX: 0.5, anchorY: 0.5, x: 1024 - 400 - 3, y: 2732 / 2 }); game.addChild(column1); var column2 = LK.getAsset('column', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2732 / 2 }); game.addChild(column2); var column3 = LK.getAsset('column', { anchorX: 0.5, anchorY: 0.5, x: 1024 + 400 + 3, y: 2732 / 2 }); game.addChild(column3); // Array to keep track of active tiles var tiles = []; // Function to create a new tile var lastLane = 0; function createTile() { var newTile = new PianoTile(); // Randomly position the tile in one of the two lanes newTile.x = lastLane = lastLane == 1024 - 200 - 3 ? 1024 + 200 + 3 : 1024 - 200 - 3; newTile.y = -500; // Start above the screen tiles.push(newTile); game.addChild(newTile); } // Game update function game.update = function () { // Update score display scoreTxt.setText(LK.getScore()); // speed 10 => every 90 ticks // speed 15 => every 60 ticks if (LK.ticks % globalTickRate == 0) { createTile(); } };
===================================================================
--- original.js
+++ change.js
@@ -103,7 +103,5 @@
// speed 15 => every 60 ticks
if (LK.ticks % globalTickRate == 0) {
createTile();
}
-};
-// Stop the music
-LK.stopMusic();
\ No newline at end of file
+};
\ No newline at end of file