diff --git a/Phaser.sublime-workspace b/Phaser.sublime-workspace index 255e8b0d..91dce77e 100644 --- a/Phaser.sublime-workspace +++ b/Phaser.sublime-workspace @@ -3,6 +3,66 @@ { "selected_items": [ + [ + "refre", + "refreshRate" + ], + [ + "my", + "my3d" + ], + [ + "myfx", + "myfx" + ], + [ + "canv", + "canvasToConsole" + ], + [ + "_", + "_iNext" + ], + [ + "nex", + "nextNode" + ], + [ + "node1", + "node1Prev" + ], + [ + "node2", + "node2Next" + ], + [ + "_i", + "_iPrev" + ], + [ + "rad", + "radToDeg" + ], + [ + "callb", + "callbackContext (variable)" + ], + [ + "callbac", + "callbackContext" + ], + [ + "not", + "notifyCallback" + ], + [ + "pro", + "processCallback" + ], + [ + "quad", + "quadTreeID" + ], [ "ver", "verticalMidpoint" @@ -59,10 +119,6 @@ "_o", "_oy" ], - [ - "_", - "_y (variable)" - ], [ "scal", "scaleY" @@ -458,114 +514,41 @@ [ "con", "consts" - ], - [ - "c", - "consts" - ], - [ - "class", - "classname" - ], - [ - "clas", - "classname" - ], - [ - "output", - "output_file" - ], - [ - "str_re", - "str_replace" - ], - [ - "input", - "input_dir" - ], - [ - "back", - "background-size" - ], - [ - "wait", - "waitingHelpscreen" - ], - [ - "juke", - "jukebox" - ], - [ - "jukeb", - "jukeboxPP" - ], - [ - "Beak", - "BeakerGameStartGameHook" - ], - [ - "Bea", - "BeakerGameStartGameHook" - ], - [ - "crea", - "createHD" - ], - [ - "whee", - "wheelUp" ] ] }, "buffers": [ { - "file": "src/physics/arcade/ArcadePhysics.js", + "file": "examples/consoleBanner2.php", "settings": { - "buffer_size": 15164, - "line_ending": "Windows", - "name": "Phaser.Physics.Arcade = function (game) {" - } - }, - { - "file": "src/physics/arcade/Body.js", - "settings": - { - "buffer_size": 5199, + "buffer_size": 2371, "line_ending": "Windows" } }, { - "file": "examples/quadtree.php", + "file": "/D/wamp/www/consoledemo/index.html", "settings": { - "buffer_size": 1953, + "buffer_size": 8399, "line_ending": "Windows" } }, { - "file": "src/core/Game.js", + "file": "/D/wamp/www/consoledemo/src/codef_scrolltext.js", "settings": { - "buffer_size": 9013, - "line_ending": "Windows" + "buffer_size": 8518, + "line_ending": "Unix" } }, { - "file": "src/math/QuadTree.js", + "file": "/D/wamp/www/consoledemo/src/codef_core.js", "settings": { - "buffer_size": 6524, - "line_ending": "Windows" - } - }, - { - "file": "src/utils/Debug.js", - "settings": - { - "buffer_size": 15959, - "line_ending": "Windows" + "buffer_size": 26037, + "line_ending": "Unix" } } ], @@ -597,24 +580,42 @@ }, "file_history": [ - "/D/wamp/www/phaser/src/geom/Rectangle.js", - "/D/wamp/www/phaser/src/gameobjects/Sprite.js", + "/D/wamp/www/consoledemo/src/codef_tween.js", + "/D/wamp/www/consoledemo/src/codef_3d.js", + "/D/wamp/www/consoledemo/src/codef_starfield.js", + "/D/JavaScript/codef/tutorials/40_starfield/index.html", + "/D/JavaScript/codef/tutorials/41_starfield/index.html", + "/D/wamp/www/phaser/src/physics/arcade/Body.js", + "/D/wamp/www/phaser/TS Source/display/DynamicTexture.js", + "/D/wamp/www/phaser/TS Source/utils/ColorUtils.ts", + "/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js", + "/D/wamp/www/phaser/src/pixi/display/DisplayObjectContainer.js", "/D/wamp/www/phaser/src/core/World.js", + "/D/wamp/www/phaser/TS Source/display/DynamicTexture.ts", + "/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js", + "/D/wamp/www/phaser/src/core/Game.js", + "/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js", + "/D/wamp/www/phaser/src/gameobjects/Sprite.js", + "/D/wamp/www/phaser/TS Source/gameobjects/Events.js", + "/D/wamp/www/phaser/TS Source/input/InputHandler.js", + "/D/wamp/www/phaser/src/input/Input.js", + "/D/wamp/www/phaser/src/input/Pointer.js", + "/D/wamp/www/phaser/src/utils/Debug.js", + "/D/wamp/www/phaser/src/math/QuadTree.js", + "/D/wamp/www/phaser/examples/motion1.php", + "/D/wamp/www/phaser/src/geom/Rectangle.js", "/D/wamp/www/phaser/examples/js.php", "/D/wamp/www/phaser/todo/phaser clean up/Collision.js", "/D/wamp/www/phaser/todo/physics/Collision.js", - "/D/wamp/www/phaser/src/core/Game.js", "/D/wamp/www/phaser/src/time/Time.js", "/D/wamp/www/phaser/src/loader/Cache.js", "/D/wamp/www/phaser/src/animation/AnimationManager.js", "/D/wamp/www/phaser/src/animation/Frame.js", - "/D/wamp/www/phaser/src/utils/Debug.js", "/D/wamp/www/phaser/src/tween/Tween.js", "/D/wamp/www/phaser/src/pixi/display/MovieClip.js", "/D/wamp/www/phaser/src/animation/Animation.js", "/D/wamp/www/pixi.js/examples/example 10 - Text/index.html", "/D/wamp/www/physicsRus/test2.html", - "/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js", "/D/wamp/www/phaser/examples/text3.php", "/D/wamp/www/phaser/src/gameobjects/Text.js", "/D/wamp/www/phaser/src/pixi/text/Text.js", @@ -636,7 +637,6 @@ "/D/wamp/www/phaser/src/pixi/textures/Texture.js", "/D/wamp/www/phaser/src/gameobjects/TileSprite.js", "/D/wamp/www/phaser/examples/get_bounds.php", - "/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js", "/D/wamp/www/phaser/src/pixi/display/Sprite.js", "/D/wamp/www/phaser/examples/tilesprite1.php", "/D/wamp/www/phaser/src/utils/Utils.js", @@ -655,11 +655,9 @@ "/D/wamp/www/phaser/src/sound/Sound.js", "/D/wamp/www/phaser/TS Source/sound/Sound.ts", "/D/wamp/www/phaser/TS Source/sound/SoundManager.js", - "/D/wamp/www/phaser/src/math/QuadTree.js", "/D/wamp/www/phaser/TS Source/math/QuadTree.js", "/D/wamp/www/phaser/src/pixi/display/Stage.js", "/D/wamp/www/phaser/examples/camera_cull1.php", - "/D/wamp/www/phaser/src/pixi/display/DisplayObjectContainer.js", "/D/wamp/www/phaser/src/pixi/display/DisplayObject.js", "/D/wamp/www/bbc-wolfblood/assets/1024/help/help_titles.json", "/D/wamp/www/phaser/src/math/LinkedList.js", @@ -672,7 +670,6 @@ "/D/wamp/www/pixi.js/examples/example 6 - Interactivity/index.html", "/D/wamp/www/phaser/src/math/Math.js", "/D/wamp/www/phaser/src/geom/Point.js", - "/D/wamp/www/phaser/src/input/Input.js", "/D/wamp/www/phaser/TS Source/gameobjects/TransformManager.ts", "/D/wamp/www/phaser/TS Source/utils/SpriteUtils.ts", "/D/wamp/www/phaser/TS Source/utils/SpriteUtils.js", @@ -682,7 +679,6 @@ "/D/wamp/www/phaser/TS Source/utils/DebugUtils.js", "/D/wamp/www/phaser/TS Source/renderers/canvas/SpriteRenderer.ts", "/D/wamp/www/phaser/examples/input1.php", - "/D/wamp/www/phaser/src/input/Pointer.js", "/D/wamp/www/phaser/src/input/Mouse.js", "/D/wamp/www/phaser/src/input/Touch.js", "/D/wamp/www/phaser/src/input/Keyboard.js", @@ -711,20 +707,7 @@ "/D/wamp/www/phaser/TS Source/tweens/Tween.ts", "/D/wamp/www/phaser/TS Source/tweens/TweenManager.ts", "/D/wamp/www/phaser/src/tween/TweenManager.js", - "/C/Users/rich/Desktop/game.js", - "/D/wamp/www/phaser/TS Source/animation/Animation.js", - "/D/wamp/www/phaser/TS Source/animation/AnimationManager.js", - "/D/wamp/www/phaser/TS Source/gameobjects/Sprite.js", - "/D/wamp/www/phaser/src/system/RequestAnimationFrame.js", - "/D/wamp/www/phaser/src/pixi/textures/BaseTexture.js", - "/D/wamp/www/phaser/src/pixi/loaders/ImageLoader.js", - "/D/wamp/www/phaser/src/animation/FrameData.js", - "/D/wamp/www/phaser/src/pixi/loaders/SpriteSheetLoader.js", - "/D/wamp/www/phaser/examples/assets/sprites/running_bot.json", - "/D/wamp/www/pixi.js/examples/example 2 - SpriteSheet/index.html", - "/D/wamp/www/pixi.js/examples/example 3 - MovieClip/index.html", - "/D/wamp/www/pixi.js/examples/example 3 - MovieClip/SpriteSheet.json", - "/D/wamp/www/phaser/examples/assets/sprites/pixi_monsters.json" + "/C/Users/rich/Desktop/game.js" ], "find": { @@ -732,9 +715,10 @@ }, "find_in_files": { - "height": 90.0, + "height": 0.0, "where_history": [ + "D:\\wamp\\www\\phaser\\src\\input", "D:\\wamp\\www\\phaser\\src\\physics\\advanced", "D:\\wamp\\www\\phaser\\src\\pixi", "D:\\wamp\\www\\phaser\\src\\input", @@ -761,6 +745,35 @@ "case_sensitive": true, "find_history": [ + "launch", + "font1", + "480", + "640", + "http://codef.santo.fr/codef", + "%c ", + "s", + "line", + "node2", + "node1", + "Prev", + "Next", + "nextPrev", + "var ", + "nameNext", + "node: ", + "nameFirst", + "first", + "Phaser.Touch_OVERRIDES_MOUSE", + "Phaser.Mouse_TOUCH_COMBINE", + "Phaser.Mouse_OVERRIDES_TOUCH", + ":GameObject", + ":number", + "public ", + "\n ", + "public ", + ": number", + "public ", + "left", "1", "8", "x", @@ -859,36 +872,7 @@ "this._dirty", "X", "x", - "X", - "x", - "this._", - "this._y", - "this._x", - "x", - "updateOnVisible", - "updateTransform", - "worldTransform", - "world", - "s.", - "actual", - "worldTransform", - "getLocalPosition", - "worldTransform", - ".a", - ".", - "var ", - "displayObject", - "sprite", - "Micro", - "x", - "getLocalPosition", - "this.global", - "target.view", - "_width", - "key", - "worldView", - "DebugUtils.", - "Phaser.DebugUtils" + "X" ], "highlight": true, "in_selection": false, @@ -896,6 +880,13 @@ "regex": false, "replace_history": [ + "%c ", + "child2", + "child1", + "Phaser.Input.TOUCH_OVERRIDES_MOUSE", + "Phaser.Input.MOUSE_TOUCH_COMBINE", + "Phaser.Input.MOUSE_OVERRIDES_TOUCH", + "", "maxLevels", "maxObjects", "this.nodes", @@ -979,282 +970,23 @@ "groups": [ { - "selected": 0, + "selected": 1, "sheets": [ { "buffer": 0, - "file": "src/physics/arcade/ArcadePhysics.js", + "file": "examples/consoleBanner2.php", "settings": { - "buffer_size": 15164, + "buffer_size": 2371, "regions": { }, "selection": [ [ - 2843, - 2843 - ] - ], - "settings": - { - "auto_name": "Phaser.Physics.Arcade = function (game) {", - "codeintel": true, - "codeintel_config": - { - "JavaScript": - { - "codeintel_max_recursive_dir_depth": 2, - "codeintel_scan_files_in_project": false, - "javascriptExtraPaths": - [ - ] - }, - "PHP": - { - "codeintel_max_recursive_dir_depth": 5, - "codeintel_scan_files_in_project": false, - "phpExtraPaths": - [ - ] - }, - "Python": - { - "env": - { - } - } - }, - "codeintel_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_live": true, - "codeintel_live_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_max_recursive_dir_depth": 10, - "codeintel_scan_exclude_dir": - { - "JavaScript": - [ - "/build/", - "/min/" - ] - }, - "codeintel_scan_files_in_project": true, - "codeintel_selected_catalogs": - [ - "PyWin32", - "jQuery", - "Rails" - ], - "codeintel_snippets": true, - "codeintel_syntax_map": - { - "Python Django": "Python" - }, - "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage" - }, - "translation.x": 0.0, - "translation.y": 1118.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 1, - "file": "src/physics/arcade/Body.js", - "settings": - { - "buffer_size": 5199, - "regions": - { - }, - "selection": - [ - [ - 2478, - 2478 - ] - ], - "settings": - { - "codeintel": true, - "codeintel_config": - { - "JavaScript": - { - "codeintel_max_recursive_dir_depth": 2, - "codeintel_scan_files_in_project": false, - "javascriptExtraPaths": - [ - ] - }, - "PHP": - { - "codeintel_max_recursive_dir_depth": 5, - "codeintel_scan_files_in_project": false, - "phpExtraPaths": - [ - ] - }, - "Python": - { - "env": - { - } - } - }, - "codeintel_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_live": true, - "codeintel_live_enabled_languages": - [ - "JavaScript", - "Mason", - "XBL", - "XUL", - "RHTML", - "SCSS", - "Python", - "HTML", - "Ruby", - "Python3", - "XML", - "Sass", - "XSLT", - "Django", - "HTML5", - "Perl", - "CSS", - "Twig", - "Less", - "Smarty", - "Node.js", - "Tcl", - "TemplateToolkit", - "PHP" - ], - "codeintel_max_recursive_dir_depth": 10, - "codeintel_scan_exclude_dir": - { - "JavaScript": - [ - "/build/", - "/min/" - ] - }, - "codeintel_scan_files_in_project": true, - "codeintel_selected_catalogs": - [ - "PyWin32", - "jQuery", - "Rails" - ], - "codeintel_snippets": true, - "codeintel_syntax_map": - { - "Python Django": "Python" - }, - "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage" - }, - "translation.x": 0.0, - "translation.y": 1818.0, - "zoom_level": 1.0 - }, - "type": "text" - }, - { - "buffer": 2, - "file": "examples/quadtree.php", - "settings": - { - "buffer_size": 1953, - "regions": - { - }, - "selection": - [ - [ - 1078, - 1078 + 524, + 536 ] ], "settings": @@ -1365,25 +1097,25 @@ "syntax": "Packages/PHP/PHP.tmLanguage" }, "translation.x": 0.0, - "translation.y": 630.0, + "translation.y": 144.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 3, - "file": "src/core/Game.js", + "buffer": 1, + "file": "/D/wamp/www/consoledemo/index.html", "settings": { - "buffer_size": 9013, + "buffer_size": 8399, "regions": { }, "selection": [ [ - 6794, - 6794 + 6153, + 6153 ] ], "settings": @@ -1491,28 +1223,29 @@ "Python Django": "Python" }, "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage" + "syntax": "Packages/HTML/HTML.tmLanguage", + "translate_tabs_to_spaces": false }, "translation.x": 0.0, - "translation.y": 5315.0, + "translation.y": 2092.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 4, - "file": "src/math/QuadTree.js", + "buffer": 2, + "file": "/D/wamp/www/consoledemo/src/codef_scrolltext.js", "settings": { - "buffer_size": 6524, + "buffer_size": 8518, "regions": { }, "selection": [ [ - 5376, - 5376 + 1956, + 1956 ] ], "settings": @@ -1624,25 +1357,25 @@ "translate_tabs_to_spaces": false }, "translation.x": 0.0, - "translation.y": 3240.0, + "translation.y": 701.0, "zoom_level": 1.0 }, "type": "text" }, { - "buffer": 5, - "file": "src/utils/Debug.js", + "buffer": 3, + "file": "/D/wamp/www/consoledemo/src/codef_core.js", "settings": { - "buffer_size": 15959, + "buffer_size": 26037, "regions": { }, "selection": [ [ - 2452, - 2452 + 3147, + 3147 ] ], "settings": @@ -1750,12 +1483,10 @@ "Python Django": "Python" }, "sublime_auto_complete": true, - "syntax": "Packages/JavaScript/JavaScript.tmLanguage", - "tab_size": 4, - "translate_tabs_to_spaces": true + "syntax": "Packages/JavaScript/JavaScript.tmLanguage" }, "translation.x": 0.0, - "translation.y": 1620.0, + "translation.y": 972.0, "zoom_level": 1.0 }, "type": "text" diff --git a/examples/assets/bd/back.png b/examples/assets/bd/back.png new file mode 100644 index 00000000..45e439b7 Binary files /dev/null and b/examples/assets/bd/back.png differ diff --git a/examples/assets/bd/back2.png b/examples/assets/bd/back2.png new file mode 100644 index 00000000..47167d4b Binary files /dev/null and b/examples/assets/bd/back2.png differ diff --git a/examples/assets/bd/scroller.png b/examples/assets/bd/scroller.png new file mode 100644 index 00000000..f48e5546 Binary files /dev/null and b/examples/assets/bd/scroller.png differ diff --git a/examples/consoleBanner.php b/examples/consoleBanner.php index b208f1d4..1bd53c95 100644 --- a/examples/consoleBanner.php +++ b/examples/consoleBanner.php @@ -14,84 +14,63 @@ (function () { - var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render }); + var game = new Phaser.Game(50, 50, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render }); function preload() { - // game.load.image('piccie', 'assets/sprites/phaser_tiny.png'); + game.load.image('piccie', 'assets/sprites/phaser_tiny.png'); // game.load.image('piccie', 'assets/sprites/carrot.png'); // game.load.image('piccie', 'assets/sprites/phaser-dude.png'); - game.load.image('piccie', 'assets/pics/atari_fujilogo.png'); + // game.load.image('piccie', 'assets/pics/atari_fujilogo.png'); } var canvas; var context; + var logo; function create() { - var img = game.add.sprite(0, 0, 'piccie'); + logo = game.add.sprite(0, 0, 'piccie'); - canvas = document.createElement('canvas'); - canvas.width = img.width; - canvas.height = img.height; - context = canvas.getContext('2d'); - - context.drawImage(game.cache.getImage('piccie'), 0, 0); - - var result = ''; - - for (var y = 0; y < img.height; y++) - { - var line = ''; - var css = ''; - var previousColor = ''; - - for (var x = 0; x < img.width; x++) - { - var c = context.getImageData(x, y, 1, 1); - var s = "#" + colorToHex(c.data[0]) + colorToHex(c.data[1]) + colorToHex(c.data[2]); - - if (s == previousColor) - { - line = line + ' '; - } - else - { - line = line + '%c '; - css = css + "'background: " + s + "', "; - previousColor = s; - } - } - - css = css.substr(0, css.length - 2); - - result = result + "console.log('" + line + "', " + css + ");\n"; - } - - document.getElementById('output').innerHTML = result; + logo.body.velocity = 10; } - /** - * Return a string containing a hex representation of the given color - * - * @method colorToHexstring - * @param {Number} color The color channel to get the hex value for, must be a value between 0 and 255) - * @return {String} A string of length 2 characters, i.e. 255 = FF, 0 = 00 - */ function colorToHex(color) { + return "0123456789ABCDEF".charAt((color - (color % 16)) / 16) + "0123456789ABCDEF".charAt(color % 16); + } - var digits = "0123456789ABCDEF"; + function canvasToConsole() { - var lsd = color % 16; - var msd = (color - lsd) / 16; + console.clear(); - var hexified = digits.charAt(msd) + digits.charAt(lsd); + for (var y = 0; y < game.height; y++) + { + // var line = ''; + var c = []; + var previousColor = ''; - return hexified; + for (var x = 0; x < game.width; x++) + { + var rgb = game.renderer.context.getImageData(x, y, 1, 1); + var s = "#" + colorToHex(rgb.data[0]) + colorToHex(rgb.data[1]) + colorToHex(rgb.data[2]); + c.push("'background: " + s + "'"); + } + + console.log('%c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c %c ', + c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], + c[10], c[11], c[12], c[13], c[14], c[15], c[16], c[17], c[18], c[19], + c[20], c[21], c[22], c[23], c[24], c[25], c[26], c[27], c[28], c[29], + c[30], c[31], c[32], c[33], c[34], c[35], c[36], c[37], c[38], c[39], + c[40], c[41], c[42], c[43], c[44], c[45], c[46], c[47], c[48], c[49], + c[50]); + } } function update() { + + canvasToConsole(); + } function render() { diff --git a/examples/consoleBanner2.php b/examples/consoleBanner2.php new file mode 100644 index 00000000..a5463d0c --- /dev/null +++ b/examples/consoleBanner2.php @@ -0,0 +1,86 @@ + + +
+myGroup.sort("y",Group.ASCENDING) at the bottom of your
+ * State.update() override. To sort all existing objects after
+ * a big explosion or bomb attack, you might call myGroup.sort("exists",Group.DESCENDING).
+ *
+ * @param {string} index The string name of the member variable you want to sort on. Default value is "z".
+ * @param {number} order A Group constant that defines the sort order. Possible values are Group.ASCENDING and Group.DESCENDING. Default value is Group.ASCENDING.
+ */
+ sort: function (index, order) {
+ // if (typeof index === "undefined") { index = 'z'; }
+ // if (typeof order === "undefined") { order = Phaser.Types.SORT_ASCENDING; }
+ // var _this = this;
+ // this._sortIndex = index;
+ // this._sortOrder = order;
+ // this.members.sort(function (a, b) {
+ // return _this.sortHandler(a, b);
+ // });
+ },
+
+ /**
+ * Helper function for the sort process.
+ *
+ * @param {Basic} Obj1 The first object being sorted.
+ * @param {Basic} Obj2 The second object being sorted.
+ *
+ * @return {number} An integer value: -1 (Obj1 before Obj2), 0 (same), or 1 (Obj1 after Obj2).
+ */
+ sortHandler: function (obj1, obj2) {
+
+ /*
+ if(!obj1 || !obj2) {
+ //console.log('null objects in sort', obj1, obj2);
+ return 0;
+ }
+ if(obj1[this._sortIndex] < obj2[this._sortIndex]) {
+ return this._sortOrder;
+ } else if(obj1[this._sortIndex] > obj2[this._sortIndex]) {
+ return -this._sortOrder;
+ }
+ return 0;
+ */
+ },
+
+ setAll: function () {
+ },
+
+ callAll: function () {
+ },
+
+ forEach: function () {
+ },
+
+ forEachAlive: function () {
+ },
+
+ forEachDead: function () {
+ },
+
+ getFirstAlive: function () {
+
+ var endNode = this._container.last._iNext;
+ var currentNode = this._container.first;
+
+ do
+ {
+ if (currentNode.alive)
+ {
+ return currentNode;
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != endNode)
+
+ },
+
+ getFirstDead: function () {
+
+ var endNode = this._container.last._iNext;
+ var currentNode = this._container.first;
+
+ do
+ {
+ if (currentNode.alive == false)
+ {
+ return currentNode;
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != endNode)
+
+ },
+
+ count: function (alive, visible) {
+
+ var endNode = this._container.last._iNext;
+ var currentNode = this._container.first;
+
+ do
+ {
+ if (currentNode.alive)
+ {
+ return currentNode;
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != endNode)
+
+ }
+
+ countLiving: function () {
+
+ var total = 0;
+ var endNode = this._container.last._iNext;
+ var currentNode = this._container.first;
+
+ do
+ {
+ if (currentNode.alive)
+ {
+ total++;
+ }
+
+ currentNode = currentNode._iNext;
+ }
+ while (currentNode != endNode);
+
+ return total;
+
+ },
+
+ countDead: function () {
+ },
+
+ getRandom: function () {
+ },
+
+ remove: function (child) {
+ },
+
+ destroy: function () {
+ }
+
+};
+
+Object.defineProperty(Phaser.World.prototype, "visible", {
+
+ get: function () {
+ return this._container.visible;
+ },
+
+ set: function (value) {
+ this._container.visible = value;
+ },
+
+ enumerable: true,
+ configurable: true
+});
diff --git a/src/core/World.js b/src/core/World.js
index 37dc96a7..e7c460e6 100644
--- a/src/core/World.js
+++ b/src/core/World.js
@@ -5,7 +5,7 @@ Phaser.World = function (game) {
this._stage = new PIXI.Stage(0x000000);
this._container = new PIXI.DisplayObjectContainer();
- this._container.name = 'R';
+ this._container.name = '_stage_root';
this._stage.addChild(this._container);
@@ -105,12 +105,12 @@ Phaser.World.prototype = {
},
- swapChildren: function (stage, child1, child2) {
+ swapChildren: function (child1, child2) {
if (child1 === child2 || !child1.parent || !child2.parent)
{
console.warn('You cannot swap a child with itself or swap un-parented children');
- return;
+ return false;
}
// Cache the values
@@ -119,8 +119,8 @@ Phaser.World.prototype = {
var child2Prev = child2._iPrev;
var child2Next = child2._iNext;
- var endNode = stage.last._iNext;
- var currentNode = stage.first;
+ var endNode = this._stage.last._iNext;
+ var currentNode = this._stage.first;
do
{
@@ -159,10 +159,12 @@ Phaser.World.prototype = {
if (child1Prev) { child1Prev._iNext = child2; }
if (child2Next) { child2Next._iPrev = child1; }
+
+ return true;
}
else if (child2._iNext == child1)
{
- // This is am upward (B to A) neighbour swap
+ // This is an upward (B to A) neighbour swap
child1._iNext = child2;
child1._iPrev = child2Prev;
child2._iNext = child1Next;
@@ -170,6 +172,8 @@ Phaser.World.prototype = {
if (child2Prev) { child2Prev._iNext = child1; }
if (child1Next) { child2Next._iPrev = child2; }
+
+ return true;
}
else
{
@@ -183,7 +187,12 @@ Phaser.World.prototype = {
if (child1Next) { child1Next._iPrev = child2; }
if (child2Prev) { child2Prev._iNext = child1; }
if (child2Next) { child2Next._iPrev = child1; }
+
+ return true;
}
+
+ return false;
+
}
};
diff --git a/src/physics/arcade/Body.js b/src/physics/arcade/Body.js
index 405cc3b8..fd68870c 100644
--- a/src/physics/arcade/Body.js
+++ b/src/physics/arcade/Body.js
@@ -95,7 +95,10 @@ Phaser.Physics.Arcade.Body.prototype = {
this.lastX = this.x;
this.lastY = this.y;
- this.game.physics.updateMotion(this);
+ if (this.moves)
+ {
+ this.game.physics.updateMotion(this);
+ }
this.bounds.x = this.x;
this.bounds.y = this.y;