User prompt
make the P2 lines hit the second target and not the first one.
User prompt
add another target for p2 to shoot too.
User prompt
make the game to force you to play with 2 players.
User prompt
remove the text “PRESS START 0/1 CREDITS” on gameplay.
User prompt
when added credit. make sure it automatically takes you to the ready screen and not the gameplay.
User prompt
I ment to remove the tap mechanism to skip and change the tap mechanism to add another credit.
User prompt
remove the tap mechanism to on the ready screen you can add another credit when tapped.
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'creditsText.setText(coins + '/' + maxCoins + ' CREDITS');' Line Number: 101
User prompt
remove the hold mechanism and change that hold mechanism to hold to skip. and make sure that the credit is gone when used for player 1.
User prompt
on the ready screen. keep the “INSERT COIN 0/1 CREDITS” there.
User prompt
when there is only 1 player. there can only be 2 cannons. if there is 2 players. then 4 cannons should be there.
User prompt
remove the tap/hold mechanism when it’s on the game play so I can drag the target.
User prompt
why does when I tap To insert a coin. I automatically go into the gameplay? change it so I can hold to skip the countdown on the ready screen
User prompt
when there is 1 credit. P1 doesn’t press start. plus when added credit. Make it take you to the ready screen. and Instead of tapping to skip countdown. you have to hold again so when you tap. you insert another coin.
User prompt
why is there another 2 cannons on the top? they are supposed to be on the bottom next to the P1 cannons.
User prompt
the target isn’t movable. and when moving the target with the persons hand moving. the lines appear.
User prompt
Make the target movable. And while shooting. Lines come from the cannons to the target. and there is supposed to be 4 cannons. not 2. and make it so when you press start. the credit goes away and only 1 player is ready.
User prompt
why is there still 2 ships in a middle. they are supposed to be in each corner? (only on the bottom.)
User prompt
When gameplay starts. And when there is 2 players. There is 2 ships in each corner 1 red for P1 and on the other side and Blue for P2 which is also on each side. and those ships don’t move. and a target appears during gameplay. also in the ready screen where players join you can tap to skip the countdown.
User prompt
When On the Ready Screen. After the 15 countdown. There is 4 ships. Two for P1 and one for P2. Those Ships don’t move. And When there is only 1 player. There is only 2 ships. When on gameplay. A text will pop up saying “Shoot Enemy Ships” and after 2 seconds a text will pop up saying “Ready?” And After 1 Second it will say “Go!” And on the bottom. Two arrows will appear by the Word “Protect Cannons” and the gameplay starts.
User prompt
When you hold. A Ship icon Appears. Another Ship Icon Appears. But Faded. When Inserted a coin and Pressed Start. The Second Ship Will Appear but it’s not faded. And while that happens. A 15 Second Countdown appears. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the controls. On the title screen. Tap to insert a coin. Hold to Press Start.
User prompt
after the 2 The “INSERT COIN! 0/1 CREDITS” will appear of the top of the screen. The “0/1 CREDITS” will appear under the “INSERT COIN!”
User prompt
let’s make an animation for the 2. After 3 seconds. The 2 will come up and finish the title.
User prompt
move the 2 By the Invader Blits.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Game state variables
var coins = 0;
var maxCoins = 1;
var gameStarted = false;
var insertCoinText;
var creditsText;
var pressStartText;
var holdStartTime = 0;
var isHolding = false;
var ship1;
var ship2;
var countdownText;
// Create main title text "Invader Blits"
var titleText = new Text2('Invader Blits', {
size: 120,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 2048 / 2;
titleText.y = 2732 / 2 - 50;
game.addChild(titleText);
// Create the "2" text (initially hidden)
var numberText = new Text2('2', {
size: 120,
fill: 0xFFFFFF
});
numberText.anchor.set(0.5, 0.5);
numberText.x = 2048 / 2 + titleText.width / 2 + 20; // Position it after "Invader Blits"
numberText.y = 2732 / 2 - 50;
numberText.alpha = 0; // Start invisible
game.addChild(numberText);
// Position the "2" below the screen initially for slide-up animation
numberText.y = 2732 + 100; // Start below screen
numberText.alpha = 1; // Make it visible but positioned off-screen
// Show the "2" after 3 seconds with a slide-up animation
LK.setTimeout(function () {
tween(numberText, {
y: 2732 / 2 - 50 // Slide up to final position next to title
}, {
duration: 800,
easing: tween.easeOut
});
// After the "2" animation completes, show the INSERT COIN! text
LK.setTimeout(function () {
// Create "INSERT COIN!" text
insertCoinText = new Text2('INSERT COIN!', {
size: 60,
fill: 0xFFFF00 // Yellow color
});
insertCoinText.anchor.set(0.5, 0.5);
insertCoinText.x = 2048 / 2;
insertCoinText.y = 300; // Top of screen
game.addChild(insertCoinText);
// Create "0/1 CREDITS" text
creditsText = new Text2('0/1 CREDITS', {
size: 40,
fill: 0xFFFFFF // White color
});
creditsText.anchor.set(0.5, 0.5);
creditsText.x = 2048 / 2;
creditsText.y = 380; // Below INSERT COIN!
game.addChild(creditsText);
}, 800); // Wait for the "2" animation to complete
}, 3000);
// Function to update credits display
function updateCreditsDisplay() {
creditsText.setText(coins + '/' + maxCoins + ' CREDITS');
// Show "PRESS START" when we have coins
if (coins > 0 && !pressStartText) {
pressStartText = new Text2('PRESS START', {
size: 50,
fill: 0x00FF00 // Green color
});
pressStartText.anchor.set(0.5, 0.5);
pressStartText.x = 2048 / 2;
pressStartText.y = 450; // Below credits
game.addChild(pressStartText);
// Make it blink
tween(pressStartText, {
alpha: 0.3
}, {
duration: 500,
yoyo: true,
repeat: -1
});
}
}
// Touch down event for inserting coins and starting game
game.down = function (x, y, obj) {
if (gameStarted) return;
// Insert coin with tap
if (coins < maxCoins) {
coins++;
updateCreditsDisplay();
// Hide INSERT COIN text when max coins reached
if (coins >= maxCoins && insertCoinText) {
insertCoinText.alpha = 0.3; // Dim it
}
}
// Start holding for PRESS START
if (coins > 0) {
isHolding = true;
holdStartTime = Date.now();
// Show ship icons when holding
if (!ship1) {
ship1 = LK.getAsset('character', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 - 100,
y: 600,
scaleX: 0.8,
scaleY: 0.8
});
game.addChild(ship1);
}
if (!ship2) {
ship2 = LK.getAsset('character', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2 + 100,
y: 600,
scaleX: 0.8,
scaleY: 0.8,
alpha: 0.3
});
game.addChild(ship2);
}
}
};
// Touch up event to stop holding
game.up = function (x, y, obj) {
if (gameStarted) return;
isHolding = false;
// Check if held long enough to start game (1 second)
if (coins > 0 && Date.now() - holdStartTime >= 1000) {
gameStarted = true;
// Hide all title screen elements
if (titleText) titleText.alpha = 0;
if (numberText) numberText.alpha = 0;
if (insertCoinText) insertCoinText.alpha = 0;
if (creditsText) creditsText.alpha = 0;
if (pressStartText) pressStartText.alpha = 0;
// Make ship2 fully visible (unfade it)
if (ship2) {
tween(ship2, {
alpha: 1
}, {
duration: 500,
easing: tween.easeOut
});
}
// Show 15 second countdown
countdownText = new Text2('15', {
size: 80,
fill: 0xFF0000 // Red color
});
countdownText.anchor.set(0.5, 0.5);
countdownText.x = 2048 / 2;
countdownText.y = 400;
game.addChild(countdownText);
// Start countdown timer
var timeLeft = 15;
var countdownTimer = LK.setInterval(function () {
timeLeft--;
if (timeLeft <= 0) {
LK.clearInterval(countdownTimer);
countdownText.setText('GO!');
LK.setTimeout(function () {
if (countdownText) countdownText.alpha = 0;
// Show player ships after countdown
showPlayerShips();
// Start gameplay sequence
startGameplaySequence();
}, 1000);
} else {
countdownText.setText(timeLeft.toString());
}
}, 1000);
// Game would start here - for now just clear screen
game.setBackgroundColor(0x000020); // Dark blue to show game started
}
};
// Function to show player ships on ready screen
function showPlayerShips() {
// Hide the hold-to-start ships
if (ship1) ship1.alpha = 0;
if (ship2) ship2.alpha = 0;
// Show ships based on number of players (using coins as player count)
var numPlayers = coins; // 1 or 2 players based on coins inserted
var shipPositions = [];
if (numPlayers === 1) {
// 2 ships for single player
shipPositions = [{
x: 2048 / 2 - 150,
y: 2732 - 400
}, {
x: 2048 / 2 + 150,
y: 2732 - 400
}];
} else {
// 4 ships for 2 players (2 for P1, 2 for P2)
shipPositions = [{
x: 2048 / 2 - 300,
y: 2732 - 400
},
// P1 ship 1
{
x: 2048 / 2 - 100,
y: 2732 - 400
},
// P1 ship 2
{
x: 2048 / 2 + 100,
y: 2732 - 400
},
// P2 ship 1
{
x: 2048 / 2 + 300,
y: 2732 - 400
} // P2 ship 2
];
}
// Create ships
for (var i = 0; i < shipPositions.length; i++) {
var ship = LK.getAsset('character', {
anchorX: 0.5,
anchorY: 0.5,
x: shipPositions[i].x,
y: shipPositions[i].y,
scaleX: 0.6,
scaleY: 0.6
});
game.addChild(ship);
}
}
// Function to start the gameplay sequence
function startGameplaySequence() {
// Show "Shoot Enemy Ships" text
var shootText = new Text2('Shoot Enemy Ships', {
size: 80,
fill: 0xFFFF00 // Yellow
});
shootText.anchor.set(0.5, 0.5);
shootText.x = 2048 / 2;
shootText.y = 2732 / 2 - 200;
game.addChild(shootText);
// After 2 seconds, show "Ready?"
LK.setTimeout(function () {
shootText.alpha = 0;
var readyText = new Text2('Ready?', {
size: 100,
fill: 0x00FF00 // Green
});
readyText.anchor.set(0.5, 0.5);
readyText.x = 2048 / 2;
readyText.y = 2732 / 2;
game.addChild(readyText);
// After 1 more second, show "Go!" and start game
LK.setTimeout(function () {
readyText.alpha = 0;
var goText = new Text2('Go!', {
size: 120,
fill: 0xFF0000 // Red
});
goText.anchor.set(0.5, 0.5);
goText.x = 2048 / 2;
goText.y = 2732 / 2;
game.addChild(goText);
// Show "Protect Cannons" with arrows at bottom
var protectText = new Text2('Protect Cannons', {
size: 60,
fill: 0xFFFFFF // White
});
protectText.anchor.set(0.5, 0.5);
protectText.x = 2048 / 2;
protectText.y = 2732 - 100;
game.addChild(protectText);
// Create left arrow
var leftArrow = new Text2('←', {
size: 80,
fill: 0xFFFFFF // White
});
leftArrow.anchor.set(0.5, 0.5);
leftArrow.x = 2048 / 2 - 300;
leftArrow.y = 2732 - 100;
game.addChild(leftArrow);
// Create right arrow
var rightArrow = new Text2('→', {
size: 80,
fill: 0xFFFFFF // White
});
rightArrow.anchor.set(0.5, 0.5);
rightArrow.x = 2048 / 2 + 300;
rightArrow.y = 2732 - 100;
game.addChild(rightArrow);
// Fade out "Go!" after a moment
LK.setTimeout(function () {
goText.alpha = 0;
// Gameplay starts here
}, 1000);
}, 1000);
}, 2000);
} ===================================================================
--- original.js
+++ change.js
@@ -181,13 +181,138 @@
LK.clearInterval(countdownTimer);
countdownText.setText('GO!');
LK.setTimeout(function () {
if (countdownText) countdownText.alpha = 0;
+ // Show player ships after countdown
+ showPlayerShips();
+ // Start gameplay sequence
+ startGameplaySequence();
}, 1000);
} else {
countdownText.setText(timeLeft.toString());
}
}, 1000);
// Game would start here - for now just clear screen
game.setBackgroundColor(0x000020); // Dark blue to show game started
}
-};
\ No newline at end of file
+};
+// Function to show player ships on ready screen
+function showPlayerShips() {
+ // Hide the hold-to-start ships
+ if (ship1) ship1.alpha = 0;
+ if (ship2) ship2.alpha = 0;
+ // Show ships based on number of players (using coins as player count)
+ var numPlayers = coins; // 1 or 2 players based on coins inserted
+ var shipPositions = [];
+ if (numPlayers === 1) {
+ // 2 ships for single player
+ shipPositions = [{
+ x: 2048 / 2 - 150,
+ y: 2732 - 400
+ }, {
+ x: 2048 / 2 + 150,
+ y: 2732 - 400
+ }];
+ } else {
+ // 4 ships for 2 players (2 for P1, 2 for P2)
+ shipPositions = [{
+ x: 2048 / 2 - 300,
+ y: 2732 - 400
+ },
+ // P1 ship 1
+ {
+ x: 2048 / 2 - 100,
+ y: 2732 - 400
+ },
+ // P1 ship 2
+ {
+ x: 2048 / 2 + 100,
+ y: 2732 - 400
+ },
+ // P2 ship 1
+ {
+ x: 2048 / 2 + 300,
+ y: 2732 - 400
+ } // P2 ship 2
+ ];
+ }
+ // Create ships
+ for (var i = 0; i < shipPositions.length; i++) {
+ var ship = LK.getAsset('character', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: shipPositions[i].x,
+ y: shipPositions[i].y,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ game.addChild(ship);
+ }
+}
+// Function to start the gameplay sequence
+function startGameplaySequence() {
+ // Show "Shoot Enemy Ships" text
+ var shootText = new Text2('Shoot Enemy Ships', {
+ size: 80,
+ fill: 0xFFFF00 // Yellow
+ });
+ shootText.anchor.set(0.5, 0.5);
+ shootText.x = 2048 / 2;
+ shootText.y = 2732 / 2 - 200;
+ game.addChild(shootText);
+ // After 2 seconds, show "Ready?"
+ LK.setTimeout(function () {
+ shootText.alpha = 0;
+ var readyText = new Text2('Ready?', {
+ size: 100,
+ fill: 0x00FF00 // Green
+ });
+ readyText.anchor.set(0.5, 0.5);
+ readyText.x = 2048 / 2;
+ readyText.y = 2732 / 2;
+ game.addChild(readyText);
+ // After 1 more second, show "Go!" and start game
+ LK.setTimeout(function () {
+ readyText.alpha = 0;
+ var goText = new Text2('Go!', {
+ size: 120,
+ fill: 0xFF0000 // Red
+ });
+ goText.anchor.set(0.5, 0.5);
+ goText.x = 2048 / 2;
+ goText.y = 2732 / 2;
+ game.addChild(goText);
+ // Show "Protect Cannons" with arrows at bottom
+ var protectText = new Text2('Protect Cannons', {
+ size: 60,
+ fill: 0xFFFFFF // White
+ });
+ protectText.anchor.set(0.5, 0.5);
+ protectText.x = 2048 / 2;
+ protectText.y = 2732 - 100;
+ game.addChild(protectText);
+ // Create left arrow
+ var leftArrow = new Text2('←', {
+ size: 80,
+ fill: 0xFFFFFF // White
+ });
+ leftArrow.anchor.set(0.5, 0.5);
+ leftArrow.x = 2048 / 2 - 300;
+ leftArrow.y = 2732 - 100;
+ game.addChild(leftArrow);
+ // Create right arrow
+ var rightArrow = new Text2('→', {
+ size: 80,
+ fill: 0xFFFFFF // White
+ });
+ rightArrow.anchor.set(0.5, 0.5);
+ rightArrow.x = 2048 / 2 + 300;
+ rightArrow.y = 2732 - 100;
+ game.addChild(rightArrow);
+ // Fade out "Go!" after a moment
+ LK.setTimeout(function () {
+ goText.alpha = 0;
+ // Gameplay starts here
+ }, 1000);
+ }, 1000);
+ }, 2000);
+}
\ No newline at end of file