===================================================================
--- original.js
+++ change.js
@@ -33,16 +33,30 @@
blueBox.destroy();
var snow = game.addChild(new Snow());
snow.x = self.x;
snow.y = self.y;
+ var redBox = game.addChild(new RedBox());
+ redBox.x = Math.random() * 2048;
+ redBox.y = 2732;
}
if (self.intersects(button)) {
var yellowBox = game.addChild(new YellowBox());
yellowBox.x = blueBox.x;
yellowBox.y = blueBox.y;
}
};
});
+var RedBox = Container.expand(function () {
+ var self = Container.call(this);
+ var redBoxGraphics = self.attachAsset('redBox', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -5;
+ self.update = function () {
+ self.y += self.speed;
+ };
+});
var Snow = Container.expand(function () {
var self = Container.call(this);
var snowGraphics = self.attachAsset('snow', {
anchorX: 0.5,
@@ -83,8 +97,20 @@
glider.x = x;
glider.y = y;
};
game.update = function () {
+ game.update = function () {
+ if (!blueBox || blueBox.destroyed) {
+ blueBox = game.addChild(new BlueBox());
+ blueBox.x = 2048 / 2;
+ blueBox.y = 2732 / 5;
+ }
+ for (var i = game.children.length - 1; i >= 0; i--) {
+ if (game.children[i] instanceof RedBox && game.children[i].y < 0) {
+ game.children[i].destroy();
+ }
+ }
+ };
if (!blueBox || blueBox.destroyed) {
blueBox = game.addChild(new BlueBox());
blueBox.x = 2048 / 2;
blueBox.y = 2732 / 5;
human. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
classical style
flower. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
little flower. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
older
side face
halo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.