User prompt
When level reaches 4 increase alien number to 2
User prompt
change respawn code so Aliens spawn from middle of grid
User prompt
Spawn Aliens form middle of grid
User prompt
modify Alien code so that they can move around tiles in any direction
User prompt
Correct Alien code so that Alien moves from spawn point on row 7 left across tiles to the right using up and down
User prompt
Fix Bug: 'Timeout.tick error: spawnBBall is not defined' in or related to this line: 'spawnBBall();' Line Number: 771
User prompt
Fix Bug: 'Timeout.tick error: maxAliens is not defined' in or related to this line: 'if (alienCount < maxAliens) {' Line Number: 709
User prompt
Add Alien to game as per ball code
User prompt
for alien change code so that the alien travels bounces across screen on tiles from left to right
Code edit (2 edits merged)
Please save this source code
User prompt
Add a new class called alien. This will be based upon the BBall class. do not remove or replace BBall class!
User prompt
Fix Bug: 'bball.move is not a function' in or related to this line: 'bball.move();' Line Number: 627
User prompt
Fix Bug: 'bball.move is not a function' in or related to this line: 'bball.move();' Line Number: 627
User prompt
Fix Bug: 'ReferenceError: BBall is not defined' in or related to this line: 'return child instanceof BBall;' Line Number: 636
User prompt
duplicate BBall code and interactions and name duplicate Alien. Alien will travel from left to right acroos grid jumping up and down on the tiles
User prompt
Fix Bug: 'bball.move is not a function' in or related to this line: 'bball.move();' Line Number: 633
User prompt
Fix Bug: 'ReferenceError: BBall is not defined' in or related to this line: 'return child instanceof BBall;' Line Number: 642
User prompt
Fix Bug: 'ReferenceError: BBall is not defined' in or related to this line: 'return child instanceof BBall;' Line Number: 642
User prompt
copy BBall code and interactions and create Alien. Alien will travel from left to right acroos grid in the up and down direction
User prompt
when zebert is respawned cancel all move commands for 1 second
Code edit (1 edits merged)
Please save this source code
User prompt
in BBall when travel time reachs 175 then do not reduce any further. On next level change increase number of balls allowed by 1 and add 100. repeat this process until number of balls allowed equals 6
Code edit (1 edits merged)
Please save this source code
User prompt
remove particle effect
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -48,8 +48,80 @@
buttonGraphics.tint = 0xFFFFFF; // Remove tint
self.isPressed = false;
});
});
+var BBall = Container.expand(function (gridX, gridY, width, height) {
+ var self = Container.call(this);
+ self.isBBallJumping = false;
+ self.move = function () {
+ if (self.isBBallJumping || !self.parent) {
+ return;
+ }
+ self.isBBallJumping = true;
+ var tileWidth = 250;
+ var tileHeight = 270;
+ var arcHeight = 150;
+ var direction = Math.random() < 0.5 ? 'downLeft' : 'downRight';
+ var targetX = self.x + (direction === 'downLeft' ? -tileWidth / 2 : tileWidth / 2);
+ var targetY = self.y + tileHeight - 90;
+ var startX = self.x;
+ var startY = self.y;
+ var distanceX = targetX - startX;
+ var distanceY = targetY - startY;
+ var startTime = Date.now();
+ var travelTime = Math.max(175, 500 - 25 * levelManager.completedLevels) + bballTravelTimeAddition;
+ var bballTickHandler = function bballTickHandler() {
+ var currentTime = Date.now();
+ var timeElapsed = currentTime - startTime;
+ if (timeElapsed < travelTime) {
+ var progress = timeElapsed / travelTime;
+ var arcProgress = Math.sin(progress * Math.PI);
+ self.x = startX + distanceX * progress;
+ self.y = startY + distanceY * progress - arcHeight * arcProgress;
+ // Adjust shadow size based on jump arc progress
+ self.shadowGraphics.width = width * 0.8 * (1 - arcProgress * 0.3);
+ self.shadowGraphics.height = height * 0.4 * (1 - arcProgress * 0.3);
+ } else {
+ self.x = targetX;
+ self.y = targetY;
+ LK.off('tick', bballTickHandler);
+ self.isBBallJumping = false;
+ // Reset shadow size when BBall lands
+ self.shadowGraphics.width = width * 0.8;
+ self.shadowGraphics.height = height * 0.4;
+ var tileBelow = game.grid.getTileAt(self.x, self.y + tileHeight / 2);
+ if (!tileBelow) {
+ if (self.parent) {
+ self.parent.removeChild(self);
+ }
+ // Spawn a new BBall at the top
+ var newBBall = new BBall(game.grid.tileArray[0][0].x, game.grid.tileArray[0][0].y - 150, 180, 180);
+ game.grid.addChild(newBBall);
+ // Trigger the move of the new BBall
+ newBBall.move();
+ }
+ }
+ };
+ LK.on('tick', bballTickHandler);
+ LK.setTimeout(self.move, travelTime + 50);
+ };
+ self.shadowGraphics = self.attachAsset('zbertShadow', {
+ anchorX: 0.5,
+ anchorY: 1.0,
+ alpha: 0.4
+ });
+ self.shadowGraphics.width = width * 0.8;
+ self.shadowGraphics.height = height * 0.4;
+ self.shadowGraphics.y = height * 0.5 + 50;
+ var BBallGraphics = self.attachAsset('bouncingBall', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ BBallGraphics.width = width;
+ BBallGraphics.height = height;
+ self.x = gridX;
+ self.y = gridY;
+});
var Alien = Container.expand(function (gridX, gridY, width, height) {
var self = Container.call(this);
self.isAlienJumping = false;
self.move = function () {
@@ -59,17 +131,17 @@
self.isAlienJumping = true;
var tileWidth = 250;
var tileHeight = 270;
var arcHeight = 150;
- var direction = self.x < game.width / 2 ? 'upRight' : 'upLeft';
- var targetX = self.x + (direction === 'upLeft' ? -tileWidth : tileWidth);
- var targetY = self.y + (direction === 'upLeft' ? -tileHeight / 2 : tileHeight / 2);
+ var direction = Math.random() < 0.5 ? 'downLeft' : 'downRight';
+ var targetX = self.x + (direction === 'downLeft' ? -tileWidth / 2 : tileWidth / 2);
+ var targetY = self.y + tileHeight - 90;
var startX = self.x;
var startY = self.y;
var distanceX = targetX - startX;
var distanceY = targetY - startY;
var startTime = Date.now();
- var travelTime = 1000;
+ var travelTime = Math.max(175, 500 - 25 * levelManager.completedLevels) + bballTravelTimeAddition;
var alienTickHandler = function alienTickHandler() {
var currentTime = Date.now();
var timeElapsed = currentTime - startTime;
if (timeElapsed < travelTime) {
@@ -87,11 +159,18 @@
self.isAlienJumping = false;
// Reset shadow size when Alien lands
self.shadowGraphics.width = width * 0.8;
self.shadowGraphics.height = height * 0.4;
- // Check if Alien is at the edge of the grid and needs to turn around
- if (self.x <= 0 || self.x >= game.width) {
- self.x = Math.max(0, Math.min(self.x, game.width));
+ var tileBelow = game.grid.getTileAt(self.x, self.y + tileHeight / 2);
+ if (!tileBelow) {
+ if (self.parent) {
+ self.parent.removeChild(self);
+ }
+ // Spawn a new Alien at the top
+ var newAlien = new Alien(game.grid.tileArray[0][0].x, game.grid.tileArray[0][0].y - 150, 180, 180);
+ game.grid.addChild(newAlien);
+ // Trigger the move of the new Alien
+ newAlien.move();
}
}
};
LK.on('tick', alienTickHandler);
@@ -470,27 +549,8 @@
});
starGraphics.scale.set(scale);
starGraphics.rotation = rotation;
});
-var BBall = Container.expand(function (gridX, gridY, width, height) {
- var self = Container.call(this);
- // Define the movement behavior for BBall here
- self.move = function (direction) {
- // Actual movement logic based on direction
- switch (direction) {
- case 'downLeft':
- self.x -= 5; // Move BBall 5 pixels to the left
- self.y += 5; // Move BBall 5 pixels down
- break;
- case 'downRight':
- self.x += 5; // Move BBall 5 pixels to the right
- self.y += 5; // Move BBall 5 pixels down
- break;
- }
- };
- self.x = gridX;
- self.y = gridY;
-});
/****
* Initialize Game
****/
beautiful landscape. starry sky, pastel colours, high definition, alien world. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful expansive landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful expansive landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A little cube person. 2 legs. back to viewer. facing 45 degrees to the right. multicoloured skin, cartoon style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white circle. metallic. light bevel on edge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Round furry, cute alien ball with big eyes. vivid colours, looking at 45 degrees to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bright 3d present with bow, vivd colours. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Change to be vivid multicoloured cube
A simple Triangle, flat shaded, bevelled edges. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Speech bubble with expletive word in it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
parachute. multicoloured. cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white circle with a single thin black border. flat shade. simple graphic. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
small star shape, vivid metallic blue, varying length spikes on star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.