User prompt
give the camera an update function which sets the moon's scale to the zoom
User prompt
create an empty "camera" class that contains only "var zoom = 1.0;" and initialize an instance after the moon
User prompt
Create a moon asset in the middle of the screen
User prompt
Remove all game logic and classes
Initial prompt
Swing Frog
/****
* Classes
****/
// Define a simple Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.y = -self.height;
}
};
});
//<Assets used in the game will automatically appear here>
// Define a simple Player class
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
// Player update logic
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize player
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - 100;
// Initialize enemies
var enemies = [];
for (var i = 0; i < 5; i++) {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = Math.random() * 2732 / 2;
enemies.push(enemy);
game.addChild(enemy);
}
// Handle player movement
game.move = function (x, y, obj) {
player.x = x;
player.y = y;
};
// Update game state
game.update = function () {
for (var i = 0; i < enemies.length; i++) {
enemies[i].update();
if (player.intersects(enemies[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
};
fireCrackle
Sound effect
frogTongue
Sound effect
frogDeath
Sound effect
lilypadBounce
Sound effect
noTarget
Sound effect
backgroundAmbient
Sound effect
fireCrackling1
Sound effect
fireCrackling2
Sound effect
fireCrackling3
Sound effect
fireCrackling4
Sound effect
frogBounce
Sound effect
pickupCaught
Sound effect