User prompt
The new birdseed appears after 1 second, in a new location.
User prompt
When the birdseed is eaten, a new one appears.
User prompt
The birdseed appears on screen at the start of the game. The pigeon pecks at the seed, when the user scrolls the pigeon nearby the birdseed, and the player gets 100 points.
User prompt
The birdseed appears on screen every 5 seconds.
User prompt
The pigeon is controlled by the user’s thumb on a mobile device. The bird generates a signal when the bird approaches nearby birdseed.
User prompt
The bird walks on screen and approaches. The user tosses out bird seed for the pigeon.
User prompt
I want the pigeon to peck at the seed.
Initial prompt
Pigeons and Friends
/**** * Classes ****/ // BreadCrumb class representing collectible items var BreadCrumb = Container.expand(function () { var self = Container.call(this); var breadCrumbGraphics = self.attachAsset('breadcrumb', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for breadcrumb }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Pigeon class representing the player character var Pigeon = Container.expand(function () { var self = Container.call(this); var pigeonGraphics = self.attachAsset('pigeon', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Update logic for pigeon }; self.down = function (x, y, obj) { // Handle touch down event self.x = x; self.y = y; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb // Init game with sky blue background }); /**** * Game Code ****/ // Initialize game variables var pigeon = game.addChild(new Pigeon()); pigeon.x = 2048 / 2; pigeon.y = 2732 - 200; var breadCrumbs = []; var score = 0; // Function to spawn breadcrumbs at random positions function spawnBreadCrumb() { var breadCrumb = new BreadCrumb(); breadCrumb.x = Math.random() * 2048; breadCrumb.y = Math.random() * 2732; breadCrumbs.push(breadCrumb); game.addChild(breadCrumb); } // Handle game move event game.move = function (x, y, obj) { pigeon.x = x; pigeon.y = y; }; // Update game logic game.update = function () { // Check for collisions between pigeon and breadcrumbs for (var i = breadCrumbs.length - 1; i >= 0; i--) { var breadCrumb = breadCrumbs[i]; if (pigeon.intersects(breadCrumb)) { score += 1; breadCrumb.destroy(); breadCrumbs.splice(i, 1); } } // Spawn new breadcrumb every 60 frames if (LK.ticks % 60 === 0) { spawnBreadCrumb(); } }; // Display score var scoreTxt = new Text2('Score: 0', { size: 100, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Update score display function updateScore() { scoreTxt.setText('Score: ' + score); } // Call updateScore every frame game.update = function () { updateScore(); };
/****
* Classes
****/
// BreadCrumb class representing collectible items
var BreadCrumb = Container.expand(function () {
var self = Container.call(this);
var breadCrumbGraphics = self.attachAsset('breadcrumb', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for breadcrumb
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Pigeon class representing the player character
var Pigeon = Container.expand(function () {
var self = Container.call(this);
var pigeonGraphics = self.attachAsset('pigeon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
// Update logic for pigeon
};
self.down = function (x, y, obj) {
// Handle touch down event
self.x = x;
self.y = y;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb // Init game with sky blue background
});
/****
* Game Code
****/
// Initialize game variables
var pigeon = game.addChild(new Pigeon());
pigeon.x = 2048 / 2;
pigeon.y = 2732 - 200;
var breadCrumbs = [];
var score = 0;
// Function to spawn breadcrumbs at random positions
function spawnBreadCrumb() {
var breadCrumb = new BreadCrumb();
breadCrumb.x = Math.random() * 2048;
breadCrumb.y = Math.random() * 2732;
breadCrumbs.push(breadCrumb);
game.addChild(breadCrumb);
}
// Handle game move event
game.move = function (x, y, obj) {
pigeon.x = x;
pigeon.y = y;
};
// Update game logic
game.update = function () {
// Check for collisions between pigeon and breadcrumbs
for (var i = breadCrumbs.length - 1; i >= 0; i--) {
var breadCrumb = breadCrumbs[i];
if (pigeon.intersects(breadCrumb)) {
score += 1;
breadCrumb.destroy();
breadCrumbs.splice(i, 1);
}
}
// Spawn new breadcrumb every 60 frames
if (LK.ticks % 60 === 0) {
spawnBreadCrumb();
}
};
// Display score
var scoreTxt = new Text2('Score: 0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Update score display
function updateScore() {
scoreTxt.setText('Score: ' + score);
}
// Call updateScore every frame
game.update = function () {
updateScore();
};