Commit graph

2281 commits

Author SHA1 Message Date
Richard Davey
0b3fc61ba7 Merge pull request #1723 from dgoemans/dev
Fix for Phaser with requirejs
2015-04-13 11:29:58 +01:00
Richard Davey
b1f294e445 Merge pull request #1722 from GGAlanSmithee/dev
Minor change to Tilemap class
2015-04-13 11:24:29 +01:00
Richard Davey
daea4e8087 Merge pull request #1728 from cuixiping/dev
Fix bug of Color.webToColor and Color.updateColor
2015-04-13 11:23:44 +01:00
Chad Engler
b89cdd5a0c check for existence of sprite on body destroy 2015-04-12 17:30:54 -07:00
Thomas Viktil
b406a61262 Looking up object layers based on id, uid or name
The description of the method stated that you could pass a string to look up an object layer based on its name, but the original code only looked for a gui property, regardless of type.

I'm using Tiled 0.11.0 on OSX, and my exported json-file doesn't contain a gui property on the object layers. Here's a snippet of my file:
```
{
    "layers":[
        {
         "draworder":"topdown",
         "height":0,
         "name":"Objects",
         "objects":[
                {
                 "height":48,
                 "id":1,
                 "name":"pier",
                 "properties":
                    {

                    },
                 "rotation":0,
                 "type":"",
                 "visible":true,
                 "width":64,
                 "x":208,
                 "y":240
                }],
         "opacity":1,
         "properties":
            {
             "type":"pier"
            },
         "type":"objectgroup",
         "visible":true,
         "width":0,
         "x":0,
         "y":0
        }]
    }]
}
```

The property in my file is called id and not uid. This might be due to changes in one of the later releases of Tiled. I kept the check for uid to avoid possibly breaking compatibility with older versions of Tiled.

I also added scaling of the sprite.

Feel free to make formatting changes, or rewrite the function to better fit the programming style of Phaser.
2015-04-11 22:16:17 +02:00
cuixiping
d0ec5e4060 Fix bug of Color.webToColor and Color.updateColor
Color.webToColor and Color.updateColor should update out.color and out.color32 property.
2015-04-09 12:14:20 +08:00
David Goemans
73bace335a Built a fix into p2.js v0.6.1 for using requirejs with phaser. This has also been put as a pull request to p2.js 2015-04-06 12:43:03 +02:00
Alan Smithee
d2e3a69525 Adds nonNull parameter to Tilemap.getTileWorldXY
Since Tilemap.getTile lets you specify wether to return null
or an empty tile when index is -1, the WorldXY equivalent
should offer the same possibility for a more unified interface.
2015-04-06 10:08:37 +00:00
photonstorm
36c064511c Added guards around context.getImageData calls in BitmapData, Text and Canvas Tinting classes to avoid crashing restricted browsers like Epic Browser. Please understand that several Phaser features won't work correctly with this browser (thanks @Erik3000 #1714) 2015-04-02 14:47:44 +01:00
hardalias
4bd7a40e84 Fixes neverending tween when duration set to zero
* Passing a value of zero as the value of duration causes the
 calculations performed in Tween#update to divide by zero when
 calculating the next step for the tween. This causes the tweened
 property value to be set to NaN having undesireable results and
 also, causes the tween to never end since the ending criteria are
 never met.
