/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var facekit = LK.import("@upit/facekit.v1"); /**** * Classes ****/ var Carrot = Container.expand(function () { var self = Container.call(this); var carrotGraphics = self.attachAsset('carrot', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -8; self.collected = false; self.update = function () { self.x += self.speed * gameSpeed; self.rotation += 0.1; }; return self; }); var Ground = Container.expand(function () { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0, anchorY: 0 }); self.speed = -8; self.update = function () { self.x += self.speed * gameSpeed; }; return self; }); var Hole = Container.expand(function () { var self = Container.call(this); var holeGraphics = self.attachAsset('hole', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.passed = false; self.update = function () { self.x += self.speed * gameSpeed; }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.passed = false; self.update = function () { self.x += self.speed * gameSpeed; }; return self; }); var Rabbit = Container.expand(function () { var self = Container.call(this); var rabbitGraphics = self.attachAsset('rabbit', { anchorX: 0.5, anchorY: 1.0 }); self.velocityY = 0; self.isJumping = false; self.isOnGround = true; self.jumpPower = -35; // Increased jump power for long jump self.gravity = 0.8; // Reduced gravity for longer air time self.groundY = 0; self.jump = function () { if (self.isOnGround) { self.velocityY = self.jumpPower; self.isJumping = true; self.isOnGround = false; LK.getSound('jump').play(); // Add visual feedback for long jump LK.effects.flashObject(self, 0xffff00, 300); // Yellow flash for jump } }; self.update = function () { if (!self.isOnGround) { self.velocityY += self.gravity; self.y += self.velocityY; if (self.y >= self.groundY) { self.y = self.groundY; self.velocityY = 0; self.isJumping = false; self.isOnGround = true; } } }; return self; }); var Spike = Container.expand(function () { var self = Container.call(this); var spikeGraphics = self.attachAsset('spike', { anchorX: 0.5, anchorY: 1.0 }); self.speed = -8; self.passed = false; self.update = function () { self.x += self.speed * gameSpeed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ var gameSpeed = 1.0; var distanceTraveled = 0; var carrotsCollected = 0; var gameRunning = true; var lastVoiceJump = false; var voiceJumpCooldown = 0; // Ground setup var groundY = 2732 - 200; var groundSegments = []; for (var i = 0; i < 10; i++) { var groundSegment = game.addChild(new Ground()); groundSegment.x = i * 300; groundSegment.y = groundY; groundSegments.push(groundSegment); } // Rabbit setup var rabbit = game.addChild(new Rabbit()); rabbit.x = 400; rabbit.y = groundY; rabbit.groundY = groundY; // Game elements arrays var obstacles = []; var holes = []; var carrots = []; var spikes = []; // Obstacle spawn timer var obstacleTimer = 0; var obstacleSpawnRate = 150; // Increased spawn rate (more time between obstacles) // Distance and score display var distanceText = new Text2('Distance: 0m', { size: 80, fill: 0xFFFFFF }); distanceText.anchor.set(0, 0); LK.gui.topLeft.addChild(distanceText); distanceText.x = 120; distanceText.y = 20; var carrotText = new Text2('Carrots: 0', { size: 80, fill: 0xFFFFFF }); carrotText.anchor.set(1, 0); LK.gui.topRight.addChild(carrotText); carrotText.x = -20; carrotText.y = 20; // Voice feedback indicator var voiceIndicator = new Text2('๐', { size: 60, fill: 0x00ff00 }); voiceIndicator.anchor.set(0.5, 0); LK.gui.top.addChild(voiceIndicator); voiceIndicator.x = 0; voiceIndicator.y = 100; voiceIndicator.alpha = 0.3; function spawnObstacle() { var obstacleType = Math.floor(Math.random() * 6); // Increased range to reduce obstacle density var spawnX = 2048 + 200; if (obstacleType === 0) { var obstacle = game.addChild(new Obstacle()); obstacle.x = spawnX; obstacle.y = groundY; obstacles.push(obstacle); } else if (obstacleType === 1) { var hole = game.addChild(new Hole()); hole.x = spawnX; hole.y = groundY; holes.push(hole); } else if (obstacleType === 2) { var spike = game.addChild(new Spike()); spike.x = spawnX; spike.y = groundY; spikes.push(spike); } else { var carrot = game.addChild(new Carrot()); carrot.x = spawnX; carrot.y = groundY - 200; carrots.push(carrot); } } function checkCollisions() { // Check obstacle collisions for (var i = obstacles.length - 1; i >= 0; i--) { var obstacle = obstacles[i]; if (rabbit.intersects(obstacle)) { LK.getSound('hit').play(); LK.effects.flashScreen(0xff0000, 1000); gameRunning = false; LK.showGameOver(); return; } if (obstacle.x < -200) { obstacle.destroy(); obstacles.splice(i, 1); } } // Check hole collisions for (var i = holes.length - 1; i >= 0; i--) { var hole = holes[i]; if (rabbit.intersects(hole) && rabbit.isOnGround) { LK.getSound('hit').play(); LK.effects.flashScreen(0xff0000, 1000); gameRunning = false; LK.showGameOver(); return; } if (hole.x < -200) { hole.destroy(); holes.splice(i, 1); } } // Check spike collisions for (var i = spikes.length - 1; i >= 0; i--) { var spike = spikes[i]; if (rabbit.intersects(spike)) { LK.getSound('hit').play(); LK.effects.flashScreen(0xff0000, 1000); gameRunning = false; LK.showGameOver(); return; } if (spike.x < -200) { spike.destroy(); spikes.splice(i, 1); } } // Check carrot collection for (var i = carrots.length - 1; i >= 0; i--) { var carrot = carrots[i]; if (rabbit.intersects(carrot) && !carrot.collected) { carrot.collected = true; carrotsCollected++; LK.setScore(LK.getScore() + 10); LK.getSound('collect').play(); carrot.destroy(); carrots.splice(i, 1); } else if (carrot.x < -200) { carrot.destroy(); carrots.splice(i, 1); } } } function updateGround() { for (var i = groundSegments.length - 1; i >= 0; i--) { var segment = groundSegments[i]; if (segment.x < -300) { segment.x = (groundSegments.length - 1) * 300; } } } game.down = function (x, y, obj) { if (gameRunning) { rabbit.jump(); } }; function handleVoiceControl() { // Reduce cooldown timer if (voiceJumpCooldown > 0) { voiceJumpCooldown--; } // Check for voice input to trigger jump - lowered threshold for better sensitivity var currentVoiceLevel = facekit.volume > 0.2; // Lower threshold for better voice detection var mouthOpenJump = facekit.mouthOpen; // Alternative: mouth open detection if (!lastVoiceJump && currentVoiceLevel && voiceJumpCooldown <= 0 || mouthOpenJump && voiceJumpCooldown <= 0) { // Voice jump triggered if (gameRunning) { rabbit.jump(); voiceJumpCooldown = 10; // Reduced cooldown for more responsive control } } // Update last voice state lastVoiceJump = currentVoiceLevel; } game.update = function () { if (!gameRunning) return; // Handle voice control handleVoiceControl(); // Update distance and speed distanceTraveled += 0.5; gameSpeed = 1.0 + distanceTraveled / 1000; // Update ground updateGround(); // Spawn obstacles obstacleTimer++; if (obstacleTimer >= obstacleSpawnRate) { spawnObstacle(); obstacleTimer = 0; obstacleSpawnRate = Math.max(80, obstacleSpawnRate - 1); // Slower spawn rate reduction } // Check collisions checkCollisions(); // Update UI distanceText.setText('Distance: ' + Math.floor(distanceTraveled) + 'm'); carrotText.setText('Carrots: ' + carrotsCollected); // Update voice indicator if (facekit.volume > 0.2 || facekit.mouthOpen) { voiceIndicator.alpha = 1.0; voiceIndicator.setText('๐'); } else { voiceIndicator.alpha = 0.3; voiceIndicator.setText('๐'); } // Update score based on distance LK.setScore(Math.floor(distanceTraveled) + carrotsCollected * 10); };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var facekit = LK.import("@upit/facekit.v1");
/****
* Classes
****/
var Carrot = Container.expand(function () {
var self = Container.call(this);
var carrotGraphics = self.attachAsset('carrot', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -8;
self.collected = false;
self.update = function () {
self.x += self.speed * gameSpeed;
self.rotation += 0.1;
};
return self;
});
var Ground = Container.expand(function () {
var self = Container.call(this);
var groundGraphics = self.attachAsset('ground', {
anchorX: 0,
anchorY: 0
});
self.speed = -8;
self.update = function () {
self.x += self.speed * gameSpeed;
};
return self;
});
var Hole = Container.expand(function () {
var self = Container.call(this);
var holeGraphics = self.attachAsset('hole', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = -8;
self.passed = false;
self.update = function () {
self.x += self.speed * gameSpeed;
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = -8;
self.passed = false;
self.update = function () {
self.x += self.speed * gameSpeed;
};
return self;
});
var Rabbit = Container.expand(function () {
var self = Container.call(this);
var rabbitGraphics = self.attachAsset('rabbit', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityY = 0;
self.isJumping = false;
self.isOnGround = true;
self.jumpPower = -35; // Increased jump power for long jump
self.gravity = 0.8; // Reduced gravity for longer air time
self.groundY = 0;
self.jump = function () {
if (self.isOnGround) {
self.velocityY = self.jumpPower;
self.isJumping = true;
self.isOnGround = false;
LK.getSound('jump').play();
// Add visual feedback for long jump
LK.effects.flashObject(self, 0xffff00, 300); // Yellow flash for jump
}
};
self.update = function () {
if (!self.isOnGround) {
self.velocityY += self.gravity;
self.y += self.velocityY;
if (self.y >= self.groundY) {
self.y = self.groundY;
self.velocityY = 0;
self.isJumping = false;
self.isOnGround = true;
}
}
};
return self;
});
var Spike = Container.expand(function () {
var self = Container.call(this);
var spikeGraphics = self.attachAsset('spike', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = -8;
self.passed = false;
self.update = function () {
self.x += self.speed * gameSpeed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
var gameSpeed = 1.0;
var distanceTraveled = 0;
var carrotsCollected = 0;
var gameRunning = true;
var lastVoiceJump = false;
var voiceJumpCooldown = 0;
// Ground setup
var groundY = 2732 - 200;
var groundSegments = [];
for (var i = 0; i < 10; i++) {
var groundSegment = game.addChild(new Ground());
groundSegment.x = i * 300;
groundSegment.y = groundY;
groundSegments.push(groundSegment);
}
// Rabbit setup
var rabbit = game.addChild(new Rabbit());
rabbit.x = 400;
rabbit.y = groundY;
rabbit.groundY = groundY;
// Game elements arrays
var obstacles = [];
var holes = [];
var carrots = [];
var spikes = [];
// Obstacle spawn timer
var obstacleTimer = 0;
var obstacleSpawnRate = 150; // Increased spawn rate (more time between obstacles)
// Distance and score display
var distanceText = new Text2('Distance: 0m', {
size: 80,
fill: 0xFFFFFF
});
distanceText.anchor.set(0, 0);
LK.gui.topLeft.addChild(distanceText);
distanceText.x = 120;
distanceText.y = 20;
var carrotText = new Text2('Carrots: 0', {
size: 80,
fill: 0xFFFFFF
});
carrotText.anchor.set(1, 0);
LK.gui.topRight.addChild(carrotText);
carrotText.x = -20;
carrotText.y = 20;
// Voice feedback indicator
var voiceIndicator = new Text2('๐', {
size: 60,
fill: 0x00ff00
});
voiceIndicator.anchor.set(0.5, 0);
LK.gui.top.addChild(voiceIndicator);
voiceIndicator.x = 0;
voiceIndicator.y = 100;
voiceIndicator.alpha = 0.3;
function spawnObstacle() {
var obstacleType = Math.floor(Math.random() * 6); // Increased range to reduce obstacle density
var spawnX = 2048 + 200;
if (obstacleType === 0) {
var obstacle = game.addChild(new Obstacle());
obstacle.x = spawnX;
obstacle.y = groundY;
obstacles.push(obstacle);
} else if (obstacleType === 1) {
var hole = game.addChild(new Hole());
hole.x = spawnX;
hole.y = groundY;
holes.push(hole);
} else if (obstacleType === 2) {
var spike = game.addChild(new Spike());
spike.x = spawnX;
spike.y = groundY;
spikes.push(spike);
} else {
var carrot = game.addChild(new Carrot());
carrot.x = spawnX;
carrot.y = groundY - 200;
carrots.push(carrot);
}
}
function checkCollisions() {
// Check obstacle collisions
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (rabbit.intersects(obstacle)) {
LK.getSound('hit').play();
LK.effects.flashScreen(0xff0000, 1000);
gameRunning = false;
LK.showGameOver();
return;
}
if (obstacle.x < -200) {
obstacle.destroy();
obstacles.splice(i, 1);
}
}
// Check hole collisions
for (var i = holes.length - 1; i >= 0; i--) {
var hole = holes[i];
if (rabbit.intersects(hole) && rabbit.isOnGround) {
LK.getSound('hit').play();
LK.effects.flashScreen(0xff0000, 1000);
gameRunning = false;
LK.showGameOver();
return;
}
if (hole.x < -200) {
hole.destroy();
holes.splice(i, 1);
}
}
// Check spike collisions
for (var i = spikes.length - 1; i >= 0; i--) {
var spike = spikes[i];
if (rabbit.intersects(spike)) {
LK.getSound('hit').play();
LK.effects.flashScreen(0xff0000, 1000);
gameRunning = false;
LK.showGameOver();
return;
}
if (spike.x < -200) {
spike.destroy();
spikes.splice(i, 1);
}
}
// Check carrot collection
for (var i = carrots.length - 1; i >= 0; i--) {
var carrot = carrots[i];
if (rabbit.intersects(carrot) && !carrot.collected) {
carrot.collected = true;
carrotsCollected++;
LK.setScore(LK.getScore() + 10);
LK.getSound('collect').play();
carrot.destroy();
carrots.splice(i, 1);
} else if (carrot.x < -200) {
carrot.destroy();
carrots.splice(i, 1);
}
}
}
function updateGround() {
for (var i = groundSegments.length - 1; i >= 0; i--) {
var segment = groundSegments[i];
if (segment.x < -300) {
segment.x = (groundSegments.length - 1) * 300;
}
}
}
game.down = function (x, y, obj) {
if (gameRunning) {
rabbit.jump();
}
};
function handleVoiceControl() {
// Reduce cooldown timer
if (voiceJumpCooldown > 0) {
voiceJumpCooldown--;
}
// Check for voice input to trigger jump - lowered threshold for better sensitivity
var currentVoiceLevel = facekit.volume > 0.2; // Lower threshold for better voice detection
var mouthOpenJump = facekit.mouthOpen; // Alternative: mouth open detection
if (!lastVoiceJump && currentVoiceLevel && voiceJumpCooldown <= 0 || mouthOpenJump && voiceJumpCooldown <= 0) {
// Voice jump triggered
if (gameRunning) {
rabbit.jump();
voiceJumpCooldown = 10; // Reduced cooldown for more responsive control
}
}
// Update last voice state
lastVoiceJump = currentVoiceLevel;
}
game.update = function () {
if (!gameRunning) return;
// Handle voice control
handleVoiceControl();
// Update distance and speed
distanceTraveled += 0.5;
gameSpeed = 1.0 + distanceTraveled / 1000;
// Update ground
updateGround();
// Spawn obstacles
obstacleTimer++;
if (obstacleTimer >= obstacleSpawnRate) {
spawnObstacle();
obstacleTimer = 0;
obstacleSpawnRate = Math.max(80, obstacleSpawnRate - 1); // Slower spawn rate reduction
}
// Check collisions
checkCollisions();
// Update UI
distanceText.setText('Distance: ' + Math.floor(distanceTraveled) + 'm');
carrotText.setText('Carrots: ' + carrotsCollected);
// Update voice indicator
if (facekit.volume > 0.2 || facekit.mouthOpen) {
voiceIndicator.alpha = 1.0;
voiceIndicator.setText('๐');
} else {
voiceIndicator.alpha = 0.3;
voiceIndicator.setText('๐');
}
// Update score based on distance
LK.setScore(Math.floor(distanceTraveled) + carrotsCollected * 10);
};
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Bunny Hop Rush" and with the description "An endless runner where you tap to make a rabbit jump over obstacles while automatically running forward. Collect carrots and see how far you can go!". No text on banner!
meadow. In-Game asset. 2d. High contrast. No shadows
big stone. In-Game asset. 2d. High contrast. No shadows
carrot. In-Game asset. 2d. High contrast. No shadows
bush. In-Game asset. 2d. High contrast. No shadows