/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Character class representing the player
var Character = Container.expand(function () {
var self = Container.call(this);
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Speed of the character moving from left to right
self.jumpHeight = 200; // Height of the jump
self.isJumping = false; // Flag to check if the character is jumping
self.jumpSpeed = -15; // Speed of the jump
self.gravity = 1; // Gravity effect on the character
// Update function called every game tick
self.update = function () {
if (self.isJumping) {
self.y += self.jumpSpeed;
self.jumpSpeed += self.gravity;
if (self.y >= 200) {
// Reset position after jump
self.y = 200;
self.isJumping = false;
self.jumpSpeed = -15;
}
}
self.x += self.speed;
if (self.x > 2048) {
// Reset position if character goes off screen
self.x = 0;
}
};
// Function to initiate jump
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize character and add to game
var character = game.addChild(new Character());
character.x = 0; // Starting position on the x-axis
character.y = 200; // Starting position on the y-axis
// Event listener for mouse or touch down
game.down = function (x, y, obj) {
character.jump();
};
// Update function for the game
game.update = function () {
character.update();
}; /****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Character class representing the player
var Character = Container.expand(function () {
var self = Container.call(this);
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5; // Speed of the character moving from left to right
self.jumpHeight = 200; // Height of the jump
self.isJumping = false; // Flag to check if the character is jumping
self.jumpSpeed = -15; // Speed of the jump
self.gravity = 1; // Gravity effect on the character
// Update function called every game tick
self.update = function () {
if (self.isJumping) {
self.y += self.jumpSpeed;
self.jumpSpeed += self.gravity;
if (self.y >= 200) {
// Reset position after jump
self.y = 200;
self.isJumping = false;
self.jumpSpeed = -15;
}
}
self.x += self.speed;
if (self.x > 2048) {
// Reset position if character goes off screen
self.x = 0;
}
};
// Function to initiate jump
self.jump = function () {
if (!self.isJumping) {
self.isJumping = true;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize character and add to game
var character = game.addChild(new Character());
character.x = 0; // Starting position on the x-axis
character.y = 200; // Starting position on the y-axis
// Event listener for mouse or touch down
game.down = function (x, y, obj) {
character.jump();
};
// Update function for the game
game.update = function () {
character.update();
};
A single, cartoonish little monster. It has fur and a big mouth, and its movement posture looks as if it's about to pounce forward.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
It's a 2D planar background. It's a jungle with green grass growing all over the ground and thick forests surrounding it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An orangutan in a cartoon image.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bunch of bananas in a cartoon image.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.