var Gift = Container.expand(function () {
var self = Container.call(this);
var giftGraphics = self.createAsset('gift', 'Gift Graphics', .5, .5);
self.speed = 5;
self.move = function () {
self.y += self.speed;
};
});
var Asteroid = Container.expand(function () {
var self = Container.call(this);
var asteroidGraphics = self.createAsset('asteroid', 'Asteroid Graphics', .5, .5);
self.speed = 7;
self.move = function () {
self.y += self.speed;
};
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5);
self.speed = 10;
self.move = function (x, y) {
self.x = x;
self.y = y;
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var gifts = [];
var asteroids = [];
var player = self.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 / 2;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
LK.setScore(0);
scoreTxt.setText(0);
scoreTxt.anchor.set(.5, 0);
LK.gui.topCenter.addChild(scoreTxt);
var dragNode = null;
player.on('down', function (obj) {
dragNode = player;
});
function handleMove(obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
if (dragNode) {
dragNode.move(pos.x, pos.y);
}
}
stage.on('move', handleMove);
stage.on('up', function (obj) {
dragNode = null;
});
LK.on('tick', function () {
for (var a = gifts.length; a >= 0; a--) {
gifts[a].move();
if (gifts[a].y > 2732) {
gifts[a].destroy();
gifts.splice(a, 1);
}
}
for (var a = asteroids.length; a >= 0; a--) {
asteroids[a].move();
if (asteroids[a].y > 2732) {
asteroids[a].destroy();
asteroids.splice(a, 1);
}
}
if (LK.ticks % 60 == 0) {
var newGift = new Gift();
newGift.x = Math.random() * 2048;
newGift.y = 0;
gifts.push(newGift);
self.addChild(newGift);
}
if (LK.ticks % 30 == 0) {
var newAsteroid = new Asteroid();
newAsteroid.x = Math.random() * 2048;
newAsteroid.y = 0;
asteroids.push(newAsteroid);
self.addChild(newAsteroid);
}
});
});
Asteroid, falling Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Red gift Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Santas sled, with santa in it Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Top down view
festive background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.