rich Posted August 21, 2015 Share Posted August 21, 2015 Today we've released Phaser 2.4.3 RC1 and we'd greatly appreciate any time you can spend helping to test it. https://github.com/photonstorm/phaser/tree/dev As to be expected there are a bunch of bug fixes and updates. However we also found time to add some nice **new features** too: * Loader.images is a new method that allows you to pass an array of image keys, and optionally the urls, to the Loader and have them all added to the load queue in one go.* TweenManager.frameBased allows you to control if all newly created Tweens update based on the physics step (i.e. frame based) or the system clock (time based). A frame based tween will use the physics elapsed timer when updating. This means it will retain the same consistent frame rate, regardless of the speed of the device. The duration value given should be given in frames. If the Tween uses a time based update (which is the default) then the duration is given in milliseconds. In this situation a 2000ms tween will last exactly 2 seconds, regardless of the device and how many visual updates the tween has actually been through.* Tween.frameBased does the same as TweenManager.frameBased but allows you to set the value on a per-tween basis.* BitmapText.smoothed is a new boolean property that allows you to set texture smoothing on a bitmap font or not. By default smoothing is always on, but you can turn it off which helps for bitmap fonts created from pixel art style character sets.* Text.addFontStyle and Text.addFontWeight allow you to apply font weights and styles to specific characters in a Text object. For example you can now include bold or italics within single Text objects (thanks @jdnichollsc #1950)* PIXI.CanvasPool is a new static global created to deal with the issue of resource leaks and continuous DOM node build-up when creating lots of Text or BitmapData objects, or when calling `generateTexture` on any display object. The CanvasPool will do its best to re-use out dated canvas elements rather than filling up the DOM with new ones.* Sprite.setTexture has a new `destroyBase` parameter - set this to `true` if you know the base used a generated texture that isn't being used by any other sprites. This will free-up the canvas for further re-use by other calls to generateTexture or Text objects.* Line.midPoint will return a Point object where the x and y values correspond to the center (or midpoint) of the Line segment.* Line.rotateAround allows you to rotate a Line around the given coordinates (in world space)* Line.centerOn will position the Line so that its midpoint lays on the coordinates given.* BitmapData.line draws a line to the BitmapData in the color and thickness specified.* BitmapData.op is a handy short-code to get and set the canvas global composite operator.* BitmapData.drawFull draws the given Game Object or Group to a BitmapData and then recursively iterates through all of its children, including children of Game Objects and Groups. It can draw Text, BitmapText, Sprites, Images, Emitters and Graphics objects. It's perfectly valid to pass in `game.world` as the parent object, and it will iterate through the entire display list. If you find any issues please either post in this forum thread or add them to the Github Issues. jdnichollsc 1 Link to comment Share on other sites More sharing options...
tips4design Posted August 21, 2015 Share Posted August 21, 2015 Any changes to Scale Manager? When I update from 2.4.2 to 2.4.3 the game is no longer centered (because I had margin: 0; to CSS). If I remove margin: 0 the game is centered but a vertical scroll bar appears and when inspecting the element in chrome the canvas margin appears to be wrongly set. There is an empty row below the canvas that makes the scroll appear. Link to comment Share on other sites More sharing options...
rich Posted August 21, 2015 Author Share Posted August 21, 2015 Nope, the ScaleManager hasn't been touched since version 2.4.0 (aside from removing 2 dead Signals, but that's it). Link to comment Share on other sites More sharing options...
tips4design Posted August 21, 2015 Share Posted August 21, 2015 Nope, the ScaleManager hasn't been touched since version 2.4.0 (aside from removing 2 dead Signals, but that's it).Well, just updating from 2.4.2 to 2.4.3 makes that scroll bar appear. Link to comment Share on other sites More sharing options...
PhaserEditor2D Posted August 21, 2015 Share Posted August 21, 2015 Hi Rich, I see the new Loader.images(keys, urls) method does not work with the asset pack json. I think it is just about to add this code after the line 1933 in the Loader.processPack() method:case "images": this.images(file.keys, file.urls); break; Link to comment Share on other sites More sharing options...
cjke Posted August 22, 2015 Share Posted August 22, 2015 (edited) Hey Rich, thanks - awesome update. Currently using this for ludum dare 33 (will post some code afterwards) but I am noticing that "justpressed" is not working as it use to (even breaking the examples: http://phaser.io/examples/v2/input/keyboard-justpressed). Any tips on getting it working? *EDIT: Got it working, missed it in the doco's - was working off the examples (which were broken in this case). Edited August 22, 2015 by cjke Link to comment Share on other sites More sharing options...
rich Posted August 22, 2015 Author Share Posted August 22, 2015 The method was renamed 'downDuration' (and 'upDuration' respectively). I'll get the example updated. jdnichollsc 1 Link to comment Share on other sites More sharing options...
cjke Posted August 22, 2015 Share Posted August 22, 2015 Thanks Rich. Phaser has been great for Ludum Dare! jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted August 22, 2015 Share Posted August 22, 2015 Nice! With Text.addFontStyle and Text.addFontWeight you can simulate markdown easily http://codepen.io/jdnichollsc/pen/pJqadN Example:var playState: { create: function(){ this.hello = this.game.add.text(this.game.world.centerX, this.game.world.centerY, "Hello **World**, this is **MarkDown** in *Phaser*!", { font: "bold 60px Arial", align: "center", wordWrap: true, wordWrapWidth: 700 }); this.hello.anchor.set(0.5); this.hello.addFontWeight('normal', 0); this.hello.applyMarkdown(); }};Phaser.Text.prototype.applyMarkdown = function () { var boldPositions = []; var italicPositions = []; var i = this.text.indexOf("**"); while(i >= 0){ this.text = this.text.substr(0, i) + this.text.substr(i+2); boldPositions.push(i); i = this.text.indexOf("**"); } i = this.text.indexOf("*"); while(i >= 0){ this.text = this.text.substr(0, i) + this.text.substr(i+1); italicPositions.push(i); for (var j = 0; j < boldPositions.length; j++) { if(i < boldPositions[j]) boldPositions[j]--; } i = this.text.indexOf("*"); } for (i = 0; i < boldPositions.length; i=i+2) { this.addFontWeight('bold', boldPositions[i]); this.addFontWeight('normal', boldPositions[i+1]); } for (i = 0; i < italicPositions.length; i=i+2) { this.addFontStyle('italic', italicPositions[i]); this.addFontStyle('normal', italicPositions[i+1]); }}; Link to comment Share on other sites More sharing options...
qdrj Posted August 23, 2015 Share Posted August 23, 2015 Well, just updating from 2.4.2 to 2.4.3 makes that scroll bar appear.I've test this RC on my 2 latest games and noticed same problem. Good thing that there aren't any other issues Link to comment Share on other sites More sharing options...
rich Posted August 24, 2015 Author Share Posted August 24, 2015 I've found what caused the extra 4px height - was nothing to do with the ScaleManager at all! But now works fine in the dev branch. tips4design, jdnichollsc and qdrj 3 Link to comment Share on other sites More sharing options...
Recommended Posts