• Content Count

  • Joined

  • Last visited

About richpixel

  • Rank
    Advanced Member

Contact Methods

  • Twitter

Recent Profile Visitors

1,151 profile views
  1. richpixel

    Particle Storm is out!

    Got the plugin and loving the power so far! One question - is there a way to use true elapsed time instead of 'physicsElapsed' for particle motion/velocity updates? Currently when the game runs on mobile on slower devices the particles also move slower.
  2. richpixel

    BitmapFont Atlas

    It's been over 2 years, but I finally worked this out I suspected we would get a significant reduction in draw calls by putting the bitmap font on the main game sprite sheet, and it worked. In our case about 40% drop in number of draw calls! Over many Phaser updates I still didn't see a built-in way to do it, so here is the code: // EXTEND cache to allow bitmap fonts on another atlas Phaser.Cache.prototype.addBitmapFontByAtlas = function (key, sheetKey, sheetFrame, atlasData, atlasType, xSpacing, ySpacing) { var obj = { font: null, base: }; if (xSpacing === undefined) { xSpacing = 0; } if (ySpacing === undefined) { ySpacing = 0; } // bind the atlas data to the frame on the 'sheet' var frameData =, sheetFrame); // only works with XML for now var xml = atlasData; var info = xml.getElementsByTagName('info')[0]; var common = xml.getElementsByTagName('common')[0]; var letters = xml.getElementsByTagName('char'); for (var i = 0; i < letters.length; i++) { var x = parseInt(letters[i].getAttribute('x'), 10); var y = parseInt(letters[i].getAttribute('y'), 10); letters[i].setAttribute('x', x+frameData.x); letters[i].setAttribute('y', y+frameData.y); } if (atlasType === 'json') { obj.font = Phaser.LoaderParser.jsonBitmapFont(atlasData, obj.base, xSpacing, ySpacing); } else { obj.font = Phaser.LoaderParser.xmlBitmapFont(atlasData, obj.base, xSpacing, ySpacing); } this._cache.bitmapFont[key] = obj; }; In order to use this, just load your 'fnt' (xml data) separately and then bind it to your main sheet: preload: function() { // Load the xml data associated with your font...'roboFNT', fontFolder+'/roboFont.fnt'); }, create: function() { // Bind the font atlas data to the spritesheet that has the font image data... // In this example 'ui' is my main spritesheet, and 'robo.png' is the frame on that sheet with the font glyph image set. // 'robo' is the key that you use as your font name when creating bitmap text.'robo', 'ui', 'robo.png','roboFNT')); }
  3. richpixel

    Problem with and cacheAsBitmap..

    Ok I found something that helped me... Originally I was creating the group and adding to the parent right away: var backing =; // 'this' is my parent group // create content, add some images to the backing group // ... backing.cacheAsBitmap = true; // results in group being chopped off But if I choose to set cacheAsBitmap = true, and then add to the group, it displays properly: var backing =; // assign to default parent, which is the world // do the creation stuff // ... // cache as bitmap now backing.cacheAsBitmap = true; // NOW attach to the real parent group this.add(backing); Looking at the pixi code, I think there's a problem in there calculating the local bounds for the group, causing the original bug. Hope this helps.
  4. richpixel

    Problem with and cacheAsBitmap..

    Hi did you ever find a solution for this? I'm seeing similar problems, now with Phaser 2.6.1 I create a group, with a tiled set of images, and then set cacheAsBitmap = true on the group. And then a chunk of the area that should be displayed is not shown... Thanks
  5. We're coming to a point soon where most recent browsers on mobile support WebGL and am thinking about axing the canvas renderer to further minimize phaser build size. I don't see a way to exclude the canvas renderer in a custom build... I realize it's part of pixi and maybe that's why it can't be separated out, but just wanted to know for sure if it was not possible. Thanks
  6. richpixel

    Phaser.Physics.P2JS vs. Phaser.Physics.BOX2D

    Curious about this too... would like to use Box2d for the bullet physics and tighter collision handling but wondering about performance.
  7. Tried out 2.4.4 and still see slowish animation on my iPad 3 (ios 8) and iPhone 5c (ios 8) I originally developed the game with v2.2.2, which always ran smooth, so I'll have to stick with it for now. Perhaps enhancements were made that were not back-tested on older devices/iOS. I'm guessing there are no issues on the newer devices or this would be seeing more of an outcry. Also should note that the DisplayObject.updateTransform() change (to comment out the code) suggested by Tom Atom did not help my situation in which I have multiple sprites running animations sequences at the same time. That code is actually in the PIXI codebase which is separate from Phaser.
  8. Is there any news on this issue? I guess for now I will also stay with 2.3
  9. Just wanted to chime in - I tried my game today with 2.4.3 after previously having run on 2.2.2 - the animations are slow and choppy on mobile devices now, where before they were nice and smooth. Tilde, I also had the 'final frame' animation issue, which happens sometimes when the fps drops. I fixed it with this patch code to make sure _frameIndex is set to the last frame in all cases: // EXTEND complete on Phaser.Animation to set _frameIndex to _frames.length-1 /** * Called internally when the animation finishes playback. * Sets the isPlaying and isFinished states and dispatches the onAnimationComplete event if it exists on the parent and local onComplete event. * * @method Phaser.Animation#complete */ Phaser.Animation.prototype.complete = function () { this.isPlaying = false; this.isFinished = true; this.paused = false;$dispatch(this._parent, this); // RCL fix - animation doesn't stop on last frame if frames are skipped due to low fps this._frameIndex = this._frames.length-1; //// this.onComplete.dispatch(this._parent, this); if (this.killOnComplete) { this._parent.kill(); } }
  10. richpixel

    bitmap fonts a bit clunky? -

    Was wondering about kerning - can that be done dynamically on a BitmapText or only through the font xml data ? Thanks
  11. I'm not sure if this has been brought up before... This morning I discovered some 'tearing' in my images. A visible warping across the images which looks like it's related to WebGL breaking the image into triangles and not lining them up properly: - The image has the smoothed property set to false, in order to get a crisp, unscaled look. - It's not being scaled either by Phaser or the Canvas. - The image above has anchor set to 0.5 on x, ie. myImage.anchor.set(0.5, 0); This struck me has a 'half-pixel' kind of problem, so I made sure x,y coords were rounded off but it didn't help. But then I tried the PIXI pivot property: myImage.pivot.set(Math.round(myImage.width * 0.5), 0); And this solved the problem... I don't know what's happening internally to make this work, but I just wanted to share this fix! btw running Phaser 2.2.2, PIXI 2.2.0, WebGL
  12. richpixel

    Question about cacheAsBitmap

    Ok - I have Group that contains lots of images and sprites. I need to rotate and move this group without changing any of the children, so cacheAsBitmap seems to be a good option for speed. From what I understand, cacheAsBitmap takes a snapshot of the Group, and uses that for subsequent rendering. Later on in the game, one of the sprites inside this Group needs to animate. Does this mean the cached Bitmap gets regenerated on each frame of the animation? Would it be best to turn off cacheAsBitmap in this case? (PS I put a console.log inside PIXI's _generateCachedSprite() which actually creates the cached bitmap and it only seems to get called once, and doesn't get called again after the animation starts playing, which seems odd.)
  13. richpixel

    Horizontal sprite flipping reseting width

    Interesting when I flip an image like this: image.scale.x *= 1; then check the width console.log(image.width); // shows -511 It shows a negative width! Pretty sure that is incorrect behavior...
  14. Either this is a bug or I'm doing something wrong... I've create a group and added a bunch of Images to it. I also add 2 TileSprite's. I then set 'cacheAsBitmap' to true on the group. When the group renders the TileSprites are not visible. They ARE visible when cacheAsBitmap is false. Running Phaser 2.2.2, WebGL
  15. richpixel

    why does my game lagging when played on firefox?

    I see this problem quite a bit also.. recently I noticed firefox was taking up a lot of cpu - like 50, 60, 70% sometimes. This is the case regardless if I'm running any Phaser code. So I disabled some plugins, which so far seemed to help with the cpu usage. I haven't retried the Phaser games yet.