• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by charlie_says

  1. charlie_says

    Export bitmapdata as PNG

    I've created some assets for use in a game, but it would now be handy to get those assets as files for re-use elsewhere. Is there an easy way to export created graphics as files? <edit> I realised that the above is a little unclear - what I mean is: I use Phaser's BitmapData to draw out a number of sprites that I use in my game
  2. charlie_says

    Phaser webcam examples not working

    Title says it all really, is there a reason the examples have stopped working?
  3. charlie_says

    Phaser webcam examples not working

    Further investigation revealed webcam examples work just fine, but for some reason only Edge is allowed to access the camera...
  4. charlie_says

    Determine Screen Size

    Slightly odd question here: is there a way to determine the screen size... I'm not so interested in the pixel resolution, but more the physical size of the screen. I've got an item that reacts when tapped, but, on my Iphone which has a small screen this is completely obscured by my finger, and I'd like to move it so you can see what's going on... but, I couldn't see a good way of doing this... ...any ideas?
  5. charlie_says

    Determine Screen Size

    I think using the scaled width and device.pixelRatio gives the desired result...
  6. charlie_says

    BitmapData copyrect not working in IE11

    Hi, I've had this issue before, finding that BitmapData.copyrect doesn't work on IE for some reason. (It fails silently, basically the game will just stop). Previously, I'd worked around by using BitmapData.draw, but doing that this time will be a bit more involved, and I'm keen to try to understand what's going wrong. But, so far, I've not had much luck tracking down the issue - does anyone have any idea?
  7. charlie_says

    BitmapData copyrect not working in IE11

    Interestingly, what I'm trying to do is copy a small bitmapdata into a larger one, with an offset to centre it. It doesn't appear that anything is outside of the bounds... The only thing I could think is that by using .draw which copies some properties from the source, rather than copyRect to which I only pass a few variables, was missing something. But, I did try doing the operation using .copy and passing everything I had, and it still didn't work for me (in IE11, works fine everywhere else.)
  8. charlie_says

    BitmapData copyrect not working in IE11

    I investigated this further... I can't figure out what causes the issue, especially as all the bitmapdata methods work in the same way! (they all re-use copy(...) which would seem to mean that it should just work.) But, copyrect definitely fails in IE if you're trying to copy a rectangle which is differently sized (I was trying to copy a small bmd to a large bmd, this generates an index error.) I was able to work around it (again) using draw...
  9. charlie_says

    Add BitmapData to cache

    I'm having difficulty manually adding bitmapdata to cache. I can do this: let _bmp = new Phaser.BitmapData(, null, 100, 100, false); _bmp.fill(255,125,0,1); let tmp = new Phaser.Sprite(, 100,100); tmp.loadTexture(_bmp); which, works fine. But if I try this: let _bmp = new Phaser.BitmapData(, null, 100, 100, false); _bmp.fill(255,125,0,1);'test', _bmp); let tmp = new Phaser.Sprite(, 100,100); tmp.loadTexture('test'); nothing appears... Any ideas where I'm going wrong? It generates the error Phaser.Cache.getImage: Key "test" not found in Cache.
  10. charlie_says

    Add BitmapData to cache

    Ah... tmp.loadTexture('test')); will do the trick!
  11. charlie_says

    Penny Drops

    This is a new (well, newish, but only recently completed & released) match 3 game in the style of an old slot machine. Have a play here:
  12. charlie_says

    resize and ios

    I've looked through the examples, done a bit of experimenting & further googling and am still stuck. I've got a resizing solution in place (with the scale manager) which works fine on all devices, with the exception of smaller iOS landscape (so definitely Iphone SE, but probably others). The issue there is the address bar and info bar appear in, overlaying the screen, without correctly setting the innerHeight (or not calling the resize function after they've appeared.) Anyone got any ideas or examples of resizing that works in this scenario?
  13. charlie_says

    resize and ios

    :S Ok, after quite a lot of playing around, it seems that, this); is unreliable on ios with smaller screens and is better replaced by: window.onresize = this.onResize.bind(this);
  14. Hi, I'm trying to do something similar to this example: But, I'm working in TypeScript, and it doesn't 'like' the last part:, outerCircle.y, outerCircle.radius, grd); gets me the error: Argument of type 'CanvasGradient' is not assignable to parameter of type 'string'. Any ideas how I resolve this?
  15. charlie_says

    Bitmapdata example not working in typescript

    ok, should anyone come across this, and be interested, I've fixed it by drawing directly to the context. What I was trying to do was a little different, so it's not a straight replacement of the above. bmd.context.fillStyle = grd; bmd.context.fillRect(0,0,,;
  16. charlie_says

    (Solved) Need help translating AS2 code to HTML5

    I think you may need to floor your random var frameLabel = ["repeat", "dontrepeat"]; var rand = frameLabel[Math.floor(Math.random() * frameLabel.length)]; this.gotoAndPlay(rand); <edit> or do what @milton said - I'd misread the "| 0"
  17. charlie_says

    Remove Texture from Sprite

    Hi, I've got a setup where I create an empty sprite, and then later add a texture. this.path = game.make.sprite(0,0); this.addChild(this.path); //... later this.path.loadTexture('frame'); This all works fine, but, I would now like to 'unload' the texture, return the sprite to it's initial empty state. One way I could do it, is to have a blank texture, which I could load in - but, I wondered if there was a way to unload?? Thanks!
  18. charlie_says

    PIXI element typof

    I'm trying to write a function that's can have several different elements passed through to it. It could receive a texture, or a sprite, or a container. I'd then be able to handle what happens next... But, as all those items return typeof Object, I'm a little uncertain as to how best to differentiate. Is there a way I can test for they type?
  19. charlie_says

    PIXI element typof

    Thanks @ivan.popelyshev My colleague laughed at me for asking this... He said, why not try instanceof. I've given it a test, and it seems to work fine. Is there any reason not to do this?
  20. charlie_says

    Combine/mask textures

    Slightly unusual question: I'm porting a game to PIXI (from Haxe), most of which will move quite easily except my buttons. The buttons are created from 2 textures, one is a background image (a circle) the second is an icon. I make a copy of the circle shape, apply a colour to it, and then remove the icon (all of this is with bitmapdata operations.) I then add an effect to the final output (a glow). I can think of a couple of ways of reworking this for PIXI, but am keen to make as few changes as possible from the original. So is there a way of manipulating a texture as you can BitmapData (as per Flash AS3, Phaser2, Haxe)??
  21. For a project I'm working, using Phaser 2, I'm using BitmapData doing something like this: var _icon_bmd = new Phaser.BitmapData(bmd_bg.width, bmd_bg.height, true, color); _icon_bmd.draw(bmd_bg, 0,0, bmd_bg.width, bmd_bg.height, BlendMode.ALPHA, true); // makes a circular shape _icon_bmd.draw(bmd_icon, 0,0, bmd_bg.width, bmd_bg.height, BlendMode.ERASE, true); // removes an icon from the circle var _icon = new Phaser.Bitmap(_icon_bmd); (This is kind of reworked/untested to put in here, but it is directly inline with what I'm doing). I had a brief moment when I thought about porting to Phaser 3. When I found that BitmapData wasn't used any more, and with the time constraints, I decided to leave it. But, for the future, I would like to know how to do this (or if I can). So, can anyone help me out a little? Is this kind of thing possible with Phaser 3?
  22. charlie_says

    get current frame of a playing animation

    Is there a way to get the current frame of a playing animation? I'm currently using: sprite.animations.currentFramewhich works, but it returns an object (with the frame in), I just wondered if there was a way of getting the frame number directly?
  23. charlie_says


    HI, I was just looking at the ColorMatrixFIlter and am apparently not able to to get it to apply any effect. I'm just trying to tint all my sprites black: for (var i = 0; i < 10; i++) { var s = PIXI.Sprite.fromImage("icon_unlit_bg"); s.scale.set(0.5); s.x = i * 30; s.y = i * 20; let colorMatrix = new PIXI.filters.ColorMatrixFilter(); s.filters = [colorMatrix]; colorMatrix.desaturate(); colorMatrix.brightness(0, true); c.addChild(s); } this.addChild(c); I've also tried applying the matrix on the container sprite, with a similar lack of results. Can anyone tell me where I'm going wrong?
  24. charlie_says

    Blendmode layer

  25. charlie_says

    Blendmode layer

    Hi, The title pretty much captures it - there doesn't appear to be a layer blendmode in PIXI? Is it possible to replicate this somehow? (Blendemode layer is useful for fading down a sprite with separate internal components, as they fade as one, rather than individually.) I think that cacheAsBitmap does have this effect, but then I'm a little uncertain as to how I update the contents if they've moved?