User prompt
platforms and bananas are cover buttons this should not happen
User prompt
Fix Bug: 'Uncaught ReferenceError: leftButton is not defined' in this line: 'leftButton.on('down', function () {' Line Number: 97
User prompt
Fix Bug: 'Uncaught ReferenceError: rightButton is not defined' in this line: 'platform.spawn(i * 500, 2732 - i * 200 - rightButton.height - 100);' Line Number: 79
User prompt
the buttons should be the top layer
User prompt
remove score
User prompt
each banana increases score by 1
User prompt
score is not moving up
User prompt
each banana must only be one point
User prompt
the score needs to count each banaan
User prompt
move score to top center
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'self.scoreTxt.y = self.countdownClock.y + self.countdownClock.height + 50;' Line Number: 118
User prompt
remove clock
User prompt
NaN error for score when collecting banana
User prompt
the score needs to count up as more bananes collected
User prompt
I am gitting error NaN for score
User prompt
the score should show the number increase as bananes are collected
User prompt
move the score to the left under the timer
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in this line: 'self.scoreTxt.y = self.countdownClock.y + self.countdownClock.height + 50;' Line Number: 116
User prompt
move it directly below the timer
User prompt
move the score blow the timer
User prompt
make sure score is on top of backgrund
User prompt
I can't see the score
User prompt
each banana increase the score by one
User prompt
score count is not visible
User prompt
the score counter should be under the time and start at zero
var Cube = Container.expand(function () {
var self = Container.call(this);
var cubeGraphics = self.createAsset('cube', 'Cube object', .5, .5);
self.spawn = function (x, y) {
this.x = x;
this.y = y + 100;
};
});
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 *= 0.8;
monkeyGraphics.scale.y *= 0.8;
self.jumpCount = 0;
self.jumpHeight = 100;
self.gravity = 5;
self.velocityY = null;
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 (banana) {
banana.destroy();
self.parent.scoreTxt.setText(parseInt(self.parent.scoreTxt.text) + 1);
self.parent.scoreTxt.x = 2048 / 2 - self.parent.scoreTxt.width / 2;
};
});
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 = -this.height;
this.velocityY = 2;
};
});
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());
var cube = self.addChild(new Cube());
cube.spawn(500, 2732 - cube.height - 100);
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 = new BlueBanana();
banana.spawn();
banana.x = platform.x + platform.width / 2 - 100;
banana.y = platform.y - banana.height / 2 - 100;
self.bananas.push(banana);
self.addChild(banana);
}
self.scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
self.scoreTxt.anchor.set(.5, 0);
self.scoreTxt.x = 2048 / 2;
self.scoreTxt.y = LK.gui.topCenter.height + 50;
LK.gui.topCenter.addChild(self.scoreTxt);
self.countdownClock = new Text2('180', {
size: 150,
fill: "#000000"
});
LK.gui.topLeft.addChild(self.countdownClock);
self.countdownTimer = LK.setInterval(function () {
var currentTime = parseInt(self.countdownClock.text);
if (currentTime > 0) {
self.countdownClock.setText(currentTime - 1);
} else {
if (self.countdownClock && self.countdownClock.style) {
self.countdownClock.style.fill = '#ff0000';
}
LK.clearInterval(self.countdownTimer);
}
}, 1000);
var startPlatform = new Platform();
startPlatform.spawn(500, 2732 - monkey.height - 200);
platforms.push(startPlatform);
self.addChild(startPlatform);
monkey.x = cube.x;
monkey.y = cube.y - monkey.height + 100;
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');
}
monkey.velocityY += monkey.gravity;
if (!(monkey.y + monkey.height > floor.y && monkey.y + monkey.height + monkey.velocityY < floor.y + floor.height) && !(monkey.y + monkey.height > cube.y && monkey.y + monkey.height + monkey.velocityY < cube.y + cube.height)) {
monkey.y += monkey.velocityY;
} else if (monkey.y + monkey.height > cube.y && monkey.y + monkey.height + monkey.velocityY < cube.y + cube.height) {
monkey.y = cube.y - monkey.height;
monkey.velocityY = 0;
monkey.jumpCount = 0;
}
for (var i = 0; i < platforms.length; i++) {
if (monkey.y + monkey.height >= platforms[i].y && monkey.y < platforms[i].y + platforms[i].height && 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;
}
}
for (var i = 0; i < self.bananas.length; i++) {
if (monkey.intersects(self.bananas[i])) {
monkey.collectBanana(self.bananas[i]);
self.bananas.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 j = 0; j < self.bananas.length; j++) {
if (monkey.intersects(self.bananas[j])) {
monkey.collectBanana(self.bananas[j]);
self.bananas.splice(j, 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);
var banana = new BlueBanana();
banana.spawn();
banana.x = platform.x + platform.width / 2 - 100;
banana.y = platform.y - banana.height / 2 - 100;
self.bananas.push(banana);
self.addChild(banana);
}
if (monkey.y < 2732 / 2 && monkey.velocityY < 0 && monkey.jumpCount > 0) {
for (var i = 0; i < platforms.length; i++) {
platforms[i].y += Math.abs(monkey.velocityY);
}
for (var i = 0; i < self.bananas.length; i++) {
self.bananas[i].y += Math.abs(monkey.velocityY);
}
cube.y += Math.abs(monkey.velocityY);
monkey.y += Math.abs(monkey.velocityY);
floor.y += Math.abs(monkey.velocityY);
}
for (var i = platforms.length - 1; i >= 0; i--) {
if (platforms[i].y > 2732) {
platforms[i].destroy();
platforms.splice(i, 1);
}
}
if (monkey.y > 2732) {
LK.showGameOver();
}
for (var i = self.bananas.length - 1; i >= 0; i--) {
if (self.bananas[i].y > 2732) {
self.bananas[i].destroy();
self.bananas.splice(i, 1);
}
}
});
});
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.