• Content count

  • Joined

  • Last visited

  • Days Won


charlie_says last won the day on August 25 2014

charlie_says had the most liked content!

About charlie_says

  • Rank
    Advanced Member
  • Birthday 12/12/1972

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location

Recent Profile Visitors

1,530 profile views
  1. 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?
  2. 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?
  3. 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)??
  4. 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?
  5. charlie_says

    Blendmode layer

  6. 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?
  7. charlie_says


    thanks @jonforum - will investigate that
  8. charlie_says


    Hi @ivan.popelyshev I was using the canvas renderer which was the problem... So follow up question: Is it possible to do this with canvas? Or something similar? And, is there no blendmode layer in PIXI?
  9. charlie_says


    hey @jonforum As I said, I had tried applying the filter to the 'container' sprite, but still got no effect. Basically, I want a 'black' copy of my sprites in another container. I'm working in TypeScript, which for some reason isn't showing OutlineFIlter - I still was unable to get your method working: var c:PIXI.Sprite = new PIXI.Sprite(); c.filters = [ new PIXI.filters.ColorMatrixFilter(), ]; c.filters[0]['desaturate'](); 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; c.addChild(s); }
  10. 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?
  11. charlie_says

    Angular position on a rectangle

    thanks @Antriel that was an excellent suggestion.
  12. charlie_says

    Angular position on a rectangle

    Actually, I played around with this some more, and the clock anaology is incorrect. The actual problem is this: I need to place n tiles on the edge of a rectangle (dimensions w & h), if there's too many pieces to fit then add additionally to w & h so they can...
  13. If you imagine a rectangular clock face, I need to calculate the positions where the numbers go (i.e. at the edge of the rectangle). Calculating the position on a circle is trivial, but my brain is not engaging with how I can get the position on a rectangle this morning... ...can anyone point me in the right direction?
  14. charlie_says

    Can a html <img> use a Pixi Texture object?

    I've been a slightly different variant: using a PIXI.Sprite (which has additional content) as an image source var imgSRC = renderer.extract.canvas(mySprite).toDataURL('image/png'); var img = document.createElement('IMG'); img.src = imgSRC; = '100%'; = 'auto'; document.body.appendChild(img);
  15. charlie_says

    Should I use Phaser Graphics for UI or go with HTML5?

    I think the other answers here are good, and apologies if I misread your question. The only thing I wonder about using HTML elements over the canvas is if you have some kind of dynamic resizing, it could then be trickier to move the the HTML elements (although, it would still be possible.) The one area where it would definitely be easier would be that of some sort of text input field (although, I'm a little out of date with phaser plug-ins and maybe there's a good one now.)