User prompt
Make a hearts system ware you have 3 hears and if you hit a bomb your hears go down by one
User prompt
Make it so balls can't overlap
User prompt
Make it when you click the rainbowball it plays pop sound
User prompt
Make it when you hit a screw of 30 bombs spawn every 5 seconds
User prompt
Add a rainbow ball that appears every 30 seconds that increases your score by 5
User prompt
Make the bombs appear twice as much when you hit a score of 30
User prompt
Make balls faster the higher your score
User prompt
Make bombs faster the higher your score
User prompt
Make the background red
User prompt
Make bomb sound play when bomb Is pressed
User prompt
Make it so the balls do not spawn within 2cm of the edge
User prompt
Make it when you click a bomb it plays Bomb sounds
User prompt
Make it so when you click a bomb it plays bomb sound
User prompt
Make it so when you click the ball it plays the pop sound
User prompt
Make balls spawn every seconds
Initial prompt
Pop
/****
* Classes
****/
//<Write imports for supported plugins here>
//<Write entity 'classes' with empty functions for important behavior here>
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5 + Math.floor(LK.getScore() / 10);
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.getSound('Pop').play();
self.destroy();
};
});
var Bomb = Container.expand(function () {
var self = Container.call(this);
var bombGraphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5 + Math.floor(LK.getScore() / 10);
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
self.down = function (x, y, obj) {
LK.getSound('Bomb').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
};
});
var RainbowBall = Container.expand(function () {
var self = Container.call(this);
var rainbowBallGraphics = self.attachAsset('rainbowBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
self.down = function (x, y, obj) {
LK.setScore(LK.getScore() + 5);
scoreTxt.setText(LK.getScore());
self.destroy();
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xff0000 //Init game with red background
});
/****
* Game Code
****/
//<Assets used in the game will automatically appear here>
//<Write game logic code here, including initializing arrays and variables>
var scoreTxt = new Text2('0', {
size: 150,
fill: 0x000000
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var balls = [];
var bombs = [];
function spawnBall() {
var newBall = new Ball();
newBall.x = 200 + Math.random() * (2048 - 400); // 200px = 2cm on a 12.9" iPad Pro
newBall.y = 0;
balls.push(newBall);
game.addChild(newBall);
}
function spawnBomb() {
var newBomb = new Bomb();
newBomb.x = Math.random() * 2048;
newBomb.y = 0;
bombs.push(newBomb);
game.addChild(newBomb);
}
function spawnRainbowBall() {
var newRainbowBall = new RainbowBall();
newRainbowBall.x = Math.random() * 2048;
newRainbowBall.y = 0;
game.addChild(newRainbowBall);
}
LK.setInterval(spawnBall, 1000);
var bombInterval = LK.setInterval(spawnBomb, 10000);
var rainbowBallInterval = LK.setInterval(spawnRainbowBall, 30000);
game.update = function () {
if (LK.getScore() >= 30) {
LK.clearInterval(bombInterval);
bombInterval = LK.setInterval(spawnBomb, 5000);
}
for (var i = balls.length - 1; i >= 0; i--) {
balls[i].update();
if (balls[i].y > 2732) {
balls[i].destroy();
balls.splice(i, 1);
}
}
for (var j = bombs.length - 1; j >= 0; j--) {
bombs[j].update();
if (bombs[j].y > 2732) {
bombs[j].destroy();
bombs.splice(j, 1);
}
}
};
game.update = function () {
for (var i = balls.length - 1; i >= 0; i--) {
balls[i].update();
if (balls[i].y > 2732) {
balls[i].destroy();
balls.splice(i, 1);
}
}
for (var j = bombs.length - 1; j >= 0; j--) {
bombs[j].update();
if (bombs[j].y > 2732) {
bombs[j].destroy();
bombs.splice(j, 1);
}
}
for (var k = game.children.length - 1; k >= 0; k--) {
if (game.children[k] instanceof RainbowBall) {
game.children[k].update();
if (game.children[k].y > 2732) {
game.children[k].destroy();
}
}
}
};
game.down = function (x, y, obj) {
// Handle global down events if needed
};
game.up = function (x, y, obj) {
// Handle global up events if needed
}; ===================================================================
--- original.js
+++ change.js
@@ -41,8 +41,27 @@
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
};
});
+var RainbowBall = Container.expand(function () {
+ var self = Container.call(this);
+ var rainbowBallGraphics = self.attachAsset('rainbowBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
+ self.down = function (x, y, obj) {
+ LK.setScore(LK.getScore() + 5);
+ scoreTxt.setText(LK.getScore());
+ self.destroy();
+ };
+});
/****
* Initialize Game
****/
@@ -76,10 +95,17 @@
newBomb.y = 0;
bombs.push(newBomb);
game.addChild(newBomb);
}
+function spawnRainbowBall() {
+ var newRainbowBall = new RainbowBall();
+ newRainbowBall.x = Math.random() * 2048;
+ newRainbowBall.y = 0;
+ game.addChild(newRainbowBall);
+}
LK.setInterval(spawnBall, 1000);
var bombInterval = LK.setInterval(spawnBomb, 10000);
+var rainbowBallInterval = LK.setInterval(spawnRainbowBall, 30000);
game.update = function () {
if (LK.getScore() >= 30) {
LK.clearInterval(bombInterval);
bombInterval = LK.setInterval(spawnBomb, 5000);
@@ -113,8 +139,16 @@
bombs[j].destroy();
bombs.splice(j, 1);
}
}
+ for (var k = game.children.length - 1; k >= 0; k--) {
+ if (game.children[k] instanceof RainbowBall) {
+ game.children[k].update();
+ if (game.children[k].y > 2732) {
+ game.children[k].destroy();
+ }
+ }
+ }
};
game.down = function (x, y, obj) {
// Handle global down events if needed
};
Red minecraft heart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Black background with word start in middle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Rainbow ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cool scenic view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadowcs.
Ball for pop game plain green. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bomb for pop game. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Upgrade sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.