User prompt
every ten points orange balls descend at high speed and speed increases every twenty points
User prompt
The small dots appear only after ten points have been added
User prompt
every ten points add that small orange balls appear descending at high speed and which increase in speed every ten points
User prompt
every ten points a very small surprise orange ball drops at high speed
User prompt
every ten points they decrease and increase the diversified format
User prompt
make the balls descend at high speed every ten points
User prompt
make the balls descend at high speed every twenty points
User prompt
remove numbers and letters that come down
User prompt
every five points leave the sides of the game letters and numbers neon green coloring
User prompt
make a black square just by clicking
User prompt
each swipe leaves a black square
User prompt
shots in the shape of a small black square to hit the balls
User prompt
when clicking on the pink square a small black square comes out per click
User prompt
when you click on the pink square it triggers a black triangle, with each click a triangle comes out
User prompt
place shots that come out of the pink square each time you click on it, a triangle comes out that rotates and when you hit the green balls the balls disappear.
User prompt
Please fix the bug: 'TypeError: self.shoot is not a function' in or related to this line: 'self.shoot();' Line Number: 38
User prompt
remove shots from pink square
User prompt
remove trigger
User prompt
fire a triangle just by clicking on the pink square
User prompt
shoot just one rectangle rotating with each squeeze
User prompt
shots come out of pink square in black color medium sized rectangle shape
User prompt
black squares shooting small size
User prompt
in this he shoots very small black squares when sliding to the sides
User prompt
pink square you can slide sideways by dragging your finger over it on touch
User prompt
If the green balls fall or hit the pink square, it's game over
/****
* Classes
****/
// EnemyBullet class
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('enemyBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
// Assets will be automatically generated based on usage in the code.
// Hero class
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
heroGraphics.tint = 0xFF69B4;
self.move = function (x, y) {
self.x = x;
self.y = y;
};
self.shoot = function () {
var newRay = new HeroRay();
newRay.x = self.x;
newRay.y = self.y;
heroRays.push(newRay);
game.addChild(newRay);
};
});
// HeroRay class
var HeroRay = Container.expand(function () {
var self = Container.call(this);
var rayGraphics = self.attachAsset('heroRay', {
anchorX: 0.5,
anchorY: 0.5,
tint: 0xFF0000,
scaleX: 0.2,
scaleY: 0.2
});
self.speed = -5;
self.move = function () {
self.y += self.speed;
};
});
// NeonGreenBall class
var NeonGreenBall = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('neonGreenBall', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x006400 // Init game with dark green background
});
/****
* Game Code
****/
// Global variables
var hero = new Hero();
hero.x = 1024; // Center horizontally
hero.y = 2500; // Near the bottom
// Add hero to the game
game.addChild(hero);
// Create a new Text2 object for the score display with white color and blue border
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff",
stroke: "#0000ff",
strokeThickness: 5
});
scoreTxt.anchor.set(1, 0); // Sets anchor to the top right of the text.
LK.gui.topRight.addChild(scoreTxt); // Add the score text to the top right of the GUI overlay.
// Touch event to move hero and destroy neon green balls
game.on('down', function (obj) {
var pos = obj.event.getLocalPosition(game);
hero.move(pos.x, hero.y);
hero.shoot();
for (var i = neonGreenBalls.length - 1; i >= 0; i--) {
if (hero.intersects(neonGreenBalls[i])) {
neonGreenBalls[i].destroy();
neonGreenBalls.splice(i, 1);
}
}
});
// Global variables
var neonGreenBalls = [];
var heroRays = [];
// Game tick event
LK.on('tick', function () {
// Move neon green balls and hero rays
for (var i = neonGreenBalls.length - 1; i >= 0; i--) {
neonGreenBalls[i].move();
if (neonGreenBalls[i].y > 2732 || hero.intersects(neonGreenBalls[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
for (var i = heroRays.length - 1; i >= 0; i--) {
heroRays[i].move();
if (heroRays[i].y < 0) {
heroRays[i].destroy();
heroRays.splice(i, 1);
}
for (var j = neonGreenBalls.length - 1; j >= 0; j--) {
if (heroRays[i] && heroRays[i].intersects(neonGreenBalls[j])) {
neonGreenBalls[j].destroy();
neonGreenBalls.splice(j, 1);
heroRays[i].destroy();
heroRays.splice(i, 1);
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
}
}
}
// Spawn neon green balls
if (LK.ticks % 60 == 0) {
var newBall = new NeonGreenBall();
newBall.x = Math.random() * 2048;
newBall.y = 0;
neonGreenBalls.push(newBall);
game.addChild(newBall);
}
});