===================================================================
--- original.js
+++ change.js
@@ -37,8 +37,24 @@
self.update = function () {
// Fairy movement logic
};
});
+// Star class
+var Star = Container.expand(function () {
+ var self = Container.call(this);
+ var starGraphics = self.attachAsset('star', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.y = -5;
+ self.x = Math.random() * 2048;
+ }
+ };
+});
/****
* Initialize Game
****/
@@ -67,8 +83,14 @@
scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
+ // Create starfield
+ for (var i = 0; i < 500; i++) {
+ var star = game.addChild(new Star());
+ star.x = Math.random() * 2048;
+ star.y = Math.random() * 2732;
+ }
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Set up game event listeners
game.down = function (x, y, obj) {
@@ -96,8 +118,14 @@
}
}
// Update game logic
function updateGame() {
+ // Update starfield
+ for (var i = game.children.length - 1; i >= 0; i--) {
+ if (game.children[i] instanceof Star) {
+ game.children[i].update();
+ }
+ }
// Update bullets
for (var i = bullets.length - 1; i >= 0; i--) {
bullets[i].update();
if (bullets[i].y < -50) {
8-bit. cartoon. white star.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon 8 bit fairy dust. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon, 8bit, fireball. Black border. Cicular.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon, 8 bit, shield. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, axe. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark electric ball, 8bit, cartoon.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit, cartoon, treasure chest frame. very big empty center. only a fine border of chest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
shoot
Sound effect
boom
Sound effect
Hit
Sound effect
backgroundmusic
Sound effect
bossbullet
Sound effect
bossappear
Sound effect
hit
Sound effect
diamondcollect
Sound effect
hooray
Sound effect
nono
Sound effect
letsgo
Sound effect
death
Sound effect
yes
Sound effect