Commit graph

550 commits

Author SHA1 Message Date
photonstorm
f70e4d7d90 Fixed the use of the destroy parameter in Group.removeAll and related functions (thanks @AnderbergE, fix #717) 2014-04-14 12:57:29 +01:00
photonstorm
f33ba5dcc7 Timer has removed all use of local temporary vars in the core update loop.
Timer.clearPendingEvents will purge any events marked for deletion, this is run automatically at the start of the update loop.
The main Timer loop could incorrectly remove TimeEvent if a new one was added specifically during an event callback (thanks @garyyeap, fix #710)
2014-04-14 11:51:50 +01:00
photonstorm
0d15350755 Preparing for 2.0.4 development. 2014-04-11 14:29:38 +01:00
photonstorm
cdff873cf7 Updated change log and readme headers. 2014-04-11 13:28:17 +01:00
photonstorm
7b2c3e8e0f Updated header styles in readme. 2014-04-11 13:15:41 +01:00
photonstorm
4cea8d7bcc Preparing for final 2.0.3 release. Updated docs, readme and build files. 2014-04-11 13:09:28 +01:00
photonstorm
a2b2d558a5 jsdoc and jshint fixes. 2014-04-11 03:02:19 +01:00
photonstorm
3d7ca639c3 Fixed the vectors used in the BlurX and BlurY filters (thanks @nickryall, fix #668) 2014-04-11 01:01:47 +01:00
photonstorm
77f8e5eefc P2 Fixtures Collection Class (@georgiee please test it works ok! #704) 2014-04-11 00:43:30 +01:00
photonstorm
3a1c202e24 jsdoc fixes for SignalBindings. 2014-04-11 00:19:37 +01:00
photonstorm
a01cc2e1ca Objects with an InputHandler now deactivate it when the object is removed from a Group but not destroyed (fix #672)
Lots of jsdoc fixes in Body and World.
Removed un-used events from World (such as onImpact).
2014-04-11 00:06:22 +01:00
photonstorm
9ddcc5d0ea p2.World.defaultRestitution has been deprecated and is now p2.World.restitution.
p2.World.defaultFriction has been deprecated and is now p2.World.friction.
p2.World now uses 4 bodies for the world boundaries, rather than 1 body with 4 shapes. This helps the broadphase massively.
p2.World bounds are now included in the callback events such as beginContact and impact events.
2014-04-10 17:11:16 +01:00
photonstorm
780fb48ab3 P2.World has a new contactMaterial property, which can be configured like a normal P2 Contact Material and is applied when two bodies hit that don't have defined materials. 2014-04-10 14:51:20 +01:00
photonstorm
78aa24f04b Emitter.setScale now allows you to scale the x and y axis of the particles independently. 2014-04-10 05:18:06 +01:00
photonstorm
c8ca3d1809 Emitter now calls the Phaser.Particle.onEmit function, which is left empty for you to override and add in custom behaviours. 2014-04-10 01:37:10 +01:00
photonstorm
95b0532f59 Emitter.setScale has a new 'rate' parameter which allows particles to change in scale over time, using any Easing value or timescale.
Emitter.setAlpha has a new 'rate' parameter which allows particles to change alpha over time, using any Easing value or timescale.
Emitter.bringToTop and Emitter.sendToBack are booleans that let you optionally set the display order of the Particle when emitted.
2014-04-10 01:36:05 +01:00
photonstorm
770ced8ac1 Group.customSort allows you to sort the Group children based on your own sort function. 2014-04-10 00:56:53 +01:00
photonstorm
be52515ed4 PluginManager parent parameter removed as it's redundant. Also most core functions tidied up and jsdocs fixed. 2014-04-09 16:12:25 +01:00
photonstorm
50981fd729 Emitter now has minParticleAlpha and maxParticleAlpha values for setting a random alpha on emitted particles.
Emitter.particleAnchor allows you to control the anchor of emitted Particles. Defaults to 0.5 (same as before) but now under your control.
Emitter now emits Phaser.Particle objects instead of Phaser.Sprites, which can be extended as required.
Emitter has had various local properties removed that were already declared in Phaser.Group which it extends.
2014-04-09 14:29:23 +01:00
photonstorm
73d0414672 Grunt update to dev dependencies (thanks @xtian, #695) 2014-04-09 12:23:17 +01:00
photonstorm
b9cb2417b6 Group.removeBetween now properly iterates through the children. 2014-04-09 03:19:36 +01:00
photonstorm
01ccbd97c0 Key.enabled boolean allows you to toggle if a Key processes its update method or dispatches any events without deleting and re-creating it. 2014-04-09 02:29:41 +01:00
photonstorm
e764be430e Emitter.minParticleScale and maxParticleScale wasn't resetting the Body size correctly. 2014-04-09 00:59:53 +01:00
photonstorm
8fc2a465cd New Phaser package, small docs updates and preparing P2.World for new bounds code and v0.5.0 migration. 2014-04-08 03:31:13 +01:00
photonstorm
01eec6cef5 Keyboard.stop nulls the function references after removing the event listeners (thanks @bmceldowney, #691) 2014-04-07 12:29:26 +01:00
photonstorm
bf32590cfe Fixed a few jsdoc errors. 2014-04-07 12:29:26 +01:00
photonstorm
38d722c1e5 Tilemap.removeTile(x, y, layer) lets you remove the tile at the given coordinates and updates the collision data.
Tilemap.removeTileWorldXY lets you remove the tile at the given pixel value coordinates and updates the collision data.
If you pass `null` to Tilemap.putTile as the tile parameter it will pass the call over to Tilemap.removeTile.
2014-04-01 13:36:42 +01:00
photonstorm
61429d8467 StateManager.restart allows you to quickly restart the *current* state, optionally clearing the world and cache. 2014-04-01 11:25:04 +01:00
photonstorm
a4ed94e039 Key.reset now clears any callbacks associated with the onDown and onUp events and nulls the onHoldCallback if set. Key.reset is called by Keyboard.reset when changing state. 2014-04-01 04:41:43 +01:00
photonstorm
439cefd481 ArcadePhysics.Body.hitTest(x, y) will return a boolean based on if the given world coordinate are within the Body or not.
Fixed jsdoc method tags in Body.
2014-04-01 03:54:20 +01:00
photonstorm
03b80887f2 SoundManager.removeByKey(key) will remove all sounds from the SoundManager that have a key matching the given value. 2014-04-01 03:42:30 +01:00
photonstorm
3728f25d68 SoundManager.remove(sound) now lets you remove a sound from the SoundManager, destroying it in the process.
Sound.destroy will remove a sound and all local references it holds, optionally removing itself from the SoundManager as well.
2014-04-01 03:38:13 +01:00
photonstorm
1f32ef721d The Phaser Gruntfile is now split up into option tasks (thanks @xtian, #638) 2014-04-01 01:47:42 +01:00
photonstorm
5ed79dfefe The Phaser jshint process is now running on Travis (thanks @xtian, #656) 2014-04-01 01:24:49 +01:00
photonstorm
5559fea0f8 The State.update function (and thus the update of any sub-classed Sprites or other objects) is now called before Stage, Tweens, Sound, Input, etc (#662) 2014-04-01 01:01:15 +01:00
photonstorm
0198a77fe6 Phaser.Point.centroid static function added to calculate the centroid or midpoint of an array of points (thanks @lewster32, #675) 2014-04-01 00:42:13 +01:00
photonstorm
e3f1c7b21c Added Pointer.positionUp which records the last point at which the pointer left the screen / was raised (thanks @Cryszon ,#676) 2014-04-01 00:40:26 +01:00
photonstorm
3f8911d95f SoundManager.boot will check to see if the AudioContext was created before carrying on (thanks @keyle, fix #669) 2014-03-31 11:22:44 +01:00
photonstorm
16853d0e82 Updated to Pixi 1.5.2 release. 2014-03-31 11:04:02 +01:00
photonstorm
686706173a Timers can now have a start delay value (thanks @georgiee, #660) 2014-03-31 10:49:53 +01:00
photonstorm
1a92f5b7d0 If you inputEnable = false a gameobject you couldn't re-enable it again using inputEnable = true, only directly via the handler (thanks @nickrall, fix #673)
Updated the PhysicsEditor plugin to maintain position, radius, mask bits, category bits and sensor flags (thanks @georgiee, #674)
2014-03-31 10:43:43 +01:00
photonstorm
b01ad969ab Updated tutorial file 2014-03-30 20:52:27 +01:00
photonstorm
76c0913b37 Setting up for 2.0.3 development. 2014-03-28 02:18:58 +00:00
photonstorm
5b73bb21bb Sprite would glitch if it had an ArcadePhysics Body that was re-positioned out of loop.
Sprite would "fly off" if it had an ArcadePhysics Body that was re-positioned during an input handler.
Newly generated docs
2014-03-28 01:42:49 +00:00
Richard Davey
06c953a293 Merge pull request #647 from xtian/grunt-jshint
Run jshint as part of build process and fix jshint errors
2014-03-26 15:46:35 +00:00
photonstorm
fc0e239719 ArcadePhysics.Body preUpdate has been modified to stop Sprites with non-1 scaling from gaining delta and moving off the screen (fix #644).
Lots of ArcadePhysics.World methods have been marked as private where they shouldn't be called directly (separateX, etc)
2014-03-26 10:48:30 +00:00
Christian Wesselhoeft
12c5a1b534 Run jshint as part of build process. 2014-03-25 14:56:00 -07:00
photonstorm
344ab46d78 Line.fromSprite now sets "fromCenter" to false by default as Sprite.center is deprecated in 2.x. Documentation and Examples updated to reflect this. 2014-03-25 12:44:20 +00:00
photonstorm
6483b61db7 Tween.generateData would enter an eternal loop if the total resulted in a float. Now wrapped in Math.floor. 2014-03-25 03:08:51 +00:00
photonstorm
6651f6c394 Tutorial updated for Phaser 2 2014-03-24 23:38:52 +00:00
photonstorm
65e1ae51d8 Fixed small typos in the README. 2014-03-24 12:21:21 +00:00
photonstorm
622957c9b0 Timer objects incorrectly set the first tick value on events if you added the events prior to starting them. 2014-03-24 02:25:35 +00:00
photonstorm
e1c98ba617 You can now create multiple blank layers in a Tilemap. 2014-03-23 23:58:01 +00:00
photonstorm
0c156ccd90 Fixed some md issues in Contributing and Readme.
Fixed game reference in Emitter.
2014-03-23 12:07:55 +00:00
photonstorm
21c0be4d02 BitmapDatas when used as Game Object textures in WebGL now update themselves properly.
Timer.ms now correctly reports the ms time even if the Timer has been paused (thanks Nambew, fix #624)
2014-03-21 18:37:54 +00:00
photonstorm
0fa54b0b24 TileSprites now emit outOfBounds and enterBounds events accordingly.
TileSprites working with physics bodies again.
2014-03-21 18:04:24 +00:00
photonstorm
9c8f01cd7f The volume given in Sound.play now over-rides that set in Sound.addMarker if specified (fix #623) 2014-03-21 15:43:59 +00:00
photonstorm
0fca997d43 P2.Body.loadPolygon no longer modifies the Cache array (fix #613) 2014-03-21 13:46:35 +00:00
photonstorm
768bbaaec6 README updates. 2014-03-21 12:34:26 +00:00
photonstorm
b9fcda73ca ArcadePhysics.World.seperate will now check gravity totals to determine separation order. You can set World.forceX to true to always separate on X first and skip this check. 2014-03-21 11:22:56 +00:00
photonstorm
111164e221 If no seed was given in the Game config object, the RandomDataGenerator wouldn't be started (thank tylerjhutchison fix #619) 2014-03-21 11:22:56 +00:00
photonstorm
634b1d1093 Emitter.friction property removed and replaced with Emitter.particleDrag, which is now correctly applied.
ArcadePhysics.Body.reset incorrectly set the Body.rotation to Sprite.rotation instead of angle.
Emitter.emitParticle resets the rotation on the particle to zero before emitting it.
Lots of fixes to the TypeScript definitions file (thanks as always to clark-stevenson for his tireless work on these)
Emitters now bring the particle they are about to emit to the top of the Group before doing so. Avoids particles hidden behind others.
ArcadePhysics.Body.setSize corrected to take the parameters as positive, not negative values.
ArcadePhysics.Body now checks the Sprite scale automatically and adjusts the body size accordingly (fix #608)
Emitter.particleClass can now be set to any object that extends Phaser.Sprite, which will be emitted instead of a regular Sprite.
2014-03-20 03:48:54 +00:00
photonstorm
684ee9c064 ArcadePhysics.Body has a deltaMax object, which allows you to cap the delta applied to the position to +- this value.
ArcadePhysics.Body now checks the Sprite scale automatically and adjusts the body size accordingly (fix #608)
2014-03-20 00:20:02 +00:00
photonstorm
2d08fab48e When creating a Sprite (via Group.create or directly) with exists = false and a P2 body, the body is not added to the world.
Every Input class now checks to see if it has already been started. If so it doesn't add the listeners again unless they have been nulled.
2014-03-19 13:22:04 +00:00
photonstorm
164f3cbe83 When creating a Sprite (via Group.create or directly) with exists = false and a P2 body, the body is not added to the world. 2014-03-19 13:09:29 +00:00
photonstorm
96365a3a1f The StateManager is now responsible for clearing down input, timers, tweens, physics, camera and the World display list.
Removed the use of Int16Array from all Game Objects, swapped for standard Array. Phaser now runs on Android 2.x again (fix #590)
2014-03-19 12:05:19 +00:00
photonstorm
5d40365b87 InputHandler.dragFromCenter will now work regardless of the anchor point of the Sprite. 2014-03-19 05:21:26 +00:00
photonstorm
84df7bf320 Sprite.events.onEnterBounds added. This is dispatched if the Sprite leaves the bounds but then returns. The opposite of onOutOfBounds. 2014-03-19 04:17:37 +00:00
photonstorm
0a42ac39b9 ArcadePhysics.World now has a checkCollision object which can be used to toggle collision against the 4 walls of its bounds. 2014-03-19 04:03:21 +00:00
photonstorm
9959e21925 Debug.spriteBounds will now take the position of the camera into consideration when rendering the bounds (fix #603) 2014-03-19 02:31:37 +00:00
photonstorm
79ffda3f18 ArcadePhysics.separate doesn't pass over to seperateX/Y if overlapOnly is true (fix #604)
ArcadePhysics.collideSpriteVsSprite checks if both objects have bodies before processing.
ArcadePhysics.Body now checks the ArcadePhysics.World bounds, not the game bounds.
ArcadePhysics.Body has reverted to the 1.1.3 method of preUpdate, so you can now position sprites with x/y, drag them, etc, regardless of the Body.moves flag (issue #606)
ArcadePhysics.World now has setBounds and setBoundsToWorld methods, which are called automatically on world resizing.
ArcadePhysics.Body no longer sets the offset to match the anchor.
2014-03-19 02:28:20 +00:00
photonstorm
9490041c79 ArcadePhysics.separate doesn't pass over to seperateX/Y if overlapOnly is true (fix #604)
ArcadePhysics.collideSpriteVsSprite checks if both objects have bodies before processing.
2014-03-19 02:05:29 +00:00
photonstorm
11fdd62436 World.destroy incorrectly clashed with the Group.destroy method it over-rode, renamed to World.shutdown and updated StateManager accordingly.
World.shutdown now removes all children iteratively, calling destroy on each one, ultimately performing a soft reset of the World.
Objects with a scale.x or y of 0 are no longer considered valid for input (fix #602)
InputHandler will set the browser pointer back to default if destroyed while over (fix #602)
Group.destroy has a new parameter: `soft`. A soft destruction won't remove the Group from its parent or null game references. Default is `false`.
InputHandler.validForInput is a new method that checks if the handler and its owner should be considered for Pointer input handling or not.
Group.replace will now return the old child, the one that was replaced in the Group.
2014-03-19 00:54:49 +00:00
photonstorm
8010d245f1 Fixed Grunt script that stopped the P2 constraint classes from building properly. 2014-03-18 18:36:46 +00:00
photonstorm
eec9f70c1c Math.removeRandom allows you to remove (and return) a random object from an array.
Updated TypeScript defs to fix getRandom (fix #583)
2014-03-18 16:51:58 +00:00
photonstorm
870d534e50 Fixed the Loader.preloadSprite crop effect on WebGL. 2014-03-18 16:23:44 +00:00
photonstorm
a7ff5f884c Added basic Webcam plugin.
Added Device.getUserMedia detection.
Updated config.php so you can toggle physics engines on/off via flags.
Updated Gruntfile.js so it builds a Phaser + Pixi but no Physics libs.
2014-03-18 15:14:28 +00:00
photonstorm
928b883c17 Swapped the order of the _pollGamepads gamepads check, to stop the Chrome 'webkitGamepads is deprecated' error in the console. 2014-03-18 00:10:43 +00:00
photonstorm
4a407f12a1 Button.onInputUpHandler wouldn't set an upFrame for a frame ID of zero, made the check more strict. 2014-03-17 23:57:27 +00:00
photonstorm
46d5069110 Tilemap.createFromObjects has a new parameter: adjustY, which is true by default. Because Tiled uses a bottom-left coordinate system Phaser used to set the Sprite anchor to 0,1 to compensate. If adjustY is true it now reduces the y value by the object height instead. 2014-03-17 23:54:04 +00:00
photonstorm
90ef694347 Tilemap.createFromObjects used to set the Sprite anchor to 0,1 because Tiled uses a bottom-left coordinate system. It now calculates the offset in TilemapParser. 2014-03-17 23:27:13 +00:00
photonstorm
2ecb0c7c76 P2.removeBody will check if the body is part of the world before removing, this avoids a TypeError from the p2 layer. 2014-03-17 22:34:19 +00:00
photonstorm
a8502f3498 Removed State.destroy empty method and replaced with State.shutdown, as that is what the StateManager expects (fix #586) 2014-03-17 19:43:28 +00:00
photonstorm
3ebd0d9303 Updated Device.isConsoleOpen as it no longer works in Chrome. Revised code and documentation accordingly (fix #593)
Revised p2 clear process.
2014-03-17 19:39:56 +00:00
photonstorm
96296c6582 The P2 World wouldn't clear down fully on a State change, now properly clears out contacts, resets the bitmask, etc. 2014-03-17 18:57:46 +00:00
photonstorm
bc8b2424ce Removed the examples build script from the Gruntfile (fix #592) 2014-03-17 16:10:19 +00:00
photonstorm
b9ac0d565e Fixed Tile callback check in Arcade Physics (fix #562) 2014-03-16 00:53:50 +00:00
photonstorm
ec2275e18c Group enableBody parameter was incorrectly assigned to the debug var (thanks BurnedToast, fix #565) 2014-03-16 00:45:47 +00:00
photonstorm
db88bd2f22 Fixed the IE11 version check (fixes #579) 2014-03-16 00:39:42 +00:00
photonstorm
fee4d36b91 Group.getAt comparison updated (fixes #578) 2014-03-15 23:53:05 +00:00
Richard Davey
fc5504f8d8 Fixed Sprite.destroy with an arcade body 2014-03-15 01:06:01 +00:00
photonstorm
5e11b1ad87 The Static, Kinematic and Dynamic consts that P2.Body uses were incorrect (fixes #563) 2014-03-14 19:20:35 +00:00
photonstorm
901a7f13d1 Updated docs for 2.0 release and updated README. 2014-03-14 06:36:05 +00:00
photonstorm
eb8f021202 Updated README, removed Examples, added Migration Guide. 2014-03-14 06:06:43 +00:00
photonstorm
017a017b96 TilemapLayer.getRayCastTiles will let you get all tiles that hit the given line for further processing.
Fixed Tilemap collision. Added new TILE_BIAS const to aid with fast/small sprites.
2014-03-14 02:33:58 +00:00
photonstorm
f678d1fd31 Line now has x, y, width, height, top, bottom, left and right properties, so you can effectively get its bounds. 2014-03-14 00:19:45 +00:00
photonstorm
a83a76bc5d Line.coordinatesOnLine will return all coordinates on the line using Bresenhams line algorithm. 2014-03-14 00:05:03 +00:00
photonstorm
c8e63582a4 Lots of small tweaks to pass jshint. 2014-03-13 16:49:52 +00:00
photonstorm
94448d2497 P2 postBroadphase example and handler done. Group.enableBodyDebug added. Sprites no longer remove bodies from the world if exists = false, instead they set safeDestroy to true, which removes the body on the next preUpdate, to avoid mid-step destruction issues. 2014-03-13 07:29:23 +00:00
photonstorm
fc788f909c P2 Body Begin and End Contact events done and working nicely. 2014-03-12 15:26:20 +00:00