From 65d2bf557b539d1df5be9af0eae8a9e11656a5d3 Mon Sep 17 00:00:00 2001
From: photonstorm
Date: Fri, 25 Oct 2013 17:30:37 +0100
Subject: [PATCH] Updated docs and more tidying up.
---
README.md | 162 +-
docs/Animation.js.html | 70 +-
docs/AnimationManager.js.html | 70 +-
docs/AnimationParser.js.html | 70 +-
docs/ArcadePhysics.js.html | 177 +-
docs/BitmapText.js.html | 70 +-
docs/Body.js.html | 399 +-
docs/Bullet.js.html | 70 +-
docs/Button.js.html | 70 +-
docs/Cache.js.html | 70 +-
docs/Camera.js.html | 70 +-
docs/Canvas.js.html | 70 +-
docs/Circle.js.html | 70 +-
docs/Color.js.html | 70 +-
docs/Debug.js.html | 70 +-
docs/Device.js.html | 70 +-
docs/Easing.js.html | 70 +-
docs/Emitter.js.html | 70 +-
docs/Events.js.html | 70 +-
docs/Frame.js.html | 70 +-
docs/FrameData.js.html | 70 +-
docs/Game.js.html | 70 +-
docs/GameObjectFactory.js.html | 142 +-
docs/Graphics.js.html | 70 +-
docs/Group.js.html | 70 +-
docs/Input.js.html | 70 +-
docs/InputHandler.js.html | 70 +-
docs/{Intro.js.html => IntroDocs.js.html} | 76 +-
docs/Key.js.html | 70 +-
docs/Keyboard.js.html | 70 +-
docs/LinkedList.js.html | 70 +-
docs/Loader.js.html | 70 +-
docs/LoaderParser.js.html | 70 +-
docs/MSPointer.js.html | 70 +-
docs/Math.js.html | 70 +-
docs/Mouse.js.html | 70 +-
docs/Net.js.html | 70 +-
docs/Particles.js.html | 70 +-
docs/Phaser.Animation.html | 70 +-
docs/Phaser.AnimationManager.html | 70 +-
docs/Phaser.AnimationParser.html | 70 +-
docs/Phaser.BitmapText.html | 70 +-
docs/Phaser.Bullet.html | 72 +-
docs/Phaser.Button.html | 70 +-
docs/Phaser.Cache.html | 70 +-
docs/Phaser.Camera.html | 70 +-
docs/Phaser.Canvas.html | 70 +-
docs/Phaser.Circle.html | 70 +-
docs/Phaser.Color.html | 70 +-
docs/Phaser.Device.html | 70 +-
docs/Phaser.Easing.Back.html | 70 +-
docs/Phaser.Easing.Bounce.html | 70 +-
docs/Phaser.Easing.Circular.html | 70 +-
docs/Phaser.Easing.Cubic.html | 70 +-
docs/Phaser.Easing.Elastic.html | 70 +-
docs/Phaser.Easing.Exponential.html | 70 +-
docs/Phaser.Easing.Linear.html | 70 +-
docs/Phaser.Easing.Quadratic.html | 70 +-
docs/Phaser.Easing.Quartic.html | 70 +-
docs/Phaser.Easing.Quintic.html | 70 +-
docs/Phaser.Easing.Sinusoidal.html | 70 +-
docs/Phaser.Easing.html | 70 +-
docs/Phaser.Events.html | 70 +-
docs/Phaser.Frame.html | 70 +-
docs/Phaser.FrameData.html | 70 +-
docs/Phaser.Game.html | 70 +-
docs/Phaser.GameObjectFactory.html | 3481 +++++++++++-
docs/Phaser.Graphics.html | 70 +-
docs/Phaser.Group.html | 70 +-
docs/Phaser.Input.html | 70 +-
docs/Phaser.InputHandler.html | 70 +-
docs/Phaser.Key.html | 70 +-
docs/Phaser.Keyboard.html | 70 +-
docs/Phaser.LinkedList.html | 70 +-
docs/Phaser.Loader.html | 70 +-
docs/Phaser.LoaderParser.html | 70 +-
docs/Phaser.MSPointer.html | 70 +-
docs/Phaser.Math.html | 70 +-
docs/Phaser.Mouse.html | 70 +-
docs/Phaser.Net.html | 70 +-
docs/Phaser.Particles.Arcade.Emitter.html | 70 +-
docs/Phaser.Particles.html | 70 +-
docs/Phaser.Physics.Arcade.Body.html | 6049 +++++++++++++++++++++
docs/Phaser.Physics.Arcade.html | 2154 ++++++--
docs/Phaser.Physics.html | 70 +-
docs/Phaser.Plugin.html | 70 +-
docs/Phaser.PluginManager.html | 70 +-
docs/Phaser.Point.html | 70 +-
docs/Phaser.Pointer.html | 70 +-
docs/Phaser.QuadTree.html | 70 +-
docs/Phaser.RandomDataGenerator.html | 70 +-
docs/Phaser.Rectangle.html | 70 +-
docs/Phaser.RenderTexture.html | 70 +-
docs/Phaser.RequestAnimationFrame.html | 70 +-
docs/Phaser.Signal.html | 70 +-
docs/Phaser.Sound.html | 70 +-
docs/Phaser.SoundManager.html | 70 +-
docs/Phaser.Sprite.html | 72 +-
docs/Phaser.Stage.html | 70 +-
docs/Phaser.StageScaleMode.html | 70 +-
docs/Phaser.State.html | 70 +-
docs/Phaser.StateManager.html | 70 +-
docs/Phaser.Text.html | 70 +-
docs/Phaser.TileSprite.html | 70 +-
docs/Phaser.Time.html | 70 +-
docs/Phaser.Touch.html | 70 +-
docs/Phaser.Tween.html | 70 +-
docs/Phaser.TweenManager.html | 70 +-
docs/Phaser.Utils.Debug.html | 70 +-
docs/Phaser.Utils.html | 70 +-
docs/Phaser.World.html | 70 +-
docs/Phaser.html | 70 +-
docs/Phaser.js.html | 70 +-
docs/Plugin.js.html | 70 +-
docs/PluginManager.js.html | 70 +-
docs/Point.js.html | 70 +-
docs/Pointer.js.html | 70 +-
docs/QuadTree.js.html | 70 +-
docs/RandomDataGenerator.js.html | 70 +-
docs/Rectangle.js.html | 70 +-
docs/RenderTexture.js.html | 70 +-
docs/RequestAnimationFrame.js.html | 70 +-
docs/Signal.js.html | 70 +-
docs/SignalBinding.html | 70 +-
docs/SignalBinding.js.html | 70 +-
docs/Sound.js.html | 70 +-
docs/SoundManager.js.html | 70 +-
docs/Sprite.js.html | 70 +-
docs/Stage.js.html | 70 +-
docs/StageScaleMode.js.html | 70 +-
docs/State.js.html | 70 +-
docs/StateManager.js.html | 70 +-
docs/Text.js.html | 70 +-
docs/TileSprite.js.html | 70 +-
docs/Time.js.html | 70 +-
docs/Touch.js.html | 70 +-
docs/Tween.js.html | 70 +-
docs/TweenManager.js.html | 70 +-
docs/Utils.js.html | 70 +-
docs/World.js.html | 70 +-
docs/build/conf.json | 5 +-
docs/build/conf_dev.json | 2 +-
docs/classes.list.html | 73 +-
docs/global.html | 3447 +-----------
docs/index.html | 76 +-
docs/namespaces.list.html | 73 +-
src/IntroDocs.js | 29 +
src/gameobjects/GameObjectFactory.js | 72 +-
src/physics/arcade/ArcadePhysics.js | 2 -
src/tilemap_old/Tile.js | 183 -
src/tilemap_old/Tilemap.js | 530 --
src/tilemap_old/TilemapLayer.js | 662 ---
src/tilemap_old/TilemapRenderer.js | 239 -
153 files changed, 12355 insertions(+), 14922 deletions(-)
rename docs/{Intro.js.html => IntroDocs.js.html} (87%)
create mode 100644 docs/Phaser.Physics.Arcade.Body.html
create mode 100644 src/IntroDocs.js
delete mode 100644 src/tilemap_old/Tile.js
delete mode 100644 src/tilemap_old/Tilemap.js
delete mode 100644 src/tilemap_old/TilemapLayer.js
delete mode 100644 src/tilemap_old/TilemapRenderer.js
diff --git a/README.md b/README.md
index e9241f63..c403ab76 100644
--- a/README.md
+++ b/README.md
@@ -32,81 +32,32 @@ As before we offer a heart-felt "Thank you!" to everyone who has encouraged us a
Phaser is everything we ever wanted from an HTML5 game framework. It powers all of our client work in build today and remains our single most important product, and we've only just scratched the surface of what we have planned for it.
-
-(swap for tanks)
+
Change Log
----------
Version 1.1
+What's New:
+
* JSDoc is go! We've added jsdoc3 blocks to every property and function, in every file.
* Brand new Example system (no more php!) and over 150 examples to learn from too.
* New TypeScript definitions file generated (in the build folder - thanks to TomTom1229 for manually enhancing this).
* New Grunt based build system added (thanks to Florent Cailhol)
-
-* Added World.postUpdate - all sprite position changes, as a result of physics, happen here before the render.
-* Complete overhaul of Physics.Arcade.Body - now significantly more stable and faster too.
-* Updated ArcadePhysics.separateX/Y to use new body system - much better results now.
-* QuadTree bug found in 1.0.5 now fixed. The QuadTree is updated properly now using localTransform values.
-* Fixed the Bounce.In and Bounce.InOut tweens (thanks XekeDeath)
-* Renamed Phaser.Text.text to Phaser.Text.content to avoid conflict and overwrite from Pixi local var.
-* Renamed Phaser.Text.style to Phaser.Text.font to avoid conflict and overwrite from Pixi local var.
-* Phaser.Button now sets useHandCursor to true by default.
-* Fixed an issue in Animation.update where if the game was paused it would get an insane delta timer throwing a uuid error.
-* Added PixiPatch.js to patch in a few essential features until Pixi is updated.
-* Fixed issue in Animation.play where the given frameRate and loop values wouldn't overwrite those set on construction.
-* Added Animation.paused - can be set to true/false.
* New: Phaser.Animation.generateFrameNames - really useful when creating animation data from texture atlases using file names, not indexes.
* Added Sprite.play as a handy short-cut to play an animation already loaded onto a Sprite.
-* Fixed small bug stopping Tween.pause / resume from resuming correctly when called directly.
-* Fixed an issue where Tweens.removeAll wasn't clearing tweens in the addition queue.
-* Change: When you start a new State all active tweens are now purged.
-* BUG: Loader conflict if 2 keys are the same even if they are in different packages (i.e. you can't use "title" for both and image and sound file).
-* Fixed Particle Emitters when using Emitter width/height (thanks XekeDeath)
-* Made animation looping more robust when skipping frames (thanks XekeDeath)
-* Fix for incorrect new particle positioning (issue #73) (thanks cottonflop)
-* Added support for Body.maxVelocity (thanks cocoademon)
-* Fixed issue in Sound.play where if you gave a missing marker it would play the whole sound sprite instead.
-* Button.setFrames will set the current frame based on the button state immediately.
-* InputHandler now creates the _pointerData array on creation and populates with one empty set of values, so pointerOver etc all work before a start call.
* Added Canvas.setUserSelect() to disable touchCallouts and user selections within the canvas.
-* When the game boots it will now by default disable user-select and touch action events on the game canvas.
-* Loaded.setPreloadSprite now rounds the width/height values and starts from 1. This fixes canvas draw errors in IE9/10 and Firefox.
-* Fixed issue causing Keyboard.justPressed to always fire (thanks stemkoski)
* Added Keyboard.addKey() which creates a new Phaser.Key object that can be polled for updates, pressed states, etc. See the 2 new examples showing use.
-* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
-* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child.
-* Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
-* Fixed bug in LinkedList#remove that could cause first to point to a dead node (thanks onedayitwillmake)
-* Moved LinkedList.dump to Debug.dumpLinkedList(list)
* Added Button.freezeFrames boolean. Stops the frames being set on mouse events if true.
-* Phaser.Animation.Frame is now Phaser.Frame
-* Phaser.Animation.FrameData is now Phaser.FrameData
-* Phaser.Animation.Parser is now Phaser.AnimationParser (also the file has renamed from Parser.js to AnimationParser.js)
-* Phaser.Loader.Parser is now Phaser.LoaderParser (also the file has renamed from Parser.js to LoaderParser.js)
-* Fixed Cache.addDefaultImage so the default image works in Canvas as well as WebGL. Updated to a new image (32x32 black square with green outline)
* Extended the Loader 404 error to display the url of the file that didn't load as well as the key.
-* Change: We've removed the scrollFactor property from all Game Objects. Sorry, but the new Camera system doesn't work with it and it caused all kinds of issues anyway. We will sort out a replacement for it at a later date.
-* Change: World now extends Phaser.Group. As a result we've updated GameObjectFactory and other classes that linked to it. If you have anywhere in your code that used to reference world.group you can just remove 'group' from that. So before, world.group.add() is now just world.add().
-* Change: The Camera has been completely revamped. Rather than adjusting the position of all display objects (bad) it now just shifts the position of the single world container (good!), this is much quicker and also stops the game objects positions from self-adjusting all the time, allowing for them to be properly nested with other containers.
* New: Direction constants have been added to Sprites and adjust based on body motion.
-* World.randomX/Y now returns values anywhere in the world.bounds range (if set, otherwise 0), including negative values.
-* Fixed a bug in the Sprite transform cache check that caused the skew/scale cache to get constantly invalidated - now only updates as needed, significant performance increase!
* Brand new Sprite.update loop handler. Combined with the transform cache fix and further optimisations this is now much quicker to execute.
-* Made Sprite.body optional and added in checks, so you can safely null the Sprite body object if using your own physics system and not impact rendering.
-* Fixed typo in StageScaleMode so it's not pageAlignVeritcally any longer, but pageAlignVertically.
-* Fixed issue in Group.countLiving / countDead where the value was off by one (thanks mjablonski)
-* Fixed issue with a jittery Camera if you moved a Sprite via velocity instead of x/y placement.
* Added Keyboard.createCursorKeys() which creates an object with 4 Key objects inside it mapped to up, down, left and right. See the new example in the input folder.
* Added Body.skipQuadTree boolean for more fine-grained control over when a body is added to the World QuadTree.
* Re-implemented Angular Velocity and Angular Acceleration on the Sprite.body and created 2 new examples to show use.
-* Moved the Camera update checks to World.postUpdate, so all the sprites get the correct adjusted camera position.
* Added Sprite.fixedToCamera boolean. A Sprite that is fixed to the camera doesn't move with the world, but has its x/y coordinates relative to the top-left of the camera.
-* Updated InputHandler to use Math.round rather than Math.floor when snapping an object during drag.
-* If you didn't provide the useNumericIndex parameter then AnimationManager.add will set the value by looking at the datatype of the first element in the frames array.
* Added Group.createMultiple - useful when you need to create a Group of identical sprites for pooling, such as bullets.
-* Group.create now sets the visible and alive properties of the Sprite to the same value as the 'exists' parameter.
* Added Group.total. Same as Group.length, but more in line with the rest of the Group naming.
* Added Sprite.outOfBoundsKill boolean flag. Will automatically kill a sprite that leaves the game World bounds (off by default).
* Lots of changes and fixes in ArcadePhysics, including:
@@ -116,48 +67,108 @@ Version 1.1
* New distance functions: distanceBetween, distanceToXY, distanceToPointer
* New angle functions: angleBetween, angleToXY, angleToPointer
* velocityFromAngle and velocityFromRotation added with examples created.
-* Fixed the RandomDataGenerator.sow method so if you give in the same seed you'll now get the same results (thanks Hsaka)
-* World.randomX/Y now works with negative World.bounds values.
* Added killOnComplete parameter to Animation.play. Really useful in situations where you want a Sprite to animate once then kill itself on complete, like an explosion effect.
* Added Sprite.loadTexture(key, frame) which allows you to load a new texture set into an existing sprite rather than having to create a new sprite.
-* Tweens .to will now always return the parent (thanks powerfear)
-* You can now pass a PIXI.Texture to Sprite (you also need to pass a Phaser.Frame as the frame parameter) but this is useful for Sprites sharing joint canvases.
-* Fixed Issue #101 (Mouse Button 0 is not recognised, thanks rezoner)
* Added Sprite.destroy back in again and made it a lot more robust at cleaning up child objects.
* Added 'return this' to all the core Loader functions so you can chain load calls if you so wish.
-* Group.alpha is now exposed publically and changes the Group container object (not the children directly, who can still have their own alpha values)
-* Device.webGL uses new inspection code to accurately catch more webGL capable devices.
-* Fixed an issue where creating an animation with just one frame with an index of zero would cause a UUID error (thanks SYNYST3R1)
-* Fixed Rectangle.union (thanks andron77)
-* Debug.renderSpriteBody updated to use a the new Sprite.Body.screenX/Y properties.
* Added Text.destroy() and BitmapText.destroy(), also updated Group.remove to make it more bullet-proof when an element doesn't have any events.
* Added Phaser.Utils.shuffle to shuffle an array.
* Added Graphics.destroy, x, y and updated angle functions.
-* Additional checks added to AnimationManager.frame/frameName on the given values.
* Added AnimationManager.refreshFrame - will reset the texture being used for a Sprite (useful after a crop rect clear)
-* You can now null a Sprite.crop and it will clear down the crop rect area correctly.
-* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils.
* Added Physics.overlap(sprite1, sprite2) for quick body vs. body overlap tests with no separation performed.
-* Fixed Issue 111 - calling Kill on a Phaser.Graphics instance causes error on undefined events.
+* On a busy page it's possible for the game to boot with an incorrect stage offset x/y which can cause input events to be calculated wrong. A new property has been added to Stage to combat this issue: Stage.checkOffsetInterval. By default it will check the canvas offset every 2500ms and adjust it accordingly. You can set the value to 'false' to disable the check entirely, or set a higher or lower value. We recommend that you get the value quite low during your games preloader, but once the game has fully loaded hopefully the containing page will have settled down, so it's probably safe to disable the check entirely.
+* Added Rectangle.floorAll to floor all values in a Rectangle (x, y, width and height).
+
+What's changed:
+
+* Renamed Phaser.Text.text to Phaser.Text.content to avoid conflict and overwrite from Pixi local var.
+* Renamed Phaser.Text.style to Phaser.Text.font to avoid conflict and overwrite from Pixi local var.
+* Phaser.Button now sets useHandCursor to true by default.
+* Change: When you start a new State all active tweens are now purged.
+* When the game boots it will now by default disable user-select and touch action events on the game canvas.
+* Moved LinkedList.dump to Debug.dumpLinkedList(list)
+* Phaser.Animation.Frame is now Phaser.Frame
+* Phaser.Animation.FrameData is now Phaser.FrameData
+* Phaser.Animation.Parser is now Phaser.AnimationParser (also the file has renamed from Parser.js to AnimationParser.js)
+* Phaser.Loader.Parser is now Phaser.LoaderParser (also the file has renamed from Parser.js to LoaderParser.js)
+* Change: We've removed the scrollFactor property from all Game Objects. Sorry, but the new Camera system doesn't work with it and it caused all kinds of issues anyway. We will sort out a replacement for it at a later date.
+* Change: World now extends Phaser.Group. As a result we've updated GameObjectFactory and other classes that linked to it. If you have anywhere in your code that used to reference world.group you can just remove 'group' from that. So before, world.group.add() is now just world.add().
+* Change: The Camera has been completely revamped. Rather than adjusting the position of all display objects (bad) it now just shifts the position of the single world container (good!), this is much quicker and also stops the game objects positions from self-adjusting all the time, allowing for them to be properly nested with other containers.
+* Made Sprite.body optional and added in checks, so you can safely null the Sprite body object if using your own physics system and not impact rendering.
+* Moved the Camera update checks to World.postUpdate, so all the sprites get the correct adjusted camera position.
+* The default Game.antialias value is now 'true', so graphics will be smoothed automatically in canvas. Disable it via the Game constructor or Canvas utils.
* Phaser.Group now automatically calls updateTransform on any child added to it (avoids temp. frame glitches when new objects are rendered on their first frame).
+
+What has been updated:
+
+* Complete overhaul of Physics.Arcade.Body - now significantly more stable and faster too.
+* Updated ArcadePhysics.separateX/Y to use new body system - much better results now.
+* Added World.postUpdate - all sprite position changes, as a result of physics, happen here before the render.
+* Added Animation.paused - can be set to true/false.
+* Added support for Body.maxVelocity (thanks cocoademon)
+* InputHandler now creates the _pointerData array on creation and populates with one empty set of values, so pointerOver etc all work before a start call.
+* Removed the callbackContext parameter from Group.callAll because it's no longer needed.
+* Updated Group.forEach, forEachAlive and forEachDead so you can now pass as many parameters as you want, which will all be given to the callback after the child.
+* Updated build script so it can be run from the command-line and includes UMD wrappers (thanks iaincarsberg)
+* World.randomX/Y now returns values anywhere in the world.bounds range (if set, otherwise 0), including negative values.
+* Updated InputHandler to use Math.round rather than Math.floor when snapping an object during drag.
+* If you didn't provide the useNumericIndex parameter then AnimationManager.add will set the value by looking at the datatype of the first element in the frames array.
+* Group.create now sets the visible and alive properties of the Sprite to the same value as the 'exists' parameter.
+* World.randomX/Y now works with negative World.bounds values.
+* Tweens .to will now always return the parent (thanks powerfear)
+* You can now pass a PIXI.Texture to Sprite (you also need to pass a Phaser.Frame as the frame parameter) but this is useful for Sprites sharing joint canvases.
+* Group.alpha is now exposed publically and changes the Group container object (not the children directly, who can still have their own alpha values)
+* Device.webGL uses new inspection code to accurately catch more webGL capable devices.
+* Debug.renderSpriteBody updated to use a the new Sprite.Body.screenX/Y properties.
+* Additional checks added to AnimationManager.frame/frameName on the given values.
+* You can now null a Sprite.crop and it will clear down the crop rect area correctly.
* Phaser.Time physicsElapsed delta timer clamp added. Stops rogue iOS / slow mobile timer errors causing crazy high deltas.
* Animation.generateFrameNames can now work in reverse, so the start/stop values can create frames that increment or decrement respectively.
* Loader updated to use xhr.responseText when loading json, csv or text files. xhr.response is still used for Web Audio binary files (thanks bubba)
* Input.onDown and onUp events now dispatch the original event that triggered them (i.e. a MouseEvent or TouchEvent) as the 2nd parameter, after the Pointer (thanks rezoner)
-* Game.destroy will now stop the raf from running as well as close down all input related event listeners (issue 92, thanks astrism)
-* Fixed issue 105 where a dragged object that was destroyed would cause an Input error (thanks onedayitwillmake)
* Updated Sprite.crop significantly. Values are now cached, stopping constant Texture frame updates and you can do sprite.crop.width++ for example (thanks haden)
* Change: Sprite.crop needs to be enabled with sprite.cropEnabled = true.
-* Added Rectangle.floorAll to floor all values in a Rectangle (x, y, width and height).
-* Fixed Sound.resume so it now correctly resumes playback from the point it was paused (fixes issue 51, thanks Yora).
* Sprite.loadTexture now works correctly with static images, RenderTextures and Animations.
* Lots of fixes within Sprite.bounds. The bounds is now correct regardless of rotation, anchor or scale of the Sprite or any of its parent objects.
-* On a busy page it's possible for the game to boot with an incorrect stage offset x/y which can cause input events to be calculated wrong. A new property has been added to Stage to combat this issue: Stage.checkOffsetInterval. By default it will check the canvas offset every 2500ms and adjust it accordingly. You can set the value to 'false' to disable the check entirely, or set a higher or lower value. We recommend that you get the value quite low during your games preloader, but once the game has fully loaded hopefully the containing page will have settled down, so it's probably safe to disable the check entirely.
+
+What has been fixed:
+
+* QuadTree bug found in 1.0.5 now fixed. The QuadTree is updated properly now using localTransform values.
+* Fixed the Bounce.In and Bounce.InOut tweens (thanks XekeDeath)
+* Fixed an issue in Animation.update where if the game was paused it would get an insane delta timer throwing a uuid error.
+* Added PixiPatch.js to patch in a few essential features until Pixi is updated.
+* Fixed issue in Animation.play where the given frameRate and loop values wouldn't overwrite those set on construction.
+* Fixed small bug stopping Tween.pause / resume from resuming correctly when called directly.
+* Fixed an issue where Tweens.removeAll wasn't clearing tweens in the addition queue.
+* Fixed Particle Emitters when using Emitter width/height (thanks XekeDeath)
+* Made animation looping more robust when skipping frames (thanks XekeDeath)
+* Fix for incorrect new particle positioning (issue #73) (thanks cottonflop)
+* Fixed issue in Sound.play where if you gave a missing marker it would play the whole sound sprite instead.
+* Button.setFrames will set the current frame based on the button state immediately.
+* Loaded.setPreloadSprite now rounds the width/height values and starts from 1. This fixes canvas draw errors in IE9/10 and Firefox.
+* Fixed issue causing Keyboard.justPressed to always fire (thanks stemkoski)
+* Fixed bug in LinkedList#remove that could cause first to point to a dead node (thanks onedayitwillmake)
+* Fixed Cache.addDefaultImage so the default image works in Canvas as well as WebGL. Updated to a new image (32x32 black square with green outline)
+* Fixed a bug in the Sprite transform cache check that caused the skew/scale cache to get constantly invalidated - now only updates as needed, significant performance increase!
+* Fixed typo in StageScaleMode so it's not pageAlignVeritcally any longer, but pageAlignVertically.
+* Fixed issue in Group.countLiving / countDead where the value was off by one (thanks mjablonski)
+* Fixed issue with a jittery Camera if you moved a Sprite via velocity instead of x/y placement.
+* Fixed the RandomDataGenerator.sow method so if you give in the same seed you'll now get the same results (thanks Hsaka)
+* Fixed Issue #101 (Mouse Button 0 is not recognised, thanks rezoner)
+* Fixed an issue where creating an animation with just one frame with an index of zero would cause a UUID error (thanks SYNYST3R1)
+* Fixed Rectangle.union (thanks andron77)
+* Fixed Sound.resume so it now correctly resumes playback from the point it was paused (fixes issue 51, thanks Yora).
+* Fixed issue 105 where a dragged object that was destroyed would cause an Input error (thanks onedayitwillmake)
+* Fixed Issue 111 - calling Kill on a Phaser.Graphics instance causes error on undefined events.
+* Game.destroy will now stop the raf from running as well as close down all input related event listeners (issue 92, thanks astrism)
* Pixel Perfect click detection now works even if the Sprite is part of a texture atlas.
+
+
Outstanding Tasks
-----------------
+* TODY: Loader conflict if 2 keys are the same even if they are in different packages (i.e. you can't use "title" for both and image and sound file).
* TODO: d-pad example (http://www.html5gamedevs.com/topic/1574-gameinputondown-question/)
* TODO: more touch input examples (http://www.html5gamedevs.com/topic/1556-mobile-touch-event/)
* TODO: Sound.addMarker hh:mm:ss:ms
@@ -165,6 +176,11 @@ Outstanding Tasks
* TODO: rotation offset
* TODO: Look at HiDPI Canvas settings
+How to Build
+------------
+
+A Grunt script has been provided that will build Phaser from source as well as the examples. Run `grunt` in the phaser folder for a list of command-line options.
+
Requirements
------------
@@ -172,7 +188,7 @@ Games created with Phaser require a modern web browser that supports the canvas
For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/) using the provided TypeScript definitions file. We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you.
-Phaser is 275 KB minified and 62 KB gzipped.
+Phaser is 281 KB minified and 66 KB gzipped.
Features
--------
@@ -242,7 +258,7 @@ We use Phaser every day on our many client projects. As a result it's constantly
Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved fast and we stay on-top of the changing browser landscape.
-
+
Road Map
--------
diff --git a/docs/Animation.js.html b/docs/Animation.js.html
index b57a3c32..eb175def 100644
--- a/docs/Animation.js.html
+++ b/docs/Animation.js.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -924,7 +864,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/AnimationManager.js.html b/docs/AnimationManager.js.html
index 3e94389f..f7d9a825 100644
--- a/docs/AnimationManager.js.html
+++ b/docs/AnimationManager.js.html
@@ -226,6 +226,10 @@
Arcade
+
Phaser.Physics.Arcade.Body = function (sprite) {
+
/**
+* @author Richard Davey <rich@photonstorm.com>
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+/**
+* The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
+* the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
+*
+* @class Phaser.Physics.Arcade.Body
+* @classdesc Arcade Physics Body Constructor
+* @constructor
+* @param {Phaser.Sprite} sprite - The Sprite object this physics body belongs to.
+*/
+Phaser.Physics.Arcade.Body = function (sprite) {
+
+ /**
+ * @property {Phaser.Sprite} sprite - Reference to the parent Sprite.
+ */
this.sprite = sprite;
+
+ /**
+ * @property {Phaser.Game} game - Local reference to game.
+ */
this.game = sprite.game;
+ /**
+ * @property {Phaser.Point} offset - The offset of the Physics Body from the Sprite x/y position.
+ */
this.offset = new Phaser.Point;
+ /**
+ * @property {number} x - The x position of the physics body.
+ * @readonly
+ */
this.x = sprite.x;
+
+ /**
+ * @property {number} y - The y position of the physics body.
+ * @readonly
+ */
this.y = sprite.y;
+
+ /**
+ * @property {number} preX - The previous x position of the physics body.
+ * @readonly
+ */
this.preX = sprite.x;
+
+ /**
+ * @property {number} preY - The previous y position of the physics body.
+ * @readonly
+ */
this.preY = sprite.y;
+
+ /**
+ * @property {number} preRotation - The previous rotation of the physics body.
+ * @readonly
+ */
this.preRotation = sprite.angle;
+
+ /**
+ * @property {number} screenX - The x position of the physics body translated to screen space.
+ * @readonly
+ */
this.screenX = sprite.x;
+
+ /**
+ * @property {number} screenY - The y position of the physics body translated to screen space.
+ * @readonly
+ */
this.screenY = sprite.y;
- // un-scaled original size
+ /**
+ * @property {number} sourceWidth - The un-scaled original size.
+ * @readonly
+ */
this.sourceWidth = sprite.currentFrame.sourceSizeW;
+
+ /**
+ * @property {number} sourceHeight - The un-scaled original size.
+ * @readonly
+ */
this.sourceHeight = sprite.currentFrame.sourceSizeH;
- // calculated (scaled) size
+ /**
+ * @property {number} width - The calculated width of the physics body.
+ */
this.width = sprite.currentFrame.sourceSizeW;
+
+ /**
+ * @property .numInternal ID cache
+ */
this.height = sprite.currentFrame.sourceSizeH;
+
+ /**
+ * @property {number} halfWidth - The calculated width / 2 of the physics body.
+ */
this.halfWidth = Math.floor(sprite.currentFrame.sourceSizeW / 2);
+
+ /**
+ * @property {number} halfHeight - The calculated height / 2 of the physics body.
+ */
this.halfHeight = Math.floor(sprite.currentFrame.sourceSizeH / 2);
- // Scale value cache
+ /**
+ * @property {number} _sx - Internal cache var.
+ * @private
+ */
this._sx = sprite.scale.x;
+
+ /**
+ * @property {number} _sy - Internal cache var.
+ * @private
+ */
this._sy = sprite.scale.y;
+ /**
+ * @property {Phaser.Point} velocity - The velocity in pixels per second sq. of the Body.
+ */
this.velocity = new Phaser.Point;
+
+ /**
+ * @property {Phaser.Point} acceleration - The velocity in pixels per second sq. of the Body.
+ */
this.acceleration = new Phaser.Point;
+
+ /**
+ * @property {Phaser.Point} drag - The drag applied to the motion of the Body.
+ */
this.drag = new Phaser.Point;
+
+ /**
+ * @property {Phaser.Point} gravity - A private Gravity setting for the Body.
+ */
this.gravity = new Phaser.Point;
+
+ /**
+ * @property {Phaser.Point} bounce - The elasticitiy of the Body when colliding. bounce.x/y = 1 means full rebound, bounce.x/y = 0.5 means 50% rebound velocity.
+ */
this.bounce = new Phaser.Point;
+
+ /**
+ * @property {Phaser.Point} maxVelocity - The maximum velocity in pixels per second sq. that the Body can reach.
+ * @default
+ */
this.maxVelocity = new Phaser.Point(10000, 10000);
+ /**
+ * @property {number} angularVelocity - The angular velocity in pixels per second sq. of the Body.
+ * @default
+ */
this.angularVelocity = 0;
+
+ /**
+ * @property {number} angularAcceleration - The angular acceleration in pixels per second sq. of the Body.
+ * @default
+ */
this.angularAcceleration = 0;
+
+ /**
+ * @property {number} angularDrag - The angular drag applied to the rotation of the Body.
+ * @default
+ */
this.angularDrag = 0;
+
+ /**
+ * @property {number} maxAngular - The maximum angular velocity in pixels per second sq. that the Body can reach.
+ * @default
+ */
this.maxAngular = 1000;
+
+ /**
+ * @property {number} mass - The mass of the Body.
+ * @default
+ */
this.mass = 1;
+ /**
+ * @property {boolean} skipQuadTree - If the Body is an irregular shape you can set this to true to avoid it being added to the World quad tree.
+ * @default
+ */
this.skipQuadTree = false;
+
+ /**
+ * @property {Array} quadTreeIDs - Internal ID cache.
+ * @protected
+ */
this.quadTreeIDs = [];
+
+ /**
+ * @property {number} quadTreeIndex - Internal ID cache.
+ * @protected
+ */
this.quadTreeIndex = -1;
// Allow collision
+
+ /**
+ * Set the allowCollision properties to control which directions collision is processed for this Body.
+ * For example allowCollision.up = false means it won't collide when the collision happened while moving up.
+ * @property {object} allowCollision - An object containing allowed collision.
+ */
this.allowCollision = { none: false, any: true, up: true, down: true, left: true, right: true };
+
+ /**
+ * This object is populated with boolean values when the Body collides with another.
+ * touching.up = true means the collision happened to the top of this Body for example.
+ * @property {object} touching - An object containing touching results.
+ */
this.touching = { none: true, up: false, down: false, left: false, right: false };
+
+ /**
+ * This object is populated with previous touching values from the bodies previous collision.
+ * @property {object} wasTouching - An object containing previous touching results.
+ */
this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
+
+ /**
+ * @property {number} facing - A const reference to the direction the Body is traveling or facing.
+ * @default
+ */
this.facing = Phaser.NONE;
+ /**
+ * @property {boolean} immovable - An immovable Body will not receive any impacts from other bodies.
+ * @default
+ */
this.immovable = false;
+
+ /**
+ * @property {boolean} moves - Set to true to allow the Physics system to move this Body, other false to move it manually.
+ * @default
+ */
this.moves = true;
+
+ /**
+ * @property {number} rotation - The amount the Body is rotated.
+ * @default
+ */
this.rotation = 0;
+
+ /**
+ * @property {boolean} allowRotation - Allow this Body to be rotated? (via angularVelocity, etc)
+ * @default
+ */
this.allowRotation = true;
+
+ /**
+ * @property {boolean} allowGravity - Allow this Body to be influenced by the global Gravity?
+ * @default
+ */
this.allowGravity = true;
- // These two flags allow you to disable the custom separation that takes place
- // Used in combination with your own collision processHandler you can create whatever
- // type of collision response you need.
+ /**
+ * This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
+ * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
+ * @property {boolean} customSeparateX - Use a custom separation system or the built-in one?
+ * @default
+ */
this.customSeparateX = false;
+
+ /**
+ * This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
+ * Used in combination with your own collision processHandler you can create whatever type of collision response you need.
+ * @property {boolean} customSeparateY - Use a custom separation system or the built-in one?
+ * @default
+ */
this.customSeparateY = false;
- // When this body collides with another the amount of overlap is stored in here
- // These values are useful if you want to provide your own custom separation logic.
+ /**
+ * When this body collides with another, the amount of overlap is stored here.
+ * @property {number} overlapX - The amount of horizontal overlap during the collision.
+ */
this.overlapX = 0;
+
+ /**
+ * When this body collides with another, the amount of overlap is stored here.
+ * @property {number} overlapY - The amount of vertical overlap during the collision.
+ */
this.overlapY = 0;
+ /**
+ * @property {Phaser.Rectangle} hullX - The dynamically calculated hull used during collision.
+ */
this.hullX = new Phaser.Rectangle();
+
+ /**
+ * @property {Phaser.Rectangle} hullY - The dynamically calculated hull used during collision.
+ */
this.hullY = new Phaser.Rectangle();
- // If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true
+ /**
+ * If a body is overlapping with another body, but neither of them are moving (maybe they spawned on-top of each other?) this is set to true.
+ * @property {boolean} embedded - Body embed value.
+ */
this.embedded = false;
+ /**
+ * A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
+ * @property {boolean} collideWorldBounds - Should the Body collide with the World bounds?
+ */
this.collideWorldBounds = false;
};
Phaser.Physics.Arcade.Body.prototype = {
+ /**
+ * Internal method.
+ *
+ * @method Phaser.Physics.Arcade#updateBounds
+ * @protected
+ */
updateBounds: function (centerX, centerY, scaleX, scaleY) {
if (scaleX != this._sx || scaleY != this._sy)
@@ -536,6 +710,12 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Internal method.
+ *
+ * @method Phaser.Physics.Arcade#preUpdate
+ * @protected
+ */
preUpdate: function () {
// Store and reset collision flags
@@ -574,8 +754,7 @@ Phaser.Physics.Arcade.Body.prototype = {
this.checkWorldBounds();
}
- this.updateHulls();
- }
+ this.updateHulls();Array }
if (this.skipQuadTree == false && this.allowCollision.none == false && this.sprite.visible && this.sprite.alive)
{
@@ -586,6 +765,12 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Internal method.
+ *
+ * @method Phaser.Physics.Arcade#postUpdate
+ * @protected
+ */
postUpdate: function () {
// Calculate forward-facing edge
@@ -626,6 +811,12 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Internal method.
+ *
+ * @method Phaser.Physics.Arcade#updateHulls
+ * @protected
+ */
updateHulls: function () {
this.hullX.setTo(this.x, this.preY, this.width, this.height);
@@ -633,6 +824,12 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Internal method.
+ *
+ * @method Phaser.Physics.Arcade#checkWorldBounds
+ * @protected
+ */
checkWorldBounds: function () {
if (this.x < this.game.world.bounds.x)
@@ -659,6 +856,17 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * You can modify the size of the physics Body to be any dimension you need.
+ * So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
+ * is the position of the Body relative to the top-left of the Sprite.
+ *
+ * @method Phaser.Physics.Arcade#setSize
+ * @param {number} width - The width of the Body.
+ * @param {number} height - The height of the Body.
+ * @param {number} offsetX - The X offset of the Body from the Sprite position.
+ * @param {number} offsetY - The Y offset of the Body from the Sprite position.
+ */
setSize: function (width, height, offsetX, offsetY) {
offsetX = offsetX || this.offset.x;
@@ -674,6 +882,11 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Resets all Body values (velocity, acceleration, rotation, etc)
+ *
+ * @method Phaser.Physics.Arcade#reset
+ */
reset: function () {
this.velocity.setTo(0, 0);
@@ -691,18 +904,42 @@ Phaser.Physics.Arcade.Body.prototype = {
},
+ /**
+ * Returns the absolute delta x value.
+ *
+ * @method Phaser.Physics.Arcade.Body#deltaAbsX
+ * @return {number} The absolute delta value.
+ */
deltaAbsX: function () {
return (this.deltaX() > 0 ? this.deltaX() : -this.deltaX());
},
+ /**
+ * Returns the absolute delta y value.
+ *
+ * @method Phaser.Physics.Arcade.Body#deltaAbsY
+ * @return {number} The absolute delta value.
+ */
deltaAbsY: function () {
return (this.deltaY() > 0 ? this.deltaY() : -this.deltaY());
},
+ /**
+ * Returns the delta x value.
+ *
+ * @method Phaser.Physics.Arcade.Body#deltaX
+ * @return {number} The delta value.
+ */
deltaX: function () {
return this.x - this.preX;
},
+ /**
+ * Returns the delta y value.
+ *
+ * @method Phaser.Physics.Arcade.Body#deltaY
+ * @return {number} The delta value.
+ */
deltaY: function () {
return this.y - this.preY;
},
@@ -713,6 +950,10 @@ Phaser.Physics.Arcade.Body.prototype = {
};
+/**
+* @name Phaser.Physics.Arcade.Body#bottom
+* @property {number} bottom - The bottom value of this Body (same as Body.y + Body.height)
+*/
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
/**
@@ -744,6 +985,10 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "bottom", {
});
+/**
+* @name Phaser.Physics.Arcade.Body#right
+* @property {number} right - The right value of this Body (same as Body.x + Body.width)
+*/
Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
/**
@@ -797,7 +1042,7 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "right", {
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Bullet.js.html b/docs/Bullet.js.html
index 7d551922..fcae3569 100644
--- a/docs/Bullet.js.html
+++ b/docs/Bullet.js.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -448,7 +388,7 @@
*/
/**
-* Description.
+* The Game Object Factory is a quick way to create all of the different sorts of core objects that Phaser uses.
*
* @class Phaser.GameObjectFactory
* @constructor
@@ -471,20 +411,8 @@ Phaser.GameObjectFactory = function (game) {
Phaser.GameObjectFactory.prototype = {
/**
- * @property {Phaser.Game} game - A reference to the currently running Game.
- * @default
- */
- game: null,
-
- /**
- * @property {Phaser.World} world - A reference to the game world.
- * @default
- */
- world: null,
-
- /**
- * Description.
- * @method existing.
+ * Adds an existing object to the game world.
+ * @method Phaser.GameObjectFactory#existing
* @param {*} object - An instance of Phaser.Sprite, Phaser.Button or any other display object..
* @return {*} The child that was added to the Group.
*/
@@ -497,7 +425,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a new Sprite with specific position and sprite sheet key.
*
- * @method sprite
+ * @method Phaser.GameObjectFactory#sprite
* @param {number} x - X position of the new sprite.
* @param {number} y - Y position of the new sprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
@@ -513,7 +441,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
*
- * @method child
+ * @method Phaser.GameObjectFactory#child
* @param {Phaser.Group} group - The Group to add this child to.
* @param {number} x - X position of the new sprite.
* @param {number} y - Y position of the new sprite.
@@ -530,7 +458,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
*
- * @method tween
+ * @method Phaser.GameObjectFactory#tween
* @param {object} obj - Object the tween will be run on.
* @return {Phaser.Tween} Description.
*/
@@ -543,7 +471,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
*
- * @method group
+ * @method Phaser.GameObjectFactory#group
* @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @return {Phaser.Group} The newly created group.
@@ -557,7 +485,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new instance of the Sound class.
*
- * @method audio
+ * @method Phaser.GameObjectFactory#audio
* @param {string} key - The Game.cache key of the sound that this object will use.
* @param {number} volume - The volume at which the sound will be played.
* @param {boolean} loop - Whether or not the sound will loop.
@@ -572,7 +500,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new <code>TileSprite</code>.
*
- * @method tileSprite
+ * @method Phaser.GameObjectFactory#tileSprite
* @param {number} x - X position of the new tileSprite.
* @param {number} y - Y position of the new tileSprite.
* @param {number} width - the width of the tilesprite.
@@ -590,7 +518,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new <code>Text</code>.
*
- * @method text
+ * @method Phaser.GameObjectFactory#text
* @param {number} x - X position of the new text object.
* @param {number} y - Y position of the new text object.
* @param {string} text - The actual text that will be written.
@@ -606,7 +534,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new <code>Button</code> object.
*
- * @method button
+ * @method Phaser.GameObjectFactory#button
* @param {number} [x] X position of the new button object.
* @param {number} [y] Y position of the new button object.
* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
@@ -626,7 +554,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new <code>Graphics</code> object.
*
- * @method graphics
+ * @method Phaser.GameObjectFactory#graphics
* @param {number} x - X position of the new graphics object.
* @param {number} y - Y position of the new graphics object.
* @return {Phaser.Graphics} The newly created graphics object.
@@ -642,7 +570,7 @@ Phaser.GameObjectFactory.prototype = {
* continuous effects like rain and fire. All it really does is launch Particle objects out
* at set intervals, and fixes their positions and velocities accorindgly.
*
- * @method emitter
+ * @method Phaser.GameObjectFactory#emitter
* @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
* @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
* @param {number} [maxParticles=50] - The total number of particles in this emitter.
@@ -657,7 +585,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* * Create a new <code>BitmapText</code>.
*
- * @method bitmapText
+ * @method Phaser.GameObjectFactory#bitmapText
* @param {number} x - X position of the new bitmapText object.
* @param {number} y - Y position of the new bitmapText object.
* @param {string} text - The actual text that will be written.
@@ -671,9 +599,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
+ * Creates a new Tilemap object.
*
- * @method tilemap
+ * @method Phaser.GameObjectFactory#tilemap
* @param {string} key - Asset key for the JSON file.
* @return {Phaser.Tilemap} The newly created tilemap object.
*/
@@ -684,9 +612,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
+ * Creates a new Tileset object.
*
- * @method tileset
+ * @method Phaser.GameObjectFactory#tileset
* @param {string} key - The image key as defined in the Game.Cache to use as the tileset.
* @return {Phaser.Tileset} The newly created tileset object.
*/
@@ -697,15 +625,15 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
- *
- * @method tilemaplayer
- * @param {number} x - X position of the new tilemapLayer.
- * @param {number} y - Y position of the new tilemapLayer.
- * @param {number} width - the width of the tilemapLayer.
- * @param {number} height - the height of the tilemapLayer.
- * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
- */
+ * Creates a new Tilemap Layer object.
+ *
+ * @method Phaser.GameObjectFactory#tilemapLayer
+ * @param {number} x - X position of the new tilemapLayer.
+ * @param {number} y - Y position of the new tilemapLayer.
+ * @param {number} width - the width of the tilemapLayer.
+ * @param {number} height - the height of the tilemapLayer.
+ * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
+ */
tilemapLayer: function (x, y, width, height, tileset, tilemap, layer) {
return this.world.add(new Phaser.TilemapLayer(this.game, x, y, width, height, tileset, tilemap, layer));
@@ -713,9 +641,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * A dynamic initially blank canvas to which images can be drawn
+ * A dynamic initially blank canvas to which images can be drawn.
*
- * @method renderTexture
+ * @method Phaser.GameObjectFactory#renderTexture
* @param {string} key - Asset key for the render texture.
* @param {number} width - the width of the render texture.
* @param {number} height - the height of the render texture.
@@ -729,7 +657,7 @@ Phaser.GameObjectFactory.prototype = {
return texture;
- },
+ }
};
@@ -752,7 +680,7 @@ Phaser.GameObjectFactory.prototype = {
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Graphics.js.html b/docs/Graphics.js.html
index 332169a9..b8fc6189 100644
--- a/docs/Graphics.js.html
+++ b/docs/Graphics.js.html
@@ -226,6 +226,10 @@
Arcade
+
The Physics Body is linked to a single Sprite. All physics operations should be performed against the body rather than
+the Sprite itself. For example you can set the velocity, acceleration, bounce values etc all on the Body.
Set the allowCollision properties to control which directions collision is processed for this Body.
+For example allowCollision.up = false means it won't collide when the collision happened while moving up.
A Body can be set to collide against the World bounds automatically and rebound back into the World if this is set to true. Otherwise it will leave the World.
This flag allows you to disable the custom x separation that takes place by Physics.Arcade.separate.
+Used in combination with your own collision processHandler you can create whatever type of collision response you need.
+
+
+
+
+
+
+
+
+
+
Properties:
+
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
customSeparateX
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
Use a custom separation system or the built-in one?
This flag allows you to disable the custom y separation that takes place by Physics.Arcade.separate.
+Used in combination with your own collision processHandler you can create whatever type of collision response you need.
+
+
+
+
+
+
+
+
+
+
Properties:
+
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
customSeparateY
+
+
+
+
+
+boolean
+
+
+
+
+
+
+
+
+
+
Use a custom separation system or the built-in one?
This object is populated with boolean values when the Body collides with another.
+touching.up = true means the collision happened to the top of this Body for example.
@@ -4806,7 +5717,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -4829,7 +5740,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -4871,7 +5782,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
@@ -5462,7 +6373,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -5485,7 +6396,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -5527,7 +6438,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
@@ -5626,7 +6537,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -5649,7 +6560,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -5691,7 +6602,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
@@ -5737,6 +6648,333 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
+
+
+
+
+
+
setSize(width, height, offsetX, offsetY)
+
+
+
+
+
+
+
+
You can modify the size of the physics Body to be any dimension you need.
+So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
+is the position of the Body relative to the top-left of the Sprite.
+
+
+
+
+
+
+
+
+
Parameters:
+
+
+
+
+
+
+
Name
+
+
+
Type
+
+
+
+
+
+
Description
+
+
+
+
+
+
+
+
+
width
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The width of the Body.
+
+
+
+
+
+
+
height
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The height of the Body.
+
+
+
+
+
+
+
offsetX
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The X offset of the Body from the Sprite position.
+
+
+
+
+
+
+
offsetY
+
+
+
+
+
+number
+
+
+
+
+
+
+
+
+
+
The Y offset of the Body from the Sprite position.
@@ -5790,7 +7028,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -5832,7 +7070,7 @@ Note: Doesn't take into account acceleration, maxVelocity or drag (if you've set
@@ -6361,7 +7599,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:47 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:29 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Physics.html b/docs/Phaser.Physics.html
index 339633ee..a339c8db 100644
--- a/docs/Phaser.Physics.html
+++ b/docs/Phaser.Physics.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1827,7 +1767,7 @@ It is only called if active is set to true.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:29 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.PluginManager.html b/docs/Phaser.PluginManager.html
index a4886e8d..4528a022 100644
--- a/docs/Phaser.PluginManager.html
+++ b/docs/Phaser.PluginManager.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1457,7 +1397,7 @@ It only calls plugins who have active=true.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:29 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Point.html b/docs/Phaser.Point.html
index 4ef47585..ddee290a 100644
--- a/docs/Phaser.Point.html
+++ b/docs/Phaser.Point.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1326,7 +1266,7 @@ Split the node into 4 subnodes
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.RandomDataGenerator.html b/docs/Phaser.RandomDataGenerator.html
index c893b200..486e2b58 100644
--- a/docs/Phaser.RandomDataGenerator.html
+++ b/docs/Phaser.RandomDataGenerator.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -2019,7 +1959,7 @@ Random number generator from
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Rectangle.html b/docs/Phaser.Rectangle.html
index f7c069a4..e91b1134 100644
--- a/docs/Phaser.Rectangle.html
+++ b/docs/Phaser.Rectangle.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -7404,7 +7344,7 @@ This method checks the x, y, width, and height properties of the Rectangles.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.RenderTexture.html b/docs/Phaser.RenderTexture.html
index 4d406da5..62ab2199 100644
--- a/docs/Phaser.RenderTexture.html
+++ b/docs/Phaser.RenderTexture.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1405,7 +1345,7 @@ once they update pixi to fix the typo, we'll fix it here too :)
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.RequestAnimationFrame.html b/docs/Phaser.RequestAnimationFrame.html
index f2ef9d0d..29f60417 100644
--- a/docs/Phaser.RequestAnimationFrame.html
+++ b/docs/Phaser.RequestAnimationFrame.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -5747,7 +5687,7 @@ This allows you to bundle multiple sounds together into a single audio file and
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:48 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.SoundManager.html b/docs/Phaser.SoundManager.html
index dedced84..7c994610 100644
--- a/docs/Phaser.SoundManager.html
+++ b/docs/Phaser.SoundManager.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1275,7 +1215,7 @@ A culled sprite has its renderable property set to 'false'.
-Phaser.Physics.Arcade.Body
+Phaser.Physics.Arcade.Body
@@ -7752,7 +7692,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:30 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Stage.html b/docs/Phaser.Stage.html
index e72d9ee0..87fb6ae4 100644
--- a/docs/Phaser.Stage.html
+++ b/docs/Phaser.Stage.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1680,7 +1620,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.StageScaleMode.html b/docs/Phaser.StageScaleMode.html
index 12f9e211..45c915d4 100644
--- a/docs/Phaser.StageScaleMode.html
+++ b/docs/Phaser.StageScaleMode.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -3840,7 +3780,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.State.html b/docs/Phaser.State.html
index 40cf1e4c..37679159 100644
--- a/docs/Phaser.State.html
+++ b/docs/Phaser.State.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -2594,7 +2534,7 @@ If you need to use the loader, you may need to use them here.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.StateManager.html b/docs/Phaser.StateManager.html
index c85cda32..42ce6ae7 100644
--- a/docs/Phaser.StateManager.html
+++ b/docs/Phaser.StateManager.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -2566,7 +2506,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Tween.html b/docs/Phaser.Tween.html
index 2bb08d08..0712f3ac 100644
--- a/docs/Phaser.Tween.html
+++ b/docs/Phaser.Tween.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -3272,7 +3212,7 @@ Used in combination with repeat you can create endless loops.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.TweenManager.html b/docs/Phaser.TweenManager.html
index ee5fce9b..b8ae3f5b 100644
--- a/docs/Phaser.TweenManager.html
+++ b/docs/Phaser.TweenManager.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -1628,7 +1568,7 @@ Please see https://github.com/sole/tw
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:49 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:31 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Utils.Debug.html b/docs/Phaser.Utils.Debug.html
index 8ebe3b10..f5156051 100644
--- a/docs/Phaser.Utils.Debug.html
+++ b/docs/Phaser.Utils.Debug.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -5981,7 +5921,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:50 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:32 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.Utils.html b/docs/Phaser.Utils.html
index 218c7314..fde44034 100644
--- a/docs/Phaser.Utils.html
+++ b/docs/Phaser.Utils.html
@@ -226,6 +226,10 @@
Arcade
+
@@ -2115,7 +2055,7 @@ If you need to adjust the bounds of the world
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:50 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:32 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/Phaser.html b/docs/Phaser.html
index e0e7fa60..5b5da4f6 100644
--- a/docs/Phaser.html
+++ b/docs/Phaser.html
@@ -226,6 +226,10 @@
Arcade
+
button(x, y, key, callback, callbackContext, overFrame, outFrame, downFrame) → {Phaser.Button}
-
-
-
-
-
-
-
-
Creates a new <code>Button</code> object.
-
-
-
-
-
-
-
-
-
Parameters:
-
-
-
-
-
-
-
Name
-
-
-
Type
-
-
-
Argument
-
-
-
-
-
Description
-
-
-
-
-
-
-
-
-
x
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
X position of the new button object.
-
-
-
-
-
-
-
y
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
Y position of the new button object.
-
-
-
-
-
-
-
key
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
The image key as defined in the Game.Cache to use as the texture for this button.
-
-
-
-
-
-
-
callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
The function to call when this button is pressed
-
-
-
-
-
-
-
callbackContext
-
-
-
-
-
-object
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
The context in which the callback will be called (usually 'this')
-
-
-
-
-
-
-
overFrame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name.
-
-
-
-
-
-
-
outFrame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
-
-
-
-
-
-
-
downFrame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
The image key as defined in the Game.Cache to use as the texture for this sprite OR a RenderTexture.
-
-
-
-
-
-
-
frame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
Emitter is a lightweight particle emitter. It can be used for one-time explosions or for
-continuous effects like rain and fire. All it really does is launch Particle objects out
-at set intervals, and fixes their positions and velocities accorindgly.
-
-
-
-
-
-
-
-
-
Parameters:
-
-
-
-
-
-
-
Name
-
-
-
Type
-
-
-
Argument
-
-
-
-
Default
-
-
-
Description
-
-
-
-
-
-
-
-
-
x
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
The x coordinate within the Emitter that the particles are emitted from.
-
-
-
-
-
-
-
y
-
-
-
-
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- 0
-
-
-
-
-
The y coordinate within the Emitter that the particles are emitted from.
This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
-
-
-
-
-
-
-
frame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
-
-
-
-
-
-
-
frame
-
-
-
-
-
-string
-|
-
-number
-
-
-
-
-
-
-
-
-
-
If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
@@ -4449,7 +1020,7 @@ However it does affect the width property.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
diff --git a/docs/index.html b/docs/index.html
index 513d1335..deb3dd24 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -226,6 +226,10 @@
Arcade
+
A feature-packed 2D HTML5 game framework born from the smouldering pits of Flixel and
constructed via plenty of blood, sweat, tears and coffee by Richard Davey (@photonstorm).
@@ -520,7 +460,7 @@ and my love of game development originate.
@@ -573,7 +513,7 @@ and my love of game development originate.
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
@@ -755,7 +698,7 @@
Documentation generated by JSDoc 3.3.0-dev
- on Fri Oct 25 2013 16:16:43 GMT+0100 (BST) using the DocStrap template.
+ on Fri Oct 25 2013 17:05:24 GMT+0100 (BST) using the DocStrap template.
diff --git a/src/IntroDocs.js b/src/IntroDocs.js
new file mode 100644
index 00000000..27a04815
--- /dev/null
+++ b/src/IntroDocs.js
@@ -0,0 +1,29 @@
+/**
+* @author Richard Davey
+* @copyright 2013 Photon Storm Ltd.
+* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
+*/
+
+/**
+* @overview
+*
+* Phaser - http://www.phaser.io
+*
+* v1.1 - Released October 25th 2013.
+*
+* By Richard Davey http://www.photonstorm.com @photonstorm
+*
+* A feature-packed 2D HTML5 game framework born from the smouldering pits of Flixel and
+* constructed via plenty of blood, sweat, tears and coffee by Richard Davey (@photonstorm).
+*
+* Phaser uses Pixi.js for rendering, created by Mat Groves http://matgroves.com/ @Doormat23.
+*
+* Follow Phaser development progress at http://www.photonstorm.com
+*
+* Many thanks to Adam Saltsman (@ADAMATOMIC) for releasing Flixel, from both which Phaser
+* and my love of game development originate.
+*
+* "If you want your children to be intelligent, read them fairy tales."
+* "If you want them to be more intelligent, read them more fairy tales."
+* -- Albert Einstein
+*/
diff --git a/src/gameobjects/GameObjectFactory.js b/src/gameobjects/GameObjectFactory.js
index ebd37ed5..9f1fd101 100644
--- a/src/gameobjects/GameObjectFactory.js
+++ b/src/gameobjects/GameObjectFactory.js
@@ -5,7 +5,7 @@
*/
/**
-* Description.
+* The Game Object Factory is a quick way to create all of the different sorts of core objects that Phaser uses.
*
* @class Phaser.GameObjectFactory
* @constructor
@@ -28,20 +28,8 @@ Phaser.GameObjectFactory = function (game) {
Phaser.GameObjectFactory.prototype = {
/**
- * @property {Phaser.Game} game - A reference to the currently running Game.
- * @default
- */
- game: null,
-
- /**
- * @property {Phaser.World} world - A reference to the game world.
- * @default
- */
- world: null,
-
- /**
- * Description.
- * @method existing.
+ * Adds an existing object to the game world.
+ * @method Phaser.GameObjectFactory#existing
* @param {*} object - An instance of Phaser.Sprite, Phaser.Button or any other display object..
* @return {*} The child that was added to the Group.
*/
@@ -54,7 +42,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a new Sprite with specific position and sprite sheet key.
*
- * @method sprite
+ * @method Phaser.GameObjectFactory#sprite
* @param {number} x - X position of the new sprite.
* @param {number} y - Y position of the new sprite.
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
@@ -70,7 +58,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
*
- * @method child
+ * @method Phaser.GameObjectFactory#child
* @param {Phaser.Group} group - The Group to add this child to.
* @param {number} x - X position of the new sprite.
* @param {number} y - Y position of the new sprite.
@@ -87,7 +75,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
*
- * @method tween
+ * @method Phaser.GameObjectFactory#tween
* @param {object} obj - Object the tween will be run on.
* @return {Phaser.Tween} Description.
*/
@@ -100,7 +88,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
*
- * @method group
+ * @method Phaser.GameObjectFactory#group
* @param {*} parent - The parent Group or DisplayObjectContainer that will hold this group, if any.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @return {Phaser.Group} The newly created group.
@@ -114,7 +102,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new instance of the Sound class.
*
- * @method audio
+ * @method Phaser.GameObjectFactory#audio
* @param {string} key - The Game.cache key of the sound that this object will use.
* @param {number} volume - The volume at which the sound will be played.
* @param {boolean} loop - Whether or not the sound will loop.
@@ -129,7 +117,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new TileSprite.
*
- * @method tileSprite
+ * @method Phaser.GameObjectFactory#tileSprite
* @param {number} x - X position of the new tileSprite.
* @param {number} y - Y position of the new tileSprite.
* @param {number} width - the width of the tilesprite.
@@ -147,7 +135,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new Text.
*
- * @method text
+ * @method Phaser.GameObjectFactory#text
* @param {number} x - X position of the new text object.
* @param {number} y - Y position of the new text object.
* @param {string} text - The actual text that will be written.
@@ -163,7 +151,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new Button object.
*
- * @method button
+ * @method Phaser.GameObjectFactory#button
* @param {number} [x] X position of the new button object.
* @param {number} [y] Y position of the new button object.
* @param {string} [key] The image key as defined in the Game.Cache to use as the texture for this button.
@@ -183,7 +171,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* Creates a new Graphics object.
*
- * @method graphics
+ * @method Phaser.GameObjectFactory#graphics
* @param {number} x - X position of the new graphics object.
* @param {number} y - Y position of the new graphics object.
* @return {Phaser.Graphics} The newly created graphics object.
@@ -199,7 +187,7 @@ Phaser.GameObjectFactory.prototype = {
* continuous effects like rain and fire. All it really does is launch Particle objects out
* at set intervals, and fixes their positions and velocities accorindgly.
*
- * @method emitter
+ * @method Phaser.GameObjectFactory#emitter
* @param {number} [x=0] - The x coordinate within the Emitter that the particles are emitted from.
* @param {number} [y=0] - The y coordinate within the Emitter that the particles are emitted from.
* @param {number} [maxParticles=50] - The total number of particles in this emitter.
@@ -214,7 +202,7 @@ Phaser.GameObjectFactory.prototype = {
/**
* * Create a new BitmapText.
*
- * @method bitmapText
+ * @method Phaser.GameObjectFactory#bitmapText
* @param {number} x - X position of the new bitmapText object.
* @param {number} y - Y position of the new bitmapText object.
* @param {string} text - The actual text that will be written.
@@ -228,9 +216,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
+ * Creates a new Tilemap object.
*
- * @method tilemap
+ * @method Phaser.GameObjectFactory#tilemap
* @param {string} key - Asset key for the JSON file.
* @return {Phaser.Tilemap} The newly created tilemap object.
*/
@@ -241,9 +229,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
+ * Creates a new Tileset object.
*
- * @method tileset
+ * @method Phaser.GameObjectFactory#tileset
* @param {string} key - The image key as defined in the Game.Cache to use as the tileset.
* @return {Phaser.Tileset} The newly created tileset object.
*/
@@ -254,15 +242,15 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * Description.
- *
- * @method tilemaplayer
- * @param {number} x - X position of the new tilemapLayer.
- * @param {number} y - Y position of the new tilemapLayer.
- * @param {number} width - the width of the tilemapLayer.
- * @param {number} height - the height of the tilemapLayer.
- * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
- */
+ * Creates a new Tilemap Layer object.
+ *
+ * @method Phaser.GameObjectFactory#tilemapLayer
+ * @param {number} x - X position of the new tilemapLayer.
+ * @param {number} y - Y position of the new tilemapLayer.
+ * @param {number} width - the width of the tilemapLayer.
+ * @param {number} height - the height of the tilemapLayer.
+ * @return {Phaser.TilemapLayer} The newly created tilemaplayer object.
+ */
tilemapLayer: function (x, y, width, height, tileset, tilemap, layer) {
return this.world.add(new Phaser.TilemapLayer(this.game, x, y, width, height, tileset, tilemap, layer));
@@ -270,9 +258,9 @@ Phaser.GameObjectFactory.prototype = {
},
/**
- * A dynamic initially blank canvas to which images can be drawn
+ * A dynamic initially blank canvas to which images can be drawn.
*
- * @method renderTexture
+ * @method Phaser.GameObjectFactory#renderTexture
* @param {string} key - Asset key for the render texture.
* @param {number} width - the width of the render texture.
* @param {number} height - the height of the render texture.
@@ -286,6 +274,6 @@ Phaser.GameObjectFactory.prototype = {
return texture;
- },
+ }
};
\ No newline at end of file
diff --git a/src/physics/arcade/ArcadePhysics.js b/src/physics/arcade/ArcadePhysics.js
index 3aff9dcc..522e12cd 100644
--- a/src/physics/arcade/ArcadePhysics.js
+++ b/src/physics/arcade/ArcadePhysics.js
@@ -49,8 +49,6 @@ Phaser.Physics.Arcade = function (game) {
*/
this.OVERLAP_BIAS = 4;
- // this.TILE_OVERLAP = false;
-
/**
* @property {Phaser.QuadTree} quadTree - The world QuadTree.
*/
diff --git a/src/tilemap_old/Tile.js b/src/tilemap_old/Tile.js
deleted file mode 100644
index 069f1b46..00000000
--- a/src/tilemap_old/Tile.js
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
-* @author Richard Davey
-* @copyright 2013 Photon Storm Ltd.
-* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
-* @module Phaser.Tile
-*/
-
-
-/**
-* Create a new Tile.
-*
-* @class Phaser.Tile
-* @classdesc A Tile is a single representation of a tile within a Tilemap.
-* @constructor
-* @param {Phaser.Game} game - A reference to the currently running game.
-* @param {Tilemap} tilemap - The tilemap this tile belongs to.
-* @param {number} index - The index of this tile type in the core map data.
-* @param {number} width - Width of the tile.
-* @param {number} height - Height of the tile.
-*/
-Phaser.Tile = function (game, tilemap, index, width, height) {
-
- /**
- * @property {number} mass - The virtual mass of the tile.
- * @default
- */
- this.mass = 1.0;
-
- /**
- * @property {boolean} collideNone - Indicating this Tile doesn't collide at all.
- * @default
- */
- this.collideNone = true;
-
- /**
- * @property {boolean} collideLeft - Indicating collide with any object on the left.
- * @default
- */
- this.collideLeft = false;
-
- /**
- * @property {boolean} collideRight - Indicating collide with any object on the right.
- * @default
- */
- this.collideRight = false;
-
- /**
- * @property {boolean} collideUp - Indicating collide with any object on the top.
- * @default
- */
- this.collideUp = false;
-
- /**
- * @property {boolean} collideDown - Indicating collide with any object on the bottom.
- * @default
- */
- this.collideDown = false;
-
- /**
- * @property {boolean} separateX - Enable separation at x-axis.
- * @default
- */
- this.separateX = true;
-
- /**
- * @property {boolean} separateY - Enable separation at y-axis.
- * @default
- */
- this.separateY = true;
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running game.
- */
- this.game = game;
-
- /**
- * @property {boolean} tilemap - The tilemap this tile belongs to.
- */
- this.tilemap = tilemap;
-
- /**
- * @property {number} index - The index of this tile type in the core map data.
- */
- this.index = index;
-
- /**
- * @property {number} width - The width of the tile.
- */
- this.width = width;
-
- /**
- * @property {number} height - The height of the tile.
- */
- this.height = height;
-
-};
-
-Phaser.Tile.prototype = {
-
- /**
- * Clean up memory.
- * @method destroy
- */
- destroy: function () {
- this.tilemap = null;
- },
-
- /**
- * Set collision configs.
- * @method setCollision
- * @param {boolean} left - Indicating collide with any object on the left.
- * @param {boolean} right - Indicating collide with any object on the right.
- * @param {boolean} up - Indicating collide with any object on the top.
- * @param {boolean} down - Indicating collide with any object on the bottom.
- * @param {boolean} reset - Description.
- * @param {boolean} separateX - Separate at x-axis.
- * @param {boolean} separateY - Separate at y-axis.
- */
- setCollision: function (left, right, up, down, reset, separateX, separateY) {
-
- if (reset)
- {
- this.resetCollision();
- }
-
- this.separateX = separateX;
- this.separateY = separateY;
-
- this.collideNone = true;
- this.collideLeft = left;
- this.collideRight = right;
- this.collideUp = up;
- this.collideDown = down;
-
- if (left || right || up || down)
- {
- this.collideNone = false;
- }
-
- },
-
- /**
- * Reset collision status flags.
- * @method resetCollision
- */
- resetCollision: function () {
-
- this.collideNone = true;
- this.collideLeft = false;
- this.collideRight = false;
- this.collideUp = false;
- this.collideDown = false;
-
- }
-
-};
-
-Object.defineProperty(Phaser.Tile.prototype, "bottom", {
-
- /**
- * The sum of the y and height properties. Changing the bottom property of a Rectangle object has no effect on the x, y and width properties, but does change the height property.
- * @method bottom
- * @return {number}
- **/
- get: function () {
- return this.y + this.height;
- }
-
-});
-
-Object.defineProperty(Phaser.Tile.prototype, "right", {
-
- /**
- * The sum of the x and width properties. Changing the right property of a Rectangle object has no effect on the x, y and height properties.
- * However it does affect the width property.
- * @method right
- * @return {number}
- **/
- get: function () {
- return this.x + this.width;
- }
-
-});
diff --git a/src/tilemap_old/Tilemap.js b/src/tilemap_old/Tilemap.js
deleted file mode 100644
index ad19fd81..00000000
--- a/src/tilemap_old/Tilemap.js
+++ /dev/null
@@ -1,530 +0,0 @@
-/**
-* @author Richard Davey
-* @copyright 2013 Photon Storm Ltd.
-* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
-* @module Phaser.Tilemap
-*/
-
-
-/**
-* Create a new Tilemap.
-* @class Phaser.Tilemap
-* @classdesc This GameObject allows for the display of a tilemap within the game world. Tile maps consist of an image, tile data and a size.
-* Internally it creates a TilemapLayer for each layer in the tilemap.
-* @constructor
-* @param {Phaser.Game} game - Current game instance.
-* @param {string} key - Asset key for this map.
-* @param {object} x - Description.
-* @param {object} y - Description.
-* @param {boolean} resizeWorld - Resize the world bound automatically based on this tilemap?
-* @param {number} tileWidth - Width of tiles in this map (used for CSV maps).
-* @param {number} tileHeight - Height of tiles in this map (used for CSV maps).
-*/
-Phaser.Tilemap = function (game, key, x, y, resizeWorld, tileWidth, tileHeight) {
-
- if (typeof resizeWorld === "undefined") { resizeWorld = true; }
- if (typeof tileWidth === "undefined") { tileWidth = 0; }
- if (typeof tileHeight === "undefined") { tileHeight = 0; }
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running game.
- */
- this.game = game;
-
- /**
- * @property {Description} group - Description.
- */
- this.group = null;
-
- /**
- * @property {string} name - The user defined name given to this Description.
- * @default
- */
- this.name = '';
-
- /**
- * @property {Description} key - Description.
- */
- this.key = key;
-
- /**
- * @property {number} renderOrderID - Render iteration counter
- * @default
- */
- this.renderOrderID = 0;
-
- /**
- * @property {boolean} collisionCallback - Tilemap collision callback.
- * @default
- */
- this.collisionCallback = null;
-
- /**
- * @property {boolean} exists - Description.
- * @default
- */
- this.exists = true;
-
- /**
- * @property {boolean} visible - Description.
- * @default
- */
- this.visible = true;
-
- this.width = 0;
- this.height = 0;
-
- /**
- * @property {boolean} tiles - Description.
- * @default
- */
- this.tiles = [];
-
- /**
- * @property {boolean} layers - Description.
- * @default
- */
- this.layers = [];
-
- var map = this.game.cache.getTilemap(key);
-
- PIXI.DisplayObjectContainer.call(this);
-
- /**
- * @property {Description} position - Description.
- */
- this.position.x = x;
- this.position.y = y;
-
- /**
- * @property {Description} type - Description.
- */
- this.type = Phaser.TILEMAP;
-
- /**
- * @property {Description} renderer - Description.
- */
- this.renderer = new Phaser.TilemapRenderer(this.game);
-
- this.fixedToCamera = true;
-
- /**
- * @property {Description} mapFormat - Description.
- */
- this.mapFormat = map.format;
-
- switch (this.mapFormat)
- {
- case Phaser.Tilemap.CSV:
- this.parseCSV(map.mapData, key, tileWidth, tileHeight);
- break;
-
- case Phaser.Tilemap.JSON:
- this.parseTiledJSON(map.mapData, key);
- break;
- }
-
- if (this.currentLayer && resizeWorld)
- {
- this.game.world.setBounds(0, 0, this.width, this.heightIn);
- }
-
-};
-
-// Needed to keep the PIXI.Sprite constructor in the prototype chain (as the core pixi renderer uses an instanceof check sadly)
-Phaser.Tilemap.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
-Phaser.Tilemap.prototype.constructor = Phaser.Tilemap;
-
-Phaser.Tilemap.CSV = 0;
-Phaser.Tilemap.JSON = 1;
-
-/**
-* Parse csv map data and generate tiles.
-*
-* @method Phaser.Tilemap.prototype.parseCSV
-* @param {string} data - CSV map data.
-* @param {string} key - Asset key for tileset image.
-* @param {number} tileWidth - Width of its tile.
-* @param {number} tileHeight - Height of its tile.
-*/
-Phaser.Tilemap.prototype.parseCSV = function (data, key, tileWidth, tileHeight) {
-
- var layer = new Phaser.TilemapLayer(this, 0, key, Phaser.Tilemap.CSV, 'TileLayerCSV' + this.layers.length.toString(), tileWidth, tileHeight);
-
- // Trim any rogue whitespace from the data
- data = data.trim();
-
- var rows = data.split("\n");
-
- for (var i = 0; i < rows.length; i++)
- {
- var column = rows[i].split(",");
-
- if (column.length > 0)
- {
- layer.addColumn(column);
- }
- }
-
- layer.updateBounds();
- layer.createCanvas();
-
- var tileQuantity = layer.parseTileOffsets();
-
- this.currentLayer = layer;
- this.collisionLayer = layer;
- this.layers.push(layer);
-
- this.width = this.currentLayer.widthInPixels;
- this.height = this.currentLayer.heightInPixels;
-
- this.generateTiles(tileQuantity);
-
-};
-
-/**
-* Parse JSON map data and generate tiles.
-*
-* @method Phaser.Tilemap.prototype.parseTiledJSON
-* @param {string} data - JSON map data.
-* @param {string} key - Asset key for tileset image.
-*/
-Phaser.Tilemap.prototype.parseTiledJSON = function (json, key) {
-
- for (var i = 0; i < json.layers.length; i++)
- {
- var layer = new Phaser.TilemapLayer(this, i, key, Phaser.Tilemap.JSON, json.layers[i].name, json.tilewidth, json.tileheight);
-
- // Check it's a data layer
- if (!json.layers[i].data)
- {
- continue;
- }
-
- // layer.createQuadTree(json.tilewidth * json.layers[i].width, json.tileheight * json.layers[i].height);
-
- layer.alpha = json.layers[i].opacity;
- layer.visible = json.layers[i].visible;
- layer.tileMargin = json.tilesets[0].margin;
- layer.tileSpacing = json.tilesets[0].spacing;
-
- var c = 0;
- var row;
-
- for (var t = 0; t < json.layers[i].data.length; t++)
- {
- if (c == 0)
- {
- row = [];
- }
-
- row.push(json.layers[i].data[t]);
- c++;
-
- if (c == json.layers[i].width)
- {
- layer.addColumn(row);
- c = 0;
- }
- }
-
- layer.updateBounds();
- layer.createCanvas();
-
- var tileQuantity = layer.parseTileOffsets();
-
- this.currentLayer = layer;
- this.collisionLayer = layer;
- this.layers.push(layer);
-
- if (this.currentLayer.widthInPixels > this.width)
- {
- this.width = this.currentLayer.widthInPixels;
- }
-
- if (this.currentLayer.heightInPixels > this.height)
- {
- this.height = this.currentLayer.heightInPixels;
- }
- }
-
- this.generateTiles(tileQuantity);
-
-};
-
-/**
-* Create tiles of given quantity.
-* @method Phaser.Tilemap.prototype.generateTiles
-* @param {number} qty - Quantity of tiles to be generated.
-*/
-Phaser.Tilemap.prototype.generateTiles = function (qty) {
-
- for (var i = 0; i < qty; i++)
- {
- this.tiles.push(new Phaser.Tile(this.game, this, i, this.currentLayer.tileWidth, this.currentLayer.tileHeight));
- }
-
-};
-
-/**
-* Set callback to be called when this tilemap collides.
-*
-* @method Phaser.Tilemap.prototype.setCollisionCallback
-* @param {object} context - Callback will be called with this context.
-* @param {Function} callback - Callback function.
-*/
-Phaser.Tilemap.prototype.setCollisionCallback = function (context, callback) {
-
- this.collisionCallbackContext = context;
- this.collisionCallback = callback;
-
-};
-
-/**
-* Set collision configs of tiles in a range index.
-*
-* @method Phaser.Tilemap.prototype.setCollisionRange
-* @param {number} start - First index of tiles.
-* @param {number} end - Last index of tiles.
-* @param {number} collision - Bit field of flags. (see Tile.allowCollision)
-* @param {boolean} resetCollisions - Reset collision flags before set.
-* @param {boolean} separateX - Enable separate at x-axis.
-* @param {boolean} separateY - Enable separate at y-axis.
-*/
-Phaser.Tilemap.prototype.setCollisionRange = function (start, end, left, right, up, down, resetCollisions, separateX, separateY) {
-
- if (typeof resetCollisions === "undefined") { resetCollisions = false; }
- if (typeof separateX === "undefined") { separateX = true; }
- if (typeof separateY === "undefined") { separateY = true; }
-
- for (var i = start; i < end; i++)
- {
- this.tiles[i].setCollision(left, right, up, down, resetCollisions, separateX, separateY);
- }
-
-};
-
-/**
-* Set collision configs of tiles with given index.
-* @param {number[]} values - Index array which contains all tile indexes. The tiles with those indexes will be setup with rest parameters.
-* @param {number} collision - Bit field of flags (see Tile.allowCollision).
-* @param {boolean} resetCollisions - Reset collision flags before set.
-* @param {boolean} left - Indicating collide with any object on the left.
-* @param {boolean} right - Indicating collide with any object on the right.
-* @param {boolean} up - Indicating collide with any object on the top.
-* @param {boolean} down - Indicating collide with any object on the bottom.
-* @param {boolean} separateX - Enable separate at x-axis.
-* @param {boolean} separateY - Enable separate at y-axis.
-*/
-Phaser.Tilemap.prototype.setCollisionByIndex = function (values, left, right, up, down, resetCollisions, separateX, separateY) {
-
- if (typeof resetCollisions === "undefined") { resetCollisions = false; }
- if (typeof separateX === "undefined") { separateX = true; }
- if (typeof separateY === "undefined") { separateY = true; }
-
- for (var i = 0; i < values.length; i++)
- {
- this.tiles[values[i]].setCollision(left, right, up, down, resetCollisions, separateX, separateY);
- }
-
-};
-
-// Tile Management
-
-/**
-* Get the tile by its index.
-* @param {number} value - Index of the tile you want to get.
-* @return {Tile} The tile with given index.
-*/
-Phaser.Tilemap.prototype.getTileByIndex = function (value) {
-
- if (this.tiles[value])
- {
- return this.tiles[value];
- }
-
- return null;
-
-};
-
-/**
-* Get the tile located at specific position and layer.
-* @param {number} x - X position of this tile located.
-* @param {number} y - Y position of this tile located.
-* @param {number} [layer] - layer of this tile located.
-* @return {Tile} The tile with specific properties.
-*/
-Phaser.Tilemap.prototype.getTile = function (x, y, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer.ID; }
-
- return this.tiles[this.layers[layer].getTileIndex(x, y)];
-
-};
-
-/**
-* Get the tile located at specific position (in world coordinate) and layer (thus you give a position of a point which is within the tile).
-* @param {number} x - X position of the point in target tile.
-* @param {number} y - Y position of the point in target tile.
-* @param {number} [layer] - layer of this tile located.
-* @return {Tile} The tile with specific properties.
-*/
-Phaser.Tilemap.prototype.getTileFromWorldXY = function (x, y, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer.ID; }
-
- return this.tiles[this.layers[layer].getTileFromWorldXY(x, y)];
-
-};
-
-/**
-* Gets the tile underneath the Input.x/y position.
-* @param {number} layer - The layer to check, defaults to 0.
-* @return {Tile}
-*/
-Phaser.Tilemap.prototype.getTileFromInputXY = function (layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer.ID; }
-
- return this.tiles[this.layers[layer].getTileFromWorldXY(this.game.input.worldX, this.game.input.worldY)];
-
-};
-
-/**
-* Get tiles overlaps the given object.
-* @param {GameObject} object - Tiles you want to get that overlaps this.
-* @return {array} Array with tiles information (Each contains x, y and the tile).
-*/
-Phaser.Tilemap.prototype.getTileOverlaps = function (object) {
-
- return this.currentLayer.getTileOverlaps(object);
-
-};
-
-// COLLIDE
-
-/**
-* Check whether this tilemap collides with the given game object or group of objects.
-* @param {Function} objectOrGroup - Target object of group you want to check.
-* @param {Function} callback - This is called if objectOrGroup collides the tilemap.
-* @param {object} context - Callback will be called with this context.
-* @return {boolean} Return true if this collides with given object, otherwise return false.
-*/
-Phaser.Tilemap.prototype.collide = function (objectOrGroup, callback, context) {
-
- objectOrGroup = objectOrGroup || this.game.world.group;
- callback = callback || null;
- context = context || null;
-
- if (callback && context)
- {
- this.collisionCallback = callback;
- this.collisionCallbackContext = context;
- }
-
- if (objectOrGroup instanceof Phaser.Group)
- {
- objectOrGroup.forEachAlive(this.collideGameObject, this);
- }
- else
- {
- this.collideGameObject(objectOrGroup);
- }
-
-};
-
-/**
-* Check whether this tilemap collides with the given game object.
-* @param {GameObject} object - Target object you want to check.
-* @return {boolean} Return true if this collides with given object, otherwise return false.
-*/
-Phaser.Tilemap.prototype.collideGameObject = function (object) {
-
- if (object instanceof Phaser.Group || object instanceof Phaser.Tilemap)
- {
- return false;
- }
-
- if (object.exists && object.body.allowCollision.none == false)
- {
- this._tempCollisionData = this.collisionLayer.getTileOverlaps(object);
-
- if (this.collisionCallback && this._tempCollisionData.length > 0)
- {
- this.collisionCallback.call(this.collisionCallbackContext, object, this._tempCollisionData);
- }
-
- return true;
- }
- else
- {
- return false;
- }
-
-};
-
-/**
-* Set a tile to a specific layer.
-* @param {number} x - X position of this tile.
-* @param {number} y - Y position of this tile.
-* @param {number} index - The index of this tile type in the core map data.
-* @param {number} [layer] - Which layer you want to set the tile to.
-*/
-Phaser.Tilemap.prototype.putTile = function (x, y, index, layer) {
-
- if (typeof layer === "undefined") { layer = this.currentLayer.ID; }
-
- this.layers[layer].putTile(x, y, index);
-
-};
-
-/**
-* Calls the renderer.
-*/
-Phaser.Tilemap.prototype.update = function () {
-
- this.renderer.render(this);
-
- if (this.fixedToCamera)
- {
- // this.displayObject.position.x = this.game.camera.view.x + this.x;
- // this.displayObject.position.y = this.game.camera.view.y + this.y;
- this.position.x = this.game.camera.view.x + 0;
- this.position.y = this.game.camera.view.y + 0;
- }
-
-};
-
-/**
-* Description.
-*/
-Phaser.Tilemap.prototype.destroy = function () {
-
- this.tiles.length = 0;
- this.layers.length = 0;
-
-};
-
-/**
-* Get width in pixels.
-* @return {number}
-*/
-Object.defineProperty(Phaser.Tilemap.prototype, "widthInPixels", {
-
- get: function () {
- return this.currentLayer.widthInPixels;
- }
-
-});
-
-/**
-* Get height in pixels.
-* @return {number}
-*/
-Object.defineProperty(Phaser.Tilemap.prototype, "heightInPixels", {
-
- get: function () {
- return this.currentLayer.heightInPixels;
- }
-
-});
diff --git a/src/tilemap_old/TilemapLayer.js b/src/tilemap_old/TilemapLayer.js
deleted file mode 100644
index 80fd7516..00000000
--- a/src/tilemap_old/TilemapLayer.js
+++ /dev/null
@@ -1,662 +0,0 @@
-/**
-* @author Richard Davey
-* @copyright 2013 Photon Storm Ltd.
-* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
-* @module Phaser.TilemapLayer
-*/
-
-/**
-* Create a new TilemapLayer.
-* @class Phaser.TilemapLayer
-* @classdesc A Tilemap Layer. Tiled format maps can have multiple overlapping layers.
-* @constructor
-* @param parent {Tilemap} The tilemap that contains this layer.
-* @param id {number} The ID of this layer within the Tilemap array.
-* @param key {string} Asset key for this map.
-* @param mapformat {number} Format of this map data, available: Tilemap.CSV or Tilemap.JSON.
-* @param name {string} Name of this layer, so you can get this layer by its name.
-* @param tileWidth {number} Width of tiles in this map.
-* @param tileHeight {number} Height of tiles in this map.
-*/
-Phaser.TilemapLayer = function (parent, id, key, mapFormat, name, tileWidth, tileHeight) {
-
- /**
- * @property {boolean} exists - Controls whether update() and draw() are automatically called.
- * @default
- */
- this.exists = true;
-
- /**
- * @property {boolean} visible - Controls whether draw() are automatically called.
- * @default
- */
- this.visible = true;
-
- /**
- * How many tiles in each row.
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} widthInTiles
- * @default
- */
- this.widthInTiles = 0;
-
- /**
- * How many tiles in each column.
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} heightInTiles
- * @default
- */
- this.heightInTiles = 0;
-
- /**
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} widthInPixels
- * @default
- */
- this.widthInPixels = 0;
-
- /**
- * Read-only variable, do NOT recommend changing after the map is loaded!
- * @property {number} heightInPixels
- * @default
- */
- this.heightInPixels = 0;
-
- /**
- * Distance between REAL tiles to the tileset texture bound.
- * @property {number} tileMargin
- * @default
- */
- this.tileMargin = 0;
-
- /**
- * Distance between every 2 neighbor tile in the tileset texture.
- * @property {number} tileSpacing
- * @default
- */
- this.tileSpacing = 0;
-
- /**
- * @property {Description} parent - Description.
- */
- this.parent = parent;
-
- /**
- * @property {Phaser.Game} game - Description.
- */
- this.game = parent.game;
-
- /**
- * @property {Description} ID - Description.
- */
- this.ID = id;
-
- /**
- * @property {Description} name - Description.
- */
- this.name = name;
-
- /**
- * @property {Description} key - Description.
- */
- this.key = key;
-
- /**
- * @property {Description} type - Description.
- */
- this.type = Phaser.TILEMAPLAYER;
-
- /**
- * @property {tileWidth} mapFormat - Description.
- */
- this.mapFormat = mapFormat;
-
- /**
- * @property {Description} tileWidth - Description.
- */
- this.tileWidth = tileWidth;
-
- /**
- * @property {Description} tileHeight - Description.
- */
- this.tileHeight = tileHeight;
-
- /**
- * @property {Phaser.Rectangle} boundsInTiles - Description.
- */
- this.boundsInTiles = new Phaser.Rectangle();
-
- var map = this.game.cache.getTilemap(key);
-
- /**
- * @property {Description} tileset - Description.
- */
- this.tileset = map.data;
-
- /**
- * @property {Description} _alpha - Description.
- * @private
- * @default
- */
- this._alpha = 1;
-
- /**
- * @property {Description} canvas - Description.
- * @default
- */
- this.canvas = null;
-
- /**
- * @property {Description} context - Description.
- * @default
- */
- this.context = null;
-
- /**
- * @property {Description} baseTexture - Description.
- * @default
- */
- this.baseTexture = null;
-
- /**
- * @property {Description} texture - Description.
- * @default
- */
- this.texture = null;
-
- /**
- * @property {Description} sprite - Description.
- * @default
- */
- this.sprite = null;
-
- /**
- * @property {array} mapData - Description.
- */
- this.mapData = [];
-
- /**
- * @property {array} _tempTileBlock - Description.
- * @private
- */
- this._tempTileBlock = [];
-
- /**
- * @property {array} _tempBlockResults - Description.
- * @private
- *
- */
- this._tempBlockResults = [];
-
-};
-
-Phaser.TilemapLayer.prototype = {
-
- /**
- * Set a specific tile with its x and y in tiles.
- * @method putTileWorldXY
- * @param {number} x - X position of this tile in world coordinates.
- * @param {number} y - Y position of this tile in world coordinates.
- * @param {number} index - The index of this tile type in the core map data.
- */
- putTileWorldXY: function (x, y, index) {
-
- x = this.game.math.snapToFloor(x, this.tileWidth) / this.tileWidth;
- y = this.game.math.snapToFloor(y, this.tileHeight) / this.tileHeight;
-
- if (y >= 0 && y < this.mapData.length)
- {
- if (x >= 0 && x < this.mapData[y].length)
- {
- this.mapData[y][x] = index;
- }
- }
-
- },
-
- /**
- * Set a specific tile with its x and y in tiles.
- * @method putTile
- * @param {number} x - X position of this tile.
- * @param {number} y - Y position of this tile.
- * @param {number} index - The index of this tile type in the core map data.
- */
- putTile: function (x, y, index) {
-
- if (y >= 0 && y < this.mapData.length)
- {
- if (x >= 0 && x < this.mapData[y].length)
- {
- this.mapData[y][x] = index;
- }
- }
-
- },
-
- /**
- * Swap tiles with 2 kinds of indexes.
- * @method swapTile
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - specify a Rectangle of tiles to operate. The x position in tiles of Rectangle's left-top corner.
- * @param {number} [y] - specify a Rectangle of tiles to operate. The y position in tiles of Rectangle's left-top corner.
- * @param {number} [width] - specify a Rectangle of tiles to operate. The width in tiles.
- * @param {number} [height] - specify a Rectangle of tiles to operate. The height in tiles.
- */
- swapTile: function (tileA, tileB, x, y, width, height) {
-
- x = x || 0;
- y = y || 0;
- width = width || this.widthInTiles;
- height = height || this.heightInTiles;
-
- this.getTempBlock(x, y, width, height);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- // First sweep marking tileA as needing a new index
- if (this._tempTileBlock[r].tile.index == tileA)
- {
- this._tempTileBlock[r].newIndex = true;
- }
-
- // In the same pass we can swap tileB to tileA
- if (this._tempTileBlock[r].tile.index == tileB)
- {
- this.mapData[this._tempTileBlock[r].y][this._tempTileBlock[r].x] = tileA;
- }
- }
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- // And now swap our newIndex tiles for tileB
- if (this._tempTileBlock[r].newIndex == true)
- {
- this.mapData[this._tempTileBlock[r].y][this._tempTileBlock[r].x] = tileB;
- }
- }
-
- },
-
- /**
- * Fill a tile block with a specific tile index.
- * @method fillTile
- * @param {number} index - Index of tiles you want to fill with.
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- */
- fillTile: function (index, x, y, width, height) {
-
- x = x || 0;
- y = y || 0;
- width = width || this.widthInTiles;
- height = height || this.heightInTiles;
-
- this.getTempBlock(x, y, width, height);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- this.mapData[this._tempTileBlock[r].y][this._tempTileBlock[r].x] = index;
- }
-
- },
-
- /**
- * Set random tiles to a specific tile block.
- * @method randomiseTiles
- * @param {number[]} tiles - Tiles with indexes in this array will be randomly set to the given block.
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- */
- randomiseTiles: function (tiles, x, y, width, height) {
-
- x = x || 0;
- y = y || 0;
- width = width || this.widthInTiles;
- height = height || this.heightInTiles;
-
- this.getTempBlock(x, y, width, height);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- this.mapData[this._tempTileBlock[r].y][this._tempTileBlock[r].x] = this.game.math.getRandom(tiles);
- }
-
- },
-
- /**
- * Replace one kind of tiles to another kind.
- * @method replaceTile
- * @param {number} tileA - First tile index.
- * @param {number} tileB - Second tile index.
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- */
- replaceTile: function (tileA, tileB, x, y, width, height) {
-
- x = x || 0;
- y = y || 0;
- width = width || this.widthInTiles;
- height = height || this.heightInTiles;
-
- this.getTempBlock(x, y, width, height);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- if (this._tempTileBlock[r].tile.index == tileA)
- {
- this.mapData[this._tempTileBlock[r].y][this._tempTileBlock[r].x] = tileB;
- }
- }
-
- },
-
- /**
- * Get a tile block with specific position and size (both are in tiles).
- * @method getTileBlock
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- */
- getTileBlock: function (x, y, width, height) {
-
- var output = [];
-
- this.getTempBlock(x, y, width, height);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- output.push({
- x: this._tempTileBlock[r].x,
- y: this._tempTileBlock[r].y,
- tile: this._tempTileBlock[r].tile
- });
- }
-
- return output;
-
- },
-
- /**
- * Get a tile with specific position (in world coordinate). (thus you give a position of a point which is within the tile)
- * @method getTileFromWorldXY
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- */
- getTileFromWorldXY: function (x, y) {
-
- x = Phaser.Math.snapToFloor(x, this.tileWidth) / this.tileWidth;
- y = Phaser.Math.snapToFloor(y, this.tileHeight) / this.tileHeight;
-
- return this.getTileIndex(x, y);
-
- },
-
- /**
- * Get tiles overlaps the given object.
- * @method getTileOverlaps
- * @param {GameObject} object - Tiles you want to get that overlaps this.
- * @return {array} Array with tiles informations (each contains x, y, and the tile).
- */
- getTileOverlaps: function (object) {
-
- this._tempBlockResults.length = 0;
-
- // If the object is outside of the world coordinates then abort the check (tilemap has to exist within world bounds)
- if (object.body.x < 0 || object.body.x > this.widthInPixels || object.body.y < 0 || object.body.bottom > this.heightInPixels)
- {
- return this._tempBlockResults;
- }
-
- // What tiles do we need to check against?
- this._tempTileX = this.game.math.snapToFloor(object.body.x, this.tileWidth) / this.tileWidth;
- this._tempTileY = this.game.math.snapToFloor(object.body.y, this.tileHeight) / this.tileHeight;
- this._tempTileW = (this.game.math.snapToCeil(object.body.width, this.tileWidth) + this.tileWidth) / this.tileWidth;
- this._tempTileH = (this.game.math.snapToCeil(object.body.height, this.tileHeight) + this.tileHeight) / this.tileHeight;
-
- // Loop through the tiles we've got and check overlaps accordingly (the results are stored in this._tempTileBlock)
- this.getTempBlock(this._tempTileX, this._tempTileY, this._tempTileW, this._tempTileH, true);
-
- for (var r = 0; r < this._tempTileBlock.length; r++)
- {
- // separateTile: function (object, x, y, width, height, mass, collideLeft, collideRight, collideUp, collideDown, separateX, separateY)
- if (this.game.physics.separateTile(object, this._tempTileBlock[r].x * this.tileWidth, this._tempTileBlock[r].y * this.tileHeight, this.tileWidth, this.tileHeight, this._tempTileBlock[r].tile.mass, this._tempTileBlock[r].tile.collideLeft, this._tempTileBlock[r].tile.collideRight, this._tempTileBlock[r].tile.collideUp, this._tempTileBlock[r].tile.collideDown, this._tempTileBlock[r].tile.separateX, this._tempTileBlock[r].tile.separateY))
- {
- this._tempBlockResults.push({ x: this._tempTileBlock[r].x, y: this._tempTileBlock[r].y, tile: this._tempTileBlock[r].tile });
- }
- }
-
- return this._tempBlockResults;
-
- },
-
- /**
- * Get a tile block with its position and size (this method does not return, it'll set result to _tempTileBlock).
- * @method getTempBlock
- * @param {number} [x] - X position (in tiles) of block's left-top corner.
- * @param {number} [y] - Y position (in tiles) of block's left-top corner.
- * @param {number} [width] - width of block.
- * @param {number} [height] - height of block.
- * @param {boolean} collisionOnly - Whethor or not ONLY return tiles which will collide (its allowCollisions value is not Collision.NONE).
- */
- getTempBlock: function (x, y, width, height, collisionOnly) {
-
- if (typeof collisionOnly === "undefined") { collisionOnly = false; }
-
- if (x < 0)
- {
- x = 0;
- }
-
- if (y < 0)
- {
- y = 0;
- }
-
- if (width > this.widthInTiles)
- {
- width = this.widthInTiles;
- }
-
- if (height > this.heightInTiles)
- {
- height = this.heightInTiles;
- }
-
- this._tempTileBlock = [];
-
- for (var ty = y; ty < y + height; ty++)
- {
- for (var tx = x; tx < x + width; tx++)
- {
- if (collisionOnly)
- {
- // We only want to consider the tile for checking if you can actually collide with it
- if (this.mapData[ty] && this.mapData[ty][tx] && this.parent.tiles[this.mapData[ty][tx]].collideNone == false)
- {
- this._tempTileBlock.push({
- x: tx,
- y: ty,
- tile: this.parent.tiles[this.mapData[ty][tx]]
- });
- }
- }
- else
- {
- if (this.mapData[ty] && this.mapData[ty][tx])
- {
- this._tempTileBlock.push({
- x: tx,
- y: ty,
- tile: this.parent.tiles[this.mapData[ty][tx]]
- });
- }
- }
- }
- }
- },
-
- /**
- * Get the tile index of specific position (in tiles).
- * @method getTileIndex
- * @param {number} x - X position of the tile.
- * @param {number} y - Y position of the tile.
- * @return {number} Index of the tile at that position. Return null if there isn't a tile there.
- */
- getTileIndex: function (x, y) {
-
- if (y >= 0 && y < this.mapData.length)
- {
- if (x >= 0 && x < this.mapData[y].length)
- {
- return this.mapData[y][x];
- }
- }
-
- return null;
-
- },
-
- /**
- * Add a column of tiles into the layer.
- * @method addColumn
- * @param {string[]|number[]} column - An array of tile indexes to be added.
- */
- addColumn: function (column) {
-
- var data = [];
-
- for (var c = 0; c < column.length; c++)
- {
- data[c] = parseInt(column[c]);
- }
-
- if (this.widthInTiles == 0)
- {
- this.widthInTiles = data.length;
- this.widthInPixels = this.widthInTiles * this.tileWidth;
- }
-
- this.mapData.push(data);
-
- this.heightInTiles++;
- this.heightInPixels += this.tileHeight;
-
- },
-
- /**
- * Description.
- * @method createCanvas
- */
- createCanvas: function () {
-
- var width = this.game.width;
- var height = this.game.height;
-
- if (this.widthInPixels < width)
- {
- width = this.widthInPixels;
- }
-
- if (this.heightInPixels < height)
- {
- height = this.heightInPixels;
- }
-
- this.canvas = Phaser.Canvas.create(width, height);
- this.context = this.canvas.getContext('2d');
-
- this.baseTexture = new PIXI.BaseTexture(this.canvas);
- this.texture = new PIXI.Texture(this.baseTexture);
- this.sprite = new PIXI.Sprite(this.texture);
-
- this.parent.addChild(this.sprite);
-
- },
-
- createQuadTree: function (width, height) {
-
- this.quadTree = new Phaser.QuadTree(this, 0, 0, width, height, 20, 4);
-
- },
-
- /**
- * Update boundsInTiles with widthInTiles and heightInTiles.
- * @method updateBounds
- */
- updateBounds: function () {
-
- this.boundsInTiles.setTo(0, 0, this.widthInTiles, this.heightInTiles);
-
- },
-
- /**
- * Parse tile offsets from map data.
- * Basically this creates a large array of objects that contain the x/y coordinates to grab each tile from
- * for the entire map. Yes we could calculate this at run-time by using the tile index and some math, but we're
- * trading a quite small bit of memory here to not have to process that in our main render loop.
- * @method parseTileOffsets
- * @return {number} Length of tileOffsets array.
- */
- parseTileOffsets: function () {
-
- this.tileOffsets = [];
-
- var i = 0;
-
- if (this.mapFormat == Phaser.Tilemap.JSON)
- {
- // For some reason Tiled counts from 1 not 0
- this.tileOffsets[0] = null;
- i = 1;
- }
-
- for (var ty = this.tileMargin; ty < this.tileset.height; ty += (this.tileHeight + this.tileSpacing))
- {
- for (var tx = this.tileMargin; tx < this.tileset.width; tx += (this.tileWidth + this.tileSpacing))
- {
- this.tileOffsets[i] = {
- x: tx,
- y: ty
- };
- i++;
- }
- }
-
- return this.tileOffsets.length;
-
- }
-
-};
-
-/**
-* Get
-* @return {Description}
-*//**
-* Set
-* @param {Description} value - Description.
-*/
-Object.defineProperty(Phaser.TilemapLayer.prototype, 'alpha', {
-
- get: function() {
- return this._alpha;
- },
-
- set: function(value) {
-
- if (this.sprite)
- {
- this.sprite.alpha = value;
- }
-
- this._alpha = value;
- }
-
-});
diff --git a/src/tilemap_old/TilemapRenderer.js b/src/tilemap_old/TilemapRenderer.js
deleted file mode 100644
index b37dfbc4..00000000
--- a/src/tilemap_old/TilemapRenderer.js
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
-* @author Richard Davey
-* @copyright 2013 Photon Storm Ltd.
-* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
-* @module Phaser.TilemapRenderer
-*/
-
-/**
-* Tilemap renderer.
-*
-* @class Phaser.TilemapRenderer
-* @constructor
-* @param {Phaser.Game} game - A reference to the currently running game.
-*/
-Phaser.TilemapRenderer = function (game) {
-
- /**
- * @property {Phaser.Game} game - A reference to the currently running game.
- */
- this.game = game;
-
- /**
- * @property {number} _ga - Local rendering related temp vars to help avoid gc spikes through constant var creation.
- * @private
- * @default
- */
- this._ga = 1;
-
- /**
- * @property {number} _dx - Description.
- * @private
- * @default
- */
- this._dx = 0;
-
- /**
- * @property {number} _dy - Description.
- * @private
- * @default
- */
- this._dy = 0;
-
- /**
- * @property {number} _dw - Description.
- * @private
- * @default
- */
- this._dw = 0;
-
- /**
- * @property {number} _dh - Description.
- * @private
- * @default
- */
- this._dh = 0;
-
- /**
- * @property {number} _tx - Description.
- * @private
- * @default
- */
- this._tx = 0;
-
- /**
- * @property {number} _ty - Description.
- * @private
- * @default
- */
- this._ty = 0;
-
- /**
- * @property {number} _tl - Description.
- * @private
- * @default
- */
- this._tl = 0;
-
- /**
- * @property {number} _maxX - Description.
- * @private
- * @default
- */
- this._maxX = 0;
-
- /**
- * @property {number} _maxY - Description.
- * @private
- * @default
- */
- this._maxY = 0;
-
- /**
- * @property {number} _startX - Description.
- * @private
- * @default
- */
- this._startX = 0;
-
- /**
- * @property {number} _startY - Description.
- * @private
- * @default
- */
- this._startY = 0;
-
-};
-
-Phaser.TilemapRenderer.prototype = {
-
- /**
- * Render a tilemap to a canvas.
- * @method render
- * @param tilemap {Tilemap} The tilemap data to render.
- * @return {boolean} Description.
- */
- render: function (tilemap) {
-
- // Loop through the layers
- this._tl = tilemap.layers.length;
-
- for (var i = 0; i < this._tl; i++)
- {
- if (tilemap.layers[i].visible == false || tilemap.layers[i].alpha < 0.1)
- {
- continue;
- }
-
- var layer = tilemap.layers[i];
-
- // Work out how many tiles we can fit into our canvas and round it up for the edges
- this._maxX = this.game.math.ceil(layer.canvas.width / layer.tileWidth) + 1;
- this._maxY = this.game.math.ceil(layer.canvas.height / layer.tileHeight) + 1;
-
- // And now work out where in the tilemap the camera actually is
- this._startX = this.game.math.floor(this.game.camera.x / layer.tileWidth);
- this._startY = this.game.math.floor(this.game.camera.y / layer.tileHeight);
-
- // Tilemap bounds check
- if (this._startX < 0)
- {
- this._startX = 0;
- }
-
- if (this._startY < 0)
- {
- this._startY = 0;
- }
-
- if (this._maxX > layer.widthInTiles)
- {
- this._maxX = layer.widthInTiles;
- }
-
- if (this._maxY > layer.heightInTiles)
- {
- this._maxY = layer.heightInTiles;
- }
-
- if (this._startX + this._maxX > layer.widthInTiles)
- {
- this._startX = layer.widthInTiles - this._maxX;
- }
-
- if (this._startY + this._maxY > layer.heightInTiles)
- {
- this._startY = layer.heightInTiles - this._maxY;
- }
-
- // Finally get the offset to avoid the blocky movement
- this._dx = -(this.game.camera.x - (this._startX * layer.tileWidth));
- this._dy = -(this.game.camera.y - (this._startY * layer.tileHeight));
-
- this._tx = this._dx;
- this._ty = this._dy;
-
- // Alpha
- if (layer.alpha !== 1)
- {
- this._ga = layer.context.globalAlpha;
- layer.context.globalAlpha = layer.alpha;
- }
-
- layer.context.clearRect(0, 0, layer.canvas.width, layer.canvas.height);
-
- for (var row = this._startY; row < this._startY + this._maxY; row++)
- {
- this._columnData = layer.mapData[row];
-
- for (var tile = this._startX; tile < this._startX + this._maxX; tile++)
- {
- if (layer.tileOffsets[this._columnData[tile]])
- {
- layer.context.drawImage(
- layer.tileset,
- layer.tileOffsets[this._columnData[tile]].x,
- layer.tileOffsets[this._columnData[tile]].y,
- layer.tileWidth,
- layer.tileHeight,
- this._tx,
- this._ty,
- layer.tileWidth,
- layer.tileHeight
- );
-
- if (tilemap.tiles[this._columnData[tile]].collideNone == false)
- {
- layer.context.fillStyle = 'rgba(255,255,0,0.5)';
- layer.context.fillRect(this._tx, this._ty, layer.tileWidth, layer.tileHeight);
- }
- }
-
-
- this._tx += layer.tileWidth;
-
- }
-
- this._tx = this._dx;
- this._ty += layer.tileHeight;
-
- }
-
- if (this._ga > -1)
- {
- layer.context.globalAlpha = this._ga;
- }
-
- // Only needed if running in WebGL, otherwise this array will never get cleared down I don't think!
- if (this.game.renderType == Phaser.WEBGL)
- {
- PIXI.texturesToUpdate.push(layer.baseTexture);
- }
-
- }
-
- return true;
-
- }
-
-};
\ No newline at end of file