===================================================================
--- original.js
+++ change.js
@@ -18,8 +18,18 @@
self.speedY *= -1;
}
};
});
+var Gun = Container.expand(function () {
+ var self = Container.call(this);
+ var gunGraphics = self.attachAsset('gun', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.update = function () {
+ // Gun behavior goes here
+ };
+});
/****
* Initialize Game
****/
@@ -29,11 +39,14 @@
/****
* Game Code
****/
-//<Assets used in the game will automatically appear here>
-// Initialize variables
+// or via static code analysis based on their usage in the code.
+// Assets are automatically created and loaded either dynamically during gameplay
var balls = [];
+var gun = game.addChild(new Gun());
+gun.x = 2048 / 2;
+gun.y = 2732 - gun.height / 2;
var level = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
for (var i = 0; i < level.length; i++) {
for (var j = 0; j < level[i].length; j++) {
if (level[i][j] === 1) {