User prompt
add fall banana object
User prompt
Fix Bug: 'TypeError: blueBananas[i].fall is not a function' in this line: 'blueBananas[i].fall();' Line Number: 176
User prompt
normal banana should not fall only the blue banana
User prompt
blueBanana fall from sky
User prompt
it needs to be the blue bananas fall
User prompt
blue bananas must fall from sky
User prompt
blue bananas should fall from the sky not bananas
User prompt
move bananas up a little
User prompt
move bananas more left
User prompt
make monkey move speed for left and right even
User prompt
more left
User prompt
move banana to the left
User prompt
one banana on each platform
User prompt
the blue bananas fall and the normal banana is on the platforms
User prompt
I do not see the bananas
User prompt
bananas should be on all platforms
User prompt
but bananas on platforms
User prompt
make less blue bananas fall and make them more apart and fall faster
User prompt
Fix Bug: 'ReferenceError: bananas is not defined' in this line: 'for (var i = 0; i < bananas.length; i++) {' Line Number: 157
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of null (reading 'addChild')' in this line: 'self.parent.addChild(banana);' Line Number: 57
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of null (reading 'bananas')' in this line: 'self.parent.bananas.push(banana);' Line Number: 57
User prompt
Fix Bug: 'Uncaught ReferenceError: Banana is not defined' in this line: 'var banana = new Banana();' Line Number: 54
User prompt
make blue bananas that fall from the sky
User prompt
Fix Bug: 'Uncaught ReferenceError: bananas is not defined' in this line: 'bananas.push(banana);' Line Number: 50
User prompt
bananas are to centered on the platforms
var Floor = Container.expand(function () { var self = Container.call(this); var floorGraphics = self.createAsset('floor', 'Floor platform', 0, 1); floorGraphics.width = 2048; self.spawn = function (x, y) { this.x = x; this.y = y; }; }); var Monkey = Container.expand(function () { var self = Container.call(this); var monkeyGraphics = self.createAsset('monkey', 'Monkey character', .5, .5); monkeyGraphics.scale.x *= 1; self.jumpCount = 0; self.jumpHeight = 100; self.gravity = 5; self.velocityY = 0; self.move = function (direction) { if (direction === 'left') { this.x -= 20; monkeyGraphics.scale.x = 1; } else if (direction === 'right') { this.x += 20; monkeyGraphics.scale.x = -1; } }; self.jump = function () { if (this.jumpCount < 2) { this.velocityY = -this.jumpHeight; this.jumpCount++; this.onPlatform = false; } }; self.collectBanana = function () {}; }); var BlueBanana = Container.expand(function () { var self = Container.call(this); var bananaGraphics = self.createAsset('banana', 'Banana collectible', .5, .5); self.spawn = function () { this.x = Math.random() * 2048; this.y = 0; this.velocityY = 2; }; self.fall = function () { this.y += this.velocityY; if (this.y > 2732) { this.destroy(); } }; }); var Platform = Container.expand(function () { var self = Container.call(this); var platformGraphics = self.createAsset('platform', 'Platform for monkey to jump on', .5, .5); self.spawn = function (x, y) { this.x = Math.random() * 2048; this.y = y; }; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('background', 'Game background', 0, 0); background.width = 2048; background.height = 2732; var monkey = self.addChild(new Monkey()); self.bananas = []; var platforms = []; var floor = self.addChild(new Floor()); floor.spawn(0, 2732 - floor.height + 100); var leftButton = self.createAsset('leftButton', 'Left control button', 0, 1); var rightButton = self.createAsset('rightButton', 'Right control button', 1, 1); leftButton.x = 100; leftButton.y = 2732 - leftButton.height - 100; rightButton.x = 2048 - rightButton.width - 100; rightButton.y = 2732 - rightButton.height - 100; var leftJumpButton = self.createAsset('jumpButton', 'Jump control button', 0, 1); leftJumpButton.x = leftButton.x; leftJumpButton.y = leftButton.y + leftButton.height + 50; leftJumpButton.on('down', function () { monkey.jump(); }); var rightJumpButton = self.createAsset('jumpButton', 'Jump control button', 1, 1); rightJumpButton.x = rightButton.x; rightJumpButton.y = rightButton.y + rightButton.height + 50; rightJumpButton.on('down', function () { monkey.jump(); }); for (var i = 0; i < 5; i++) { var platform = new Platform(); if (i !== 0) { platform.spawn(i * 500, 2732 - i * 200 - rightButton.height - 100); } platforms.push(platform); self.addChild(platform); var banana = self.createAsset('banana', 'Banana collectible', .5, .5); banana.x = platform.x + platform.width / 2 - 100; banana.y = platform.y - banana.height / 2 - 50; self.addChild(banana); } var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); var blueBananas = []; var timer = LK.setInterval(function () { if (LK.ticks % 200 === 0) { var blueBanana = new BlueBanana(); blueBanana.spawn(); blueBananas.push(blueBanana); self.addChild(blueBanana); } }); monkey.x = 500; monkey.y = 2732 - monkey.height - 200; var leftClickCount = 0; leftButton.on('down', function () { this.moveLeft = true; this.y -= 10; }); leftButton.on('up', function () { this.moveLeft = false; this.y += 10; monkey.move('left'); }); leftButton.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (pos.y < this.y) {} }); rightButton.on('down', function () { this.moveRight = true; this.y -= 10; }); rightButton.on('up', function () { this.moveRight = false; this.y += 10; monkey.move('right'); }); rightButton.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); if (pos.y < this.y) {} }); LK.on('tick', function () { if (leftButton.moveLeft) { monkey.move('left'); } if (rightButton.moveRight) { monkey.move('right'); } if (!monkey.onPlatform) { monkey.velocityY += monkey.gravity; } monkey.y += monkey.velocityY; if (monkey.y > 2732 - monkey.height) { monkey.y = 2732 - monkey.height; monkey.velocityY = 0; monkey.jumpCount = 0; } for (var i = 0; i < blueBananas.length; i++) { if (monkey.intersects(blueBananas[i])) { monkey.collectBanana(); blueBananas[i].destroy(); blueBananas.splice(i, 1); } } for (var i = 0; i < platforms.length; i++) { if (monkey.velocityY > 0 && monkey.y + monkey.height <= platforms[i].y && monkey.y + monkey.height + monkey.velocityY >= platforms[i].y && monkey.x + monkey.width > platforms[i].x && monkey.x < platforms[i].x + platforms[i].width) { monkey.y = platforms[i].y - monkey.height; monkey.velocityY = 0; monkey.jumpCount = 0; monkey.onPlatform = true; if (monkey.x + monkey.width > platforms[i].x + platforms[i].width) { monkey.x = platforms[i].x + platforms[i].width - monkey.width; } if (monkey.x < platforms[i].x) { monkey.x = platforms[i].x; } } } for (var i = 0; i < blueBananas.length; i++) { blueBananas[i].fall(); if (blueBananas[i].y > 2732) { blueBananas[i].destroy(); blueBananas.splice(i, 1); } } if (monkey.y < platforms[platforms.length - 1].y - 200) { var platform = new Platform(); platform.spawn(platforms[platforms.length - 1].x, platforms[platforms.length - 1].y - 200); platforms.push(platform); self.addChild(platform); } }); });
===================================================================
--- original.js
+++ change.js
@@ -42,8 +42,11 @@
this.velocityY = 2;
};
self.fall = function () {
this.y += this.velocityY;
+ if (this.y > 2732) {
+ this.destroy();
+ }
};
});
var Platform = Container.expand(function () {
var self = Container.call(this);
Yellow circle button unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
green circle button unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d single log laying long ways on side with vines seen from side unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
2d jungle canopy background side scroller unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows No ground
Monkey full body animation unreal engine seen from the side very cute In-Game asset. 3d. Blank background. High contrast. No shadows
jungle floor dirt 2d unreal engine seen from the side In-Game asset. 3d. Blank background. High contrast. No shadows
yellow banana unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
blue banana unreal engine 5 Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.