Code edit (3 edits merged)
Please save this source code
User prompt
The bear is not at the same ground level as the rest of the assets, correct it.
User prompt
add trees to the background
Code edit (1 edits merged)
Please save this source code
User prompt
the bear should jump from the bottom and have a gravity effect to make the jump feel natural
User prompt
the bear should stay at the left corner, and it jumps when the screen is touched
Initial prompt
Grizzly and the Lemmings
/**** * Classes ****/ // Grizzly Bear class var GrizzlyBear = Container.expand(function () { var self = Container.call(this); var bearGraphics = self.createAsset('grizzlyBear', 'Grizzly Bear running', 0.5, 1); self.speed = 5; self.move = function () { self.x += self.speed; if (self.x > 2048) { self.x = -bearGraphics.width; } }; }); // Lemming class var Lemming = Container.expand(function () { var self = Container.call(this); var lemmingGraphics = self.createAsset('lemming', 'Lemming running away', 0.5, 1); self.speed = 3; self.move = function () { self.x += self.speed; if (self.x > 2048) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Sky blue background }); /**** * Game Code ****/ // Initialize important asset arrays var lemmings = []; var grizzlyBear; // Create the Grizzly Bear grizzlyBear = game.addChild(new GrizzlyBear()); grizzlyBear.x = 100; grizzlyBear.y = 2732 - grizzlyBear.height; // Game tick event LK.on('tick', function () { // Move the Grizzly Bear grizzlyBear.move(); // Move each Lemming for (var i = lemmings.length - 1; i >= 0; i--) { lemmings[i].move(); // Check if Lemming is off screen and destroy it if (lemmings[i].x > 2048) { lemmings[i].destroy(); lemmings.splice(i, 1); } } // Spawn Lemmings at intervals if (LK.ticks % 120 === 0) { var newLemming = new Lemming(); newLemming.x = -newLemming.width; newLemming.y = 2732 - newLemming.height; lemmings.push(newLemming); game.addChild(newLemming); } });
/****
* Classes
****/
// Grizzly Bear class
var GrizzlyBear = Container.expand(function () {
var self = Container.call(this);
var bearGraphics = self.createAsset('grizzlyBear', 'Grizzly Bear running', 0.5, 1);
self.speed = 5;
self.move = function () {
self.x += self.speed;
if (self.x > 2048) {
self.x = -bearGraphics.width;
}
};
});
// Lemming class
var Lemming = Container.expand(function () {
var self = Container.call(this);
var lemmingGraphics = self.createAsset('lemming', 'Lemming running away', 0.5, 1);
self.speed = 3;
self.move = function () {
self.x += self.speed;
if (self.x > 2048) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Initialize important asset arrays
var lemmings = [];
var grizzlyBear;
// Create the Grizzly Bear
grizzlyBear = game.addChild(new GrizzlyBear());
grizzlyBear.x = 100;
grizzlyBear.y = 2732 - grizzlyBear.height;
// Game tick event
LK.on('tick', function () {
// Move the Grizzly Bear
grizzlyBear.move();
// Move each Lemming
for (var i = lemmings.length - 1; i >= 0; i--) {
lemmings[i].move();
// Check if Lemming is off screen and destroy it
if (lemmings[i].x > 2048) {
lemmings[i].destroy();
lemmings.splice(i, 1);
}
}
// Spawn Lemmings at intervals
if (LK.ticks % 120 === 0) {
var newLemming = new Lemming();
newLemming.x = -newLemming.width;
newLemming.y = 2732 - newLemming.height;
lemmings.push(newLemming);
game.addChild(newLemming);
}
});
Cartoon style cute apple tree with small branches. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon style cute rock. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cute lemming running while holding a nutella cup. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Cartoon style.