2015-04-01 15:01:05 +03:00
photonstorm
645723f939 Sprite was missing the Health and InCamera components. 2015-03-30 13:51:47 +01:00
photonstorm
5fb1130175 The LoadTexture component has had a redundant dirty call removed from it.
TileSprites were missing a `physicsType` property, causing them to not collide with anything (thanks @numbofathma #1702)
2015-03-28 00:56:02 +00:00
photonstorm
57474c0d44 Trying out removal of dirty flag. 2015-03-27 10:47:45 +00:00
photonstorm
67039df214 jsdoc fixes. 2015-03-27 10:47:25 +00:00
photonstorm
49be59b0c9 Added missing resumed method to Phaser.State class template. 2015-03-26 10:54:32 +00:00
photonstorm
413c81e034 Preparing for 2.3.1 development. 2015-03-26 04:01:37 +00:00
photonstorm
8233b0a079 Phaser 2.3.0. 2015-03-26 02:37:31 +00:00
photonstorm
eb235197e9 Phaser 2.3 Release Candidate 3. 2015-03-25 16:17:53 +00:00
photonstorm
79ace60997 Added guard around the xhr onload try / catch block, so it doesn't incorrectly report errors as being from the Loader when they may have been throw by the create method. 2015-03-25 16:13:52 +00:00
photonstorm
c1366c2f4f Arc comment. 2015-03-25 16:13:21 +00:00
photonstorm
93dc67be71 Graphics.drawArc would fail to draw any subsequent arcs if you set beginFill on it after drawing the first arc.
Graphics.drawArc would only move to the center position of the first arc created and ignore any subsequent arcs.
Graphics.drawArc now correctly renders multiple arcs across both WebGL and Canvas. You no longer need to specifically call moveTo to move into the correct place to draw the arc.
Graphics.drawArc now bails out if the startAngle = the endAngle and/or the sweep is invalid *before* adjusting any points.
Graphics.drawArc now correctly handles the fill on the CanvasRenderer if the arc is a subsequent arc and no line style is set.
2015-03-25 13:00:08 +00:00
photonstorm
d45a7bae8e Fixed constructor. 2015-03-25 12:59:41 +00:00
photonstorm
e7400be625 Formatting updates. 2015-03-25 12:59:31 +00:00
photonstorm
b1cdb358bb Merging in fixes from Pixi 3. 2015-03-25 11:04:58 +00:00
photonstorm
17b2eafbf3 Split GraphicsData to its own file. 2015-03-25 11:04:48 +00:00
photonstorm
93ed950f89 Small geom tidy-up. 2015-03-25 11:04:31 +00:00
photonstorm
f4d55b7785 When an Emitter is destroyed via Emitter.destroy it now removes itself from the Phaser Particle Manager, freeing it up for garbage collection and stopping it from being processed. 2015-03-25 05:07:39 +00:00
photonstorm
aa13ec0165 Animation.play wouldn't correctly set the play state on the Game Objects AnimationManager causing the animation to fail to start (calling AnimationManager.play did work however), now they're both consistently working. 2015-03-25 03:59:36 +00:00
photonstorm
244372384e When an Animation completes playback and isn't set to loop it would change the currentFrame property to be the first frame in the set after the onComplete callback had fired. This meant if you set a Sprite to a new frame within an Animation onComplete callback then your change would have been overwritten by the animation itself. This is now no longer the case. 2015-03-24 23:17:13 +00:00
photonstorm
83adc51698 Fixed the FixedToCamera :) 2015-03-24 21:35:09 +00:00
photonstorm
c4b83a1394 Phaser 2.3 Release Candidate 1. 2015-03-24 16:05:52 +00:00
photonstorm
96e313e768 If you paused a Sound object that is using audio markers and then resumed it, it wouldn't correctly calculate the resume duration - causing the sound to sometimes play into the marker that followed it (thanks @AnderbergE #1669) 2015-03-24 14:43:35 +00:00
photonstorm
7e19f45350 When the Game first boots it will now call window.focus(). This allows keyboard events to work properly in IE when the game is running inside an iframe. You can stop this from happening by setting window.PhaserGlobal.stopFocus = true (thanks @webholics #1681) 2015-03-24 13:27:27 +00:00
photonstorm
ebdb6d028f The Physics Manager now has a new reset method which will reset the active physics systems. This is called automatically on a State swap (thanks @englercj #1691) 2015-03-24 10:21:12 +00:00
photonstorm
7aa4d0ad0d When a State is started and linked to Phaser it has a new property created on it: key, which is the string identifier used by the State. 2015-03-24 10:21:03 +00:00
photonstorm
12fc424305 Huge amount of jsdoc updates. 2015-03-23 23:46:09 +00:00
photonstorm
08c9513f98 Improving the Component documentation. 2015-03-23 19:56:23 +00:00
photonstorm
85c8f60d7c Removed 'global' component arrays. 2015-03-23 19:19:07 +00:00
photonstorm
b7b622a556 Text style has a new optional property: backgroundColor which is a Canvas fill style that is set behind all Text in the Text object. It allows you to set a background color without having to use an additional Graphics object.
Text.lineSpacing can now accept negative values without cutting the bottom of the Text object off. The value can never be less than the height of a single line of text.

Text.lineSpacing is no longer applied to the first line of Text, which prevents text from being cut off further down the Text object.
2015-03-23 16:12:23 +00:00
photonstorm
7010883bc3 Tidying up. 2015-03-23 15:07:09 +00:00
photonstorm
77eaa7e707 Optimised World.collideHandler and added SORT_NONE option. 2015-03-23 15:05:57 +00:00
photonstorm
b07ce89236 sourceWidth / Height now only set from the texture if the object has a texture. 2015-03-23 15:05:39 +00:00
photonstorm
1486e166bd Added physicsType property. 2015-03-23 15:04:27 +00:00
photonstorm
55048a4b25 BitmapText objects now have an anchor property. This works in a similar way to Sprite.anchor except that it offsets the position of each letter of the BitmapText by the given amount, based on the overall BitmapText width - whereas Sprite.anchor offsets the position the texture is drawn at. 2015-03-23 15:03:53 +00:00
photonstorm
506ff8843e Fixed incorrect use of this.response which broke Binary files with callbacks. Should be all of them caught now - ProTracker example now works again as a result too. 2015-03-23 10:52:43 +00:00
photonstorm
35a9bdcfc9 Fixed loading of physics json data (old responseText reference) 2015-03-23 10:46:38 +00:00
photonstorm
ba052389a3 New version of p2.js merged for testing. 2015-03-23 10:11:49 +00:00
photonstorm
3f30a3d0d2 jsdocs updates. 2015-03-23 10:11:39 +00:00
photonstorm
ca752cc59c jsdoc updates. 2015-03-23 08:13:59 +00:00
photonstorm
a190823dad jsdoc fix. 2015-03-23 08:13:59 +00:00
photonstorm
4e3d189678 Updated Pixi version. 2015-03-23 08:13:59 +00:00
Richard Davey
ae72107de8 Merge pull request #1685 from pnstickne/wip-1679
Animation - guard around destroy
2015-03-23 07:53:59 +00:00
Richard Davey
a10a18277a Merge pull request #1686 from englercj/dev
Add debug drawing for p2 capsule shape
2015-03-23 07:47:30 +00:00
Chad Engler
f5af981da3 fix missing semicolon 2015-03-22 21:28:27 -07:00
Chad Engler
97410f8907 add debug drawing for p2 capsule shape 2015-03-22 19:45:18 -07:00
Paul
6225bb0e94 Animation - guard around destroy
- Allows sprites (and/or the animation) to be destroyed from within
  the onUpdate, onLoop, or onComplete events
2015-03-22 17:01:37 -07:00
photonstorm
cb9ef4f12e Text.padding specifies a padding value which is added to the line width and height when calculating the Text size. ALlows you to add extra spacing if Phaser is unable to accurately determine the true font dimensions (#1561 #1518) 2015-03-19 01:54:14 +00:00
photonstorm
b13acdb23b TilingSprite.destroy fixed if TilingSprite hasn't ever been rendered (#1663) 2015-03-19 01:39:39 +00:00
photonstorm
5a9b509b44 ArraySet.removeAll allows you to remove all members of an ArraySet and optionally call destroy on them as well.
GameObject.input.dragStartPoint now stores the coordinates the object was at when the drag started. This value is populated when the drag starts. It can be used to return an object to its pre-drag position, for example if it was dropped in an invalid place in-game.
2015-03-19 00:51:13 +00:00
breakosaur
bb600b4319 Fixed a few documentation typos. 2015-03-18 21:07:36 +00:00
Richard Davey
358e0a6675 Merge pull request #1674 from englercj/dev
Fix debug drawing for p2 physics bodies
2015-03-18 19:21:59 +00:00
photonstorm
165e5935c2 JSDoc fixes. 2015-03-18 19:14:58 +00:00
Chad Engler
0b3850cc0c Fix debug drawing for p2 physics bodies 2015-03-18 01:19:32 -07:00
Paul
dcc83ec793 Tilemap renderer - context save/restore
- Added context save/restore; the secondary issue when the canvas
  is copied from later, and if any alpha is applied
2015-03-16 22:05:46 -07:00
Paul
54dba67f50 Tilemap rendering sets initial state better
- #1666 - previous alpha state could bleed through.
  Now the initial alpha and composite modes are set explicitly.
2015-03-16 21:35:39 -07:00
Paul
cc5d1d02e5 Loader: loading from pack data
- Corrected logic where packs added via data would still try to be loaded.
  This makes the behavior correct per the documentation and v2.2
2015-03-15 20:26:37 -07:00
photonstorm
6cf982a4a0 Fixed to Destroy component if still in render loop. 2015-03-11 01:44:46 +00:00
photonstorm
ee61d95980 Tidying up the Pixi source.
Added DisplayObject.destroy to cleanly remove all references, callbacks and cached textures (fixes #1656)
2015-03-10 15:13:37 +00:00
photonstorm
0516167c3d Finally tracked down the rogue bug causing Graphics objects to not work with various components (fix #1654) 2015-03-10 14:23:49 +00:00
photonstorm
fe9a9fcd63 More Pixi updates. 2015-03-05 19:26:53 +00:00
photonstorm
f4eff6359c Added isArray check. 2015-03-05 14:02:24 +00:00
photonstorm
364f3b3cb8 Formatting. 2015-03-05 14:02:04 +00:00
photonstorm
893d36f128 jsdoc fix. 2015-03-05 14:01:52 +00:00
photonstorm
d717c5c180 Removed final traces of _interactive properties and checks. Also added preUpdate catch. 2015-03-05 14:01:43 +00:00
photonstorm
ed3afed2ff Fixed spelling mistake. 2015-03-05 14:00:57 +00:00
photonstorm
0a45223cd4 Resuming a sound needs the onended handler adding back in again. 2015-03-04 00:32:33 +00:00
Richard Davey
7eb73e99a8 Merge pull request #1648 from pnstickne/wip-components-docs
Component documentation
2015-03-01 10:46:55 +00:00
Paul
4de95c09b5 Component documentation
- Required changes for documentation to show up correctly
  - Uses multiple @extends, which currently [mostly] works in jsdoc
    and like closure compiler
2015-02-28 23:00:17 -08:00
Paul
ee34327c93 Components: bug fixes
- Use property check ('in') to avoid property access

- Promoted 'body' property for physics
2015-02-28 17:49:45 -08:00
Paul
0e5272b217 Merge remote-tracking branch 'upstream/dev' into wip-components-toproto
Conflicts:
	src/gameobjects/Image.js
	src/gameobjects/Rope.js
	src/gameobjects/Sprite.js
	src/gameobjects/Text.js
	src/gameobjects/TileSprite.js
	src/gameobjects/components/Core.js
2015-02-28 15:51:47 -08:00
photonstorm
2483cd5df4 Various readonly Body properties flagged as 'readonly' in the jsdocs (#1643) 2015-02-26 23:32:14 +00:00
photonstorm
53b1562eb6 jshint fix 2015-02-26 23:12:26 +00:00
Richard Davey
c819f0b508 Merge pull request #1642 from zekoff/tileset-render-fix
Fix row/col count formula.
2015-02-26 21:28:21 +00:00
photonstorm
f99f182a6f Arcade Physics is now using a spacial pre-sort for all Sprite vs. Group and Group vs. Group collisions. You can define the direction the sort will prioritise via the new sortDirection property. By default it is set to Phaser.Physics.Arcade.LEFT_RIGHT. For example if you are making a horizontally scrolling game, where the player starts on the left and moves to the right, then this sort order will allow the physics system to quickly eliminate any object to the right of the players bounds. This cuts down on the sheer volume of actual collision checks needing to be made. In a densely populated level it can improve fps rate dramatically.
There are 3 other directions available (`RIGHT_LEFT`, `TOP_BOTTOM` and `BOTTOM_TOP`) and which one you need will depend on your game type. If you were making a vertically scrolling shoot-em-up then you'd pick `BOTTOM_TOP` so it sorts all objects above and can bail out quickly.

More importantly you can switch the `sortDirection` at run-time with no loss of performance. Just make sure you do it *before* running any collision checks. So if you had a large 8-way scrolling world you could set the `sortDirection` to match the direction the player was moving in and adjust it in real-time, getting the benefits as you go. My thanks to Aaron Lahman for inspiring this update.
2015-02-26 21:24:07 +00:00
photonstorm
74eeddf956 You can now set a resolution property in your Game Configuration object. This will be read when the Pixi renderer instance is created and used to set the resolution within that (#1621) 2015-02-26 10:52:30 +00:00
Michael Zekoff
510353f6fb Fix row/col count formula.
This fixes the rendering issue for tilesets with margin/spacing
as described in photonstorm/phaser#1641.
2015-02-26 04:34:41 +00:00
photonstorm
41396d5ad2 Merged all of the relevant Pixi 2.2.7 fixes in (#1621) 2015-02-25 17:04:48 +00:00
photonstorm
03a2db18cb Added extra protection in the case of mixed-type Groups.
Removed window vars and replaced with stats property.
Removed redundant if/else checks.
2015-02-25 06:06:40 +00:00
photonstorm
8aec760cd5 First pass at spacial sorting in World.collide. 2015-02-25 05:39:02 +00:00
photonstorm
321e11d0a5 A State swap now sets the Loader.reset hard parameter to true by default. This will null any Loader.preloadSprite that may have been set (#1636) 2015-02-25 05:18:49 +00:00
photonstorm
a69e53f901 Copyright date change. 2015-02-25 03:36:23 +00:00
photonstorm
466a4d11bb Loader.preloadSprite had an extra guard added to ensure it didn't try to updateCrop a non-existent sprite (thanks @noidexe #1636) 2015-02-25 03:08:37 +00:00
photonstorm
dee13d52d8 jshint fix. 2015-02-25 02:50:57 +00:00
photonstorm
ae7a1fda05 Optimised preUpdate callbacks. 2015-02-25 02:49:50 +00:00
photonstorm
ee48675a28 Fixed trimmed TileSprites in Canvas (WebGL still broken, as it's broken in Pixi also) 2015-02-25 02:49:38 +00:00
photonstorm
72530d963b Default exists should be true! 2015-02-25 02:49:19 +00:00
photonstorm
c799dfe7da Fixed physics postUpdate issue causing particles and all kinds of things to go awry. 2015-02-25 02:18:05 +00:00
photonstorm
ec19abb91c Component preUpdate changes. 2015-02-25 00:59:27 +00:00
photonstorm
3d399f1b14 Removed the final few private vars from computeVelocity 2015-02-25 00:04:53 +00:00
photonstorm
c9939f8691 Tilemap fix #1635 2015-02-24 22:57:59 +00:00