Search the Community

Showing results for tags 'generatetexture'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 6 results

  1. Hello, Is there any way to force Phase to update texture without a delay? Shortly said, I have issue with Phaser.Group.generateTexture() method: 1) Lets say you have group, which fade out to alpha = 0. 2) Later you want set group back to alpha = 1 and 3) generate sprite this.game.add.sprite(0, 0, group.generateTexture()) RESULT: you will get empty sprite... However, if I do lets say 100ms delay, everything works as expected... If I fade out group to 0.1 instead of 0, I am getting texture with 0.1 transparency, which means that PIXI needs time (one tick?) to actually update alpha. QUESTION: Is there any way to fix this problem? Thanks
  2. Hi, I am trying to create generate a texture for my graphic so I can use it as a sprite. However I have a problem when using the following code: sprite = game.add.sprite(400, 300, graphics.generateTexture()); as the graphic which I want to create is done by the player, so I have no idea how to set the x axis and y axis so that the generated sprite literally takes over the place of the graphic. Is there a way to add the sprite right above the graphic?
  3. Hi, I thought it would be fun to generate the textures I need at runtime, but I can't figure out how to coerce phaser into creating and caching a sprite sheet from it. At least it can't render it, when I try I get this error: Here is the generating code... var digitsData = [ //----|----|----|----// '0000 1 2222 3333', '0 0 1 2 3', '0 0 1 2222 3333', '0 0 1 2 3', '0000 1 2222 3333', ' ', '4 4 5555 6666 7777', '4 4 5 6 7', '4444 5555 6666 7', ' 4 5 6 6 7', ' 4 5555 6666 7', ' ', '8888 9999 ', '8 8 9 9 ', '8888 9999 ', '8 8 9 ', '8888 9999 ']; var g = game.add.graphics(0, 0); g.beginFill('#999'); digitsData.forEach(function(line, y) { line.split('').forEach(function(ch, x) { if (ch === ' ') return; g.drawRect( x * pixelSize, y * pixelSize, (x+1) * pixelSize, (y+1) * pixelSize); }); }); g.endFill(); game.cache.addImage('digitsImg', null, g.generateTexture()); game.cache.addSpriteSheet('digits', null, 'digitsImg', 4 * pixelSize, 5 * pixelSize, 10, pixelSize); g.destroy(); ... and here is where I try to use it: var scoreboard1 = new entities.Scoreboard( game.width / 4, top, game.cache.getImage('digits'), game), // ... function Scoreboard(x, y, image, game) { this._image = image; this._init(x, y, game); } Scoreboard.prototype._init = function(x, y, game) { this._x = x; this._y = y; this._digits = game.add.group(); this._tens = game.add.sprite(x, y, this._image, 0); this._ones = game.add.sprite(x + this._tens.width, y, this._image, 0); this._digits.add(this._tens); this._digits.add(this._ones); this.setScore(0); }; Hope you can help me out, thanks!
  4. Im doing this.thegame.world.generateTexture(1,this.thegame.renderer);And I get a pixel perfect texture, the only issue is that some elements are not rendered in that texture. I have no idea why. My code https://github.com/omarojo/Phaser-Test6 WarpGroup.js line 197 the problem is.. Im adding ThreadGroups (Thread.js) into that WarpGroup, and they get added properly and animated and everything. Is just that the generateTexture is not rendering them. just those ThreadGroup instances. everything else is fine.WarpGroup.js line 147 and 162 is where I add those objects (the ones that are not rendering in the generateTexture) This is so bizarre...
  5. Hi guys! I want to generate a texture to use with several sprites and tilesprites from a tilemaplayer, but i dont know how to use it... ┬┐someone could you give me an example? Thanks in advance, Nicholls
  6. I have one sprite with shots curtov.hol.es/pixiloader/blasts.png I need to make array from texture and use them later. To make sprite I used TexturePacker and some frames was rotated. So I have the next code from json file exported by TexturePacker var frames = [{"filename": "11_protoss","frame": {"x":403,"y":387,"width":58,"height":37},"rotated": true},{"filename": "11_terran","frame": {"x":433,"y":377,"width":42,"height":6},"rotated": true}]To rotate texture I used DOC and generateTexture() texture = new PIXI.Texture(baseTexture, frames[i].frame);if (frames[i].rotated) { doc = new PIXI.DisplayObjectContainer(); sprite = new PIXI.Sprite(texture); sprite.rotation = - Math.PI / 2; doc.addChild(sprite); texture = doc.generateTexture();}Everything fine in Chrome, but all rotated in FF without transparency.http://curtov.hol.es/pixiloader/