charlie_says

Members
  • Content Count

    225
  • Joined

  • Last visited

  • Days Won

    1

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
    http://playsnicely.co.uk
  • Twitter
    playsnicely

Profile Information

  • Gender
    Male
  • Location
    Southampton

Recent Profile Visitors

1,632 profile views
  1. 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,this.game.width,this.game.height);
  2. Hi, I'm trying to do something similar to this example: https://phaser.io/examples/v2/bitmapdata/radial-gradient But, I'm working in TypeScript, and it doesn't 'like' the last part: bmd.circle(outerCircle.x, 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?
  3. 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"
  4. 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!
  5. 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?
  6. 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?
  7. 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)??
  8. 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?
  9. charlie_says

    Blendmode layer

    thanks!
  10. 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?
  11. charlie_says

    ColorMatrixFilter

    thanks @jonforum - will investigate that
  12. charlie_says

    ColorMatrixFilter

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

    ColorMatrixFilter

    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); }
  14. charlie_says

    ColorMatrixFilter

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

    Angular position on a rectangle

    thanks @Antriel that was an excellent suggestion.