Commit graph

2925 commits

Author SHA1 Message Date
tfelix
734eba7f84 Asset packs are now correctly spliced between waiting files. 2015-11-15 02:48:05 +01:00
photonstorm
8b0224e7b4 TilemapParser accidentally redeclared i when parsing the ImageCollections which would cause an infinite loop (thanks DanHett) 2015-11-12 13:39:42 +00:00
Javier Alcantara
840b49b6cd Tween hasStarted parameter set to false when tween finishes 2015-11-11 18:39:05 +01:00
photonstorm
1c169ef571 Video jsdoc fixes. 2015-11-02 11:51:15 +00:00
Richard Davey
799efa3079 You can use the new const Phaser.PENDING_ATLAS as the texture key for any sprite. Doing this then sets the key to be the frame argument (the frame is set to zero). This allows you to create sprites using load.image during development, and then change them to use a Texture Atlas later in development by simply searching your code for 'PENDING_ATLAS' and swapping it to be the key of the atlas data. 2015-10-31 01:04:14 +00:00
Jonathan Janisch
24c85dbb35 Inconsistency in arcade.collide processCallback param order #667 2015-10-27 23:48:14 -04:00
mattrick
518c2f6ab7 Merge branch 'dev' of https://github.com/mattrick16/phaser into dev 2015-10-27 17:00:10 -07:00
mattrick
8843a4ad09 Add worldAngleToPointer 2015-10-27 16:55:23 -07:00
nlotz
da45d04a70 fix typos in API docs 2015-10-27 09:10:14 +01:00
puzzud
c31d8dc78a Reinstated fix for #1285, regarding setting Phaser.SinglePad.callbackContext in addCallbacks method. 2015-10-24 20:13:49 -04:00
puzzud
492fdc98eb Phaser.SinglePad.addCallbacks now sets member callbackContext to the first parameter, context. 2015-10-24 20:01:44 -04:00
Ben Abbott
1dadaf5590 Remove unnecessary variable
This commit removes an unnecessary variable which was defined, populated but never used.
2015-10-22 13:47:06 +13:00
Richard Davey
e6aa9f83c9 Typo fix. 2015-10-19 23:18:23 +01:00
photonstorm
efc69ff463 Buttons (or any Sprites) that don't have a texture, but have children, would incorrectly render the children under WebGL due to the baseTexture.skipRender property (thanks @puzzud #2141) 2015-10-16 16:44:51 +01:00
photonstorm
8a4a1528e4 Preparing for 2.4.5 dev. 2015-10-15 12:22:01 +01:00
photonstorm
d5f1b43a2d Added skipRender to FastSpriteBatch. 2015-10-15 11:42:53 +01:00
photonstorm
99751a5e8e BaseTexture.skipRender is a new boolean that can be set to skip the rendering phase in the WebGL Sprite Batch. You may want to do this if you have a parent Sprite with no visible texture (i.e. uses the internal __default texture) that has children that you do want to render, without causing a batch flush in the process. 2015-10-15 11:39:59 +01:00
photonstorm
79d6993f26 Fixed issue with Time.update not being properly set in IE9 / setTimeout environments. 2015-10-13 14:23:36 +01:00
photonstorm
d1233ad229 Phaser 2.4.4 RC1. 2015-10-13 14:10:55 +01:00
photonstorm
45d92d4217 ScaleMin and ScaleMax stopped working in Phaser 2.3.0 due to an incorrect transform callback scope (thanks @brianbunch #2132) 2015-10-13 13:32:55 +01:00
photonstorm
bd53b61ffd Sprite.getBounds would report an inaccurate value if the sprite was negatively scaled (causing things like generateTexture to be cut off) (thanks @DavidAPC #2108) 2015-10-13 13:02:49 +01:00
photonstorm
84373dc478 Removed use of the tilePosition property in the Phaser.Rope class as it isn't implemented and caused calls to Rope.reset to crash (thanks @spayton #2135) 2015-10-13 12:20:02 +01:00
photonstorm
8e4dc1f078 ScaleManager.getParentBounds now checks if parentNode has an offsetParent before calling getBoundingClientRect on it (thanks @McFarts #2134) 2015-10-13 12:04:57 +01:00
photonstorm
b91de47d8d Readme and JSDocs updates. 2015-10-13 12:01:08 +01:00
Richard Davey
3ee59f1de3 Merge pull request #2118 from pnstickne/wip-2031
Created Phaser.KeyCode enumeration / pseudo-type
2015-10-13 13:56:46 +03:00
Richard Davey
e097a1227e Merge pull request #2052 from nickryall/fix-for-text-centered-on-sprite
adjust wrapped text that is centered to sprite via anchor
2015-10-13 13:50:11 +03:00
Richard Davey
5f704f0b0f Merge pull request #2130 from noidexe/patch-5
Better default value for suggestedFps
2015-10-13 13:47:15 +03:00
Richard Davey
4e208c74ce Merge pull request #2128 from nlotz/nlotz-loader-cache-addbitmapfont-apply-default-spacing
Fixes for Cache::addBitmapFont(...)
2015-10-13 13:43:50 +03:00
photonstorm
c79a341c58 Fixed jshint errors. 2015-10-12 12:23:48 +01:00
photonstorm
e01a754732 Removed the FrameDebugger and moved to its own branch. 2015-10-12 11:10:37 +01:00
Lisandro Lorea
dea95ec6f6 Better default value for suggestedFps
In any game that handles fps issues as seen in http://phaser.io/examples/v2/time/slow-down-time the game will hang if game.fpsProblemNotifier fires early on, before game.time.suggestedFps has any value other than null. 

The docs recommend waiting a few seconds before accesing suggestedFps. Since it's hard to tell exactly how long "a few seconds" is, shouldn't suggestedFps be initialized to the same value as desidedFps? 

I think it's better to get an inaccurate value for a few frames than an invalid value. It means users don't have to care about the specifics of how and when suggestedFps gets its value.
2015-10-09 16:14:52 -03:00
Nikolas Lotz
6d4dad7bb4 Apply default X/Y-Spacing
Applies default X/Y-Spacing when omitted as a parameter
2015-10-08 20:14:16 +02:00
Richard Davey
8dc8d7dd72 Added fd to the renderSession to stop the FrameDebugger breaking in TilingSprite under WebGL. 2015-10-07 22:15:20 +01:00
Richard Davey
3d5fac1817 Merge pull request #2111 from jdnichollsc/master
Takes any transforms into account to get the correct parent bounds
2015-10-06 19:08:02 +03:00
photonstorm
bf0bd9657e Updated readme and build scripts. 2015-09-30 11:20:14 +01:00
photonstorm
9013107fd1 The ScaleManager no longer creates a Phaser.FlexGrid if the class isn't available (i.e. excluded via a custom build) 2015-09-30 11:20:00 +01:00
photonstorm
e31c7d1f5a Fixed issue with TileSprites not excluding correctly from custom builds. 2015-09-30 11:19:29 +01:00
photonstorm
6d0aa613ad New Create stub added for the custom build process. Cuts file size by 8KB. 2015-09-30 11:19:05 +01:00
photonstorm
6fd2b6a7ec Phaser.Create no longer automatically creates a BitmapData object when it starts. It now only does it when you first make a texture or grid. 2015-09-30 11:18:53 +01:00
Paul
531cd49f06 Created Phaser.KeyCode enumeration / pseudo-type
- Impact: none/foward-migration; fully backwards compatible

- Moves the key code constants in Keyboard to a KeyCode type.
  - Duplicates the KeyCodes in the Keyboard object for backward
    compatiblity.
  - KeyCode properties are listed in documentation

- Updates documentaion to refer to Phaser.KeyCode

- Adds in future 'keycode' expansion capabilities,
  as indicated by the KeyCode documentation, if the constants
  are used in code.

Closes #2031
2015-09-29 17:59:26 -07:00
Richard Davey
884acb0616 New Scale Manager stub added. Removes all Scale Manager handling from Phaser! But saves 75KB in the process. If you know you don't need to scale the Phaser canvas, or are handling that externally, then you can safely stub it out in a custom build. 2015-09-29 16:06:49 +01:00
Richard Davey
c1d0ec0f34 Local vars to reduce file size. 2015-09-29 16:06:44 +01:00
Richard Davey
8d5e27a49f New DOM stub added for the custom build process. Contains just the bare minimum of functions that Phaser needs to work. Cuts file size from 14.8KB to 2.4KB. Note: Do not stub this out if using the full Scale Manager. 2015-09-29 16:06:27 +01:00
Richard Davey
64eebbb6d2 New Color stub added for the custom build process. Contains just the bare minimum of functions that Phaser needs to work. Cuts file size from 48.7KB to 7.4KB. Note: Do not stub this out if using BitmapData objects. 2015-09-29 16:06:15 +01:00
Richard Davey
8899eddd9a BitmapData.clear now automatically calls BitmapData.update at the end of it. 2015-09-29 14:02:26 +01:00
Richard Davey
5a275f14a8 Removing dead code. 2015-09-28 03:26:27 +01:00
Richard Davey
84a566bf79 Added guard around the blend mode setter. 2015-09-27 01:44:38 +01:00
Richard Davey
cbf9b3f71f WebGLRenderer.mapBlendModes optimised to cut down on file size. 2015-09-26 00:58:02 +01:00
Juan David Nicholls Cardona
8ce70cbeb4 Takes any transforms into account to get the correct parent bounds 2015-09-25 15:42:29 -05:00
Nikolas Lotz
33503e7fa7 adds missing API doc param to addBitmapFont()
added missing API doc parameter "atlasType" to Cache::addBitmapFont(...)
2015-09-24 19:18:04 +02:00
Richard Davey
d0930bc161 Keyboard.addCallbacks didn't check to see if the arguments were null, only if they were undefined making the jsdocs misleading. 2015-09-23 23:18:36 +01:00
photonstorm
832034af94 Typo fix. 2015-09-23 14:04:04 +01:00
Richard Davey
cffc90ebbc Merge pull request #2107 from JackMorganNZ/master
Corrected spelling: 'mainted' to 'maintained'
2015-09-23 11:21:21 +03:00
Jack Morgan
589b9b8edd Corrected spelling: 'mainted' to 'maintained' 2015-09-23 12:03:54 +12:00
photonstorm
de5283b989 The default Button.onOverMouseOnly value has changed from false to true. If you used this in your touch enabled games then please be aware of this change (#2083) 2015-09-22 15:24:52 +01:00
photonstorm
0dee1157fc PIXI.WebGLRenderer.updateTexture now returns a boolean depending on if the texture was successfully bound to the gl context or not.
PIXI.WebGLSpriteBatch.renderBatch would still try and render a texture even if `updateTexture` failed to bind it. It now checks the return value from `updateTexture` and ignores failed binds.
2015-09-22 15:20:23 +01:00
photonstorm
2633f8ce6d InputHandler.validForInput now checks if the game object has input.enabled set to false and doesn't validate it for input if that's the case. 2015-09-22 15:20:23 +01:00
Richard Davey
9f08442304 Merge pull request #2103 from pnstickne/wip-2062
Fixes #2062 and forward-support for pointer modes
2015-09-22 17:14:32 +03:00
photonstorm
389b6dd1aa Fixed for jshint. 2015-09-22 12:07:14 +01:00
photonstorm
f64fc42f3e The SoundManager now detects if the browser is running under iOS9 and uses a touchend callback to unlock the audio subsystem. Previous versions of iOS (and Android) still use touchstart. This fixes Apple's screw-up with regard to changing the way Web Audio should be triggered in Mobile Safari. Thanks Apple (thanks @MyCatCarlos for the heads-up #2095) 2015-09-22 11:46:58 +01:00
photonstorm
d16de32fe3 Device.iOSVersion now contains the major version number of iOS. 2015-09-22 11:46:20 +01:00
photonstorm
27457c2b0f Touch.addTouchLockCallback has a new argument onEnd which allows the callback to fire either on a touchstart or a touchend event. 2015-09-22 11:46:08 +01:00
Paul
31e5202eff Fixes #2062 and forward-support for pointer modes
Impact:
  - *none for touch devices*
  - *low* / 'expected behavior' for mouse devices

Adds a PointerMode enumeration value for better simple input
discrimination in the future.

The added Button#justReleasedPreventsOver controls if a just-release event
on a pointer prevents it from being able to trigger an over event.

The default value is PointerMode.CONTACT which means this 'release guard'
applies only to touch inputs.

It should fix #2062 as Mouse (PointerMode.CURSOR) input is not caught in the default.

Also expands Button#forceOut to accept a PointerMode value such that it
can be controlled per-input mode.

This is a configurable partial revert of a possibly rogue commit in 2.1.3
and the behavior persists through 2.4.3.
2015-09-22 01:12:43 -07:00
Richard Davey
d86d01bd25 Camera.setBoundsToWorld only adjusts the bounds if it exists (thanks @prudolfs #2099) 2015-09-20 21:07:28 +01:00
Richard Davey
4143b3f3ae rnd check fix. 2015-09-19 11:58:25 +01:00
Richard Davey
96de58cc5f Added lots more info to the jsdocs and tidied up the code for #2056 2015-09-19 11:50:26 +01:00
Richard Davey
a445a9943f Merge pull request #2056 from luckylooke/featGeneratorState
Feature: Allow random generator to get/set state
2015-09-19 13:19:19 +03:00
Richard Davey
9f0628e2bc Merge pull request #2093 from Garbanas/feature/p2-phaser-polygon
(Resource: PhysicsEditor Exporter) Add option to prefix shape name and optimize JSON output
2015-09-19 13:14:14 +03:00
Richard Davey
11de8b1944 Merge pull request #2097 from pnstickne/wip-2092
Fixes edge case when TilingSprite removed before render
2015-09-19 13:09:53 +03:00
Paul
48566e74c5 Fixes edge case when TilingSprite removed before render
- Issues caused when TilingSprite is destroyed before it has
  ever been rendered because `canvasBuffer` not created yet.

Fixes #2092
2015-09-18 20:34:13 -07:00
Christoph Dörfel
a8c4930d42 Add JsDoc comment for Body#addPhaserPolygon return value 2015-09-17 12:11:49 +02:00
photonstorm
b011146a87 Fixed lint errors. 2015-09-16 13:55:33 +01:00
photonstorm
e64f9647db Better output. Need to fix jshint errors next. 2015-09-16 13:36:53 +01:00
photonstorm
09e8d465e4 Lots more work on the FrameDebugger. Just need texture preview and then can test it properly. 2015-09-16 13:17:06 +01:00
Christoph Dörfel
4c9412088c Add option to prefix shape name and optimize JSON output 2015-09-16 14:00:24 +02:00
Richard Davey
61edd1b458 FrameDebugger can now handle Text and BitmapText. 2015-09-16 03:18:15 +01:00
Richard Davey
b89f6dd3b4 Much improved final output and logging process. 2015-09-16 02:25:57 +01:00
Richard Davey
29b4bb3174 :) 2015-09-16 02:25:40 +01:00
Richard Davey
66aca82084 Removed duplicate call. 2015-09-16 02:25:32 +01:00
Richard Davey
4828415d97 Merge pull request #2090 from pnstickne/wip-2088
Updated documentation to clarify 'types' of time
2015-09-15 19:12:02 +03:00
Richard Davey
b6a67cc795 Merge pull request #2091 from noidexe/patch-4
Fix for tile ids between 0x7FFFFFFF and 0xFFFFFFFF
2015-09-15 19:11:36 +03:00
photonstorm
3be0ed8849 FrameDebugger now hooked into Canvas Renderer. Better output coming. 2015-09-15 16:14:14 +01:00
photonstorm
4c5dfc4847 Optimised getSmoothingEnabled, setSmoothingEnabled and setImageRenderingCrisp. 2015-09-15 14:18:00 +01:00
photonstorm
b9fcb7f179 Optimised size of PIXI.CanvasRenderer.mapBlendModes and started removal of options object. 2015-09-15 13:54:17 +01:00
photonstorm
646380f710 Tweaked Canvas.getSmoothingEnabled and Canvas.setSmoothingEnabled to early out on more common browsers.
Added Canvas.getSmoothingPrefix
2015-09-15 13:43:52 +01:00
photonstorm
4125e42a06 Sorted out setting the Stage backgroundColor. Much more concise now. 2015-09-15 13:34:07 +01:00
photonstorm
5f77c70309 jsdoc fix. 2015-09-15 13:33:42 +01:00
photonstorm
8069560aaf No longer needed. 2015-09-15 12:53:44 +01:00
photonstorm
6784a9c1df Optimised render loop slightly. Moved properties to game. 2015-09-15 12:53:44 +01:00
photonstorm
ff254ec33b Added clearBeforeRender boolean. 2015-09-15 12:53:44 +01:00
photonstorm
0ee95b22d6 Fixed rogue comma. 2015-09-15 12:53:44 +01:00
photonstorm
b99c9e22ec Removed PIXI.Stage. Phaser.Stage now handles everything it needs to do. 2015-09-15 12:53:44 +01:00
photonstorm
705cacf2ca Sorting out the Stage background color assignment so we can drop a boolean check in the render method. 2015-09-15 12:53:43 +01:00
photonstorm
5a1a918a5d Added FrameDebugger.
Tidying up the renderer constructors.
2015-09-15 12:53:43 +01:00
photonstorm
06ed961e81 Added FrameDebugger into the mix. 2015-09-15 12:53:43 +01:00
photonstorm
5ceb9914b9 Bumped verison number. Removed default render options (as they're set in Phaser.Game). 2015-09-15 12:53:43 +01:00
photonstorm
daef7d5bfc Consolidating Pixi into Phaser. Removed options object, values all game from Game anyway so it saves space. Starting to move to jsdocs from yuidocs. 2015-09-15 12:53:43 +01:00
Lisandro Lorea
daff43fd77 Fix for tile ids between 0x7FFFFFFF and 0xFFFFFFFF
2147483647 tile ids should be enough for anybody, but it is now working for any valid tile id.
2015-09-15 01:36:13 -03:00
Paul
9733fb4ec2 Updated documentation to clarify 'types' of time
- Added 'Types of time' description and cross-links
- Also some general documentation update for Timer
  - Type specialization

Ref #2088
2015-09-14 20:21:47 -07:00
Lisandro Lorea
f52ca58d7d Correctly interpret binaryString as a sequence of uint32-le values
The previous implementation was ignoring the 3 most significant bytes of each value and would result on improper parsing of any map with tile ids higher than 255
2015-09-14 20:38:58 -03:00
photonstorm
a8e972b25a Under setTimeOut (or when forceSetTimeOut was true) the Time was incorrectly setting Time.timeExpected causing game updates to lag (thanks @satan6 #2087) 2015-09-14 16:31:16 +01:00
photonstorm
5c30a228bb Fixed assignment of TEXTURE_ATLAS_JSON_PYXEL constant (#2050) 2015-09-14 11:23:31 +01:00
Richard Davey
1c7b33107f Merge pull request #2050 from joshpmcghee/dev
Feature: Add support for loading single-layer Pyxel Edit TileMap as an Atlas
2015-09-14 13:21:21 +03:00
Richard Davey
f8ef567641 Merge pull request #2081 from pnstickne/wip-inputhandler-docs2
Fixes incorrect "Pointer" type documentation and parameter names in InputHandler
2015-09-14 13:15:08 +03:00
Lisandro Lorea
8528f0c700 Fixed variable naming style 2015-09-13 12:15:02 -03:00
Lisandro Lorea
308ce6b57c Add support for TiledJSON with base64 encoding
Tiled 0.13.0 added support for layer data compression when exporting as LUA or JSON. This means that any .tmx stored unsing base64 encoding will start exporting layer data as a base64 encoded string rather than a native array. 
Phaser would try to load the level anyway without emitting any errors, resulting in a corrupted level while playing. 
This PR adds detection and support for base64 encoded levels as long as they don't use compression.
2015-09-13 12:07:57 -03:00
Paul
4474b8fde3 Fixes incorrect type and parameter names
- Impact: none; documentation and local variable names only

- Incorrect documentation that claimed to take a Pointer when they really
  took a Pointer ID is fixed

- Also updates parameter names for consistenct/clarity
2015-09-12 17:32:40 -07:00
photonstorm
816bcaca75 Missing physicsElapsed value reset. 2015-09-10 16:05:15 +01:00
photonstorm
8db23545da jsdoc updates. 2015-09-10 15:57:55 +01:00
Richard Davey
96dae9bf2e Merge pull request #2055 from pmcmonagle/dev
Added useCapture flags to removeEventListener where approriate
2015-09-10 00:03:19 +03:00
Richard Davey
6c9e43ad36 DeviceButton was setting a duration property on itself, which went against the read only getter of duration (thanks @winstonwolff) 2015-09-09 21:58:50 +01:00
photonstorm
90a500ec1e Game.update could call updateLogic multiple times in a single frame when catching up with slow device frame rates. This would cause Tweens to advance at twice the speed they should have done (thanks @mkristo)
Time.desiredFpsMult is a pre-calculated multiplier used in Game.update.

Time.refresh updates the `Time.time` and `Time.elapsedMS` values and is called automatically by Game.update.
2015-09-09 12:09:18 +01:00
Richard Davey
aaecf14c12 Merge pull request #2069 from Pappa/master
Fix for AudioBufferSourceNode listener memory leak.
2015-09-08 21:40:19 +03:00
Pappa
12d24d3677 Fix for AudioBufferSourceNode listener memory leak.
In Chrome, the AudioBufferSourceNode onended listeners were never being garbage collected. This frees up the listener for collection.
2015-09-08 17:56:17 +01:00
photonstorm
2de83328d9 Testing Tween timer fix. 2015-09-08 17:44:28 +01:00
photonstorm
7487c15f0e Doc updates. 2015-09-08 15:56:28 +01:00
photonstorm
dbcff585e0 Time.desiredFps has moved to a getter / setter.
Time.physicsElapsed and Time.physicsElapsedMS are no longer calculated every frame, but only when the desiredFps is changed.
Time.update has been streamlined and the `updateSetTimeout` and `updateRAF` methods merged and duplicate code removed.
2015-09-08 15:56:19 +01:00
luckylooke
63f5df9c65 Feature: Allow random generator to get/set state 2015-09-07 21:47:36 +02:00
Richard Davey
d7a42370a4 BitmapData.move, moveH and moveV have a new optional wrap argument allowing you to control if the contents of the BitmapData are wrapped around the edges (true) or simply scrolled off (false). 2015-09-07 01:16:43 +01:00
Richard Davey
8210d4faa1 Removed tween console.log for now. 2015-09-07 00:26:03 +01:00
Paul McMonagle
ad38fff083 Reordered removeEventListener calls to match addEventListener order 2015-09-04 17:11:50 -04:00
Richard Davey
1e7f8dddd9 jsdoc fix. 2015-09-03 00:46:48 +01:00
Richard Davey
38eca4d5b9 Filter.addToWorld allows you to quickly create a Phaser.Image object at the given position and size, with the Filter ready applied to it. This can eliminate lots of duplicate code. 2015-09-03 00:46:47 +01:00
Paul McMonagle
c2bf22ef7c Added useCapture flags to removeEventListener where approriate
Event listeners added with true passed in as the useCapture flag are only removed when true is also passed into the removeEventListener call. Adding this flag to the stop method where appropriate fixes a memory leak in IE where events on window are never removed.

See https://msdn.microsoft.com/en-us/library/ff975250(v=vs.85).aspx
2015-09-02 14:36:49 -04:00
photonstorm
37fc327ea7 Tween elapsed debug. 2015-09-02 16:58:51 +01:00
photonstorm
8833a509eb jsdoc fix. 2015-09-02 16:16:52 +01:00
nickryall
ca795af457 adjust wrapped text that is centered to sprite via anchor 2015-09-02 10:50:03 +12:00
Josh McGhee
fb249b2a41 cleaning up to obey jshint 2015-09-01 01:10:56 +01:00
Josh McGhee
4a19aca212 some cleaning up and documentation polish 2015-09-01 01:03:51 +01:00
Josh McGhee
cbd7265bee cherry pick commits from master. Read: I'm not clever. 2015-09-01 00:57:54 +01:00
Richard Davey
41906c5ac1 When the Text width was being calculated it would add the strokeThickness value twice, causing an alignment offset (thanks @nickryall #2039) 2015-08-31 11:33:18 +01:00
Richard Davey
adcc5d3afb Merge pull request #2047 from Garbanas/feature/p2-remove-collision-group
Convenience function to remove a collision group from a P2 Body
2015-08-31 13:12:13 +03:00
Richard Davey
c10c7cdf2a Merge pull request #2044 from rblopes/dont-prefix-data-urls
Prevent 'data:' URLs from being prefixed
2015-08-31 13:08:22 +03:00
Richard Davey
af194d447c jsdoc fix #2049 2015-08-31 10:57:54 +01:00
Christoph Dörfel
96441fdb27 Set correct default value for 'clearCallback' on P2.Body.removeCollisionGroup 2015-08-30 01:30:33 +02:00
Christoph Dörfel
2623ddeaf7 Convenience function to remove a collision group from a P2 Body 2015-08-30 00:19:37 +02:00
Rafael Barbosa Lopes
1485fd110a Updated to use a matching expression instead.
Replaced the booleans with a matching expression. Now, URLs
beginning with the following patterns will be ignored:

- blob:
- data:
- http://
- https://
- //

As suggested by @pnstickne.
2015-08-28 17:19:24 -03:00
Rafael Barbosa Lopes
14632cdfb5 Prevent 'data:' URLs from being prefixed
Fixes an issue where 'data:' URLs may get prefixed by
`#baseURL` and `#path` properties making these URLs invalid.
2015-08-28 15:14:30 -03:00
photonstorm
32b0c98f7a Group.resetChild is a new method that allows you to call both child.reset and/or child.loadTexture on the given child object. This is used internally by getFirstDead and similar, but is made public so you can use it as a group iteration callback. Note that the child must have public reset and loadTexture methods to be valid for the call.
Group.getFirstDead, Group.getFirstAlive and Group.getFirstExists all have new optional arguments: `createIfNull`, `x`, `y`, `key` and `frame`. If the method you call cannot find a matching child (i.e. getFirstDead cannot find any dead children) then the optional `createIfNull` allows you to instantly create a new child in the group using the position and texture arguments to do so. This allows you to always get a child back from the Group and remove the need to do null checks and Group inserts from your game code. The same arguments can also be used in a different way: if `createIfNull` is false AND you provide the extra arguments AND a child is found then it will be passed to the new `Group.resetChild` method. This allows you to retrieve a child from the Group and have it reset and instantly ready for use in your game without any extra code.
2015-08-28 12:23:48 +01:00
photonstorm
f0d7da1c56 Removed RND.float as it's a reserved word :(
Fixed jshint errors.
2015-08-27 19:28:01 +01:00
photonstorm
b14510d1e7 Fixing some emitter issues with position. 2015-08-27 19:11:26 +01:00
photonstorm
9d1217ea21 Fixed the rnd calls. 2015-08-27 14:57:50 +01:00
photonstorm
ddcc46124c RandomDataGenerator.float is a new alias for the method 'realInRange' and takes the same arguments. 2015-08-27 14:57:23 +01:00
photonstorm
9798864cc6 Emitter.emitParticle now has 4 new optional arguments: x, y, key and frame. These allow you to override whatever the Emitter default values may be and emit the particle from the given coordinates and with a new texture. 2015-08-27 14:48:52 +01:00
Paul
26a6338072 Change splice.call(arguments, ..) to use slice
- Bypasses issue of usage incorrectly omitting 2nd argument to `splice`

- More clear of intent; `slice` does not modifify `arguments`

- `slice` is faster across all desktop browsers, by varying degrees
  - Probably due to parameter-aliasing and de-opts when modified.
  - Both `slice` and `splice` create a new Array object
2015-08-26 23:50:16 -07:00
Richard Davey
bae732ca9e Merge pull request #2027 from bsparks/dev
utilize the heal method
2015-08-26 23:38:40 +03:00
Richard Davey
a1bd35fc35 Tidied up formatting and improved jsdocs. 2015-08-26 19:13:46 +01:00
Richard Davey
b4a72b8747 Merge pull request #2025 from rwrountree/dev
Optimize the average function in math.js
2015-08-26 21:07:24 +03:00
Richard Davey
8b6d696316 jsdoc fix. 2015-08-26 03:59:18 +01:00
Ben Sparks
b7efb93698 utilize the heal method instead of just adding to health when reviving, so that maxHealth is respected 2015-08-25 14:42:02 -07:00