lincore

Members
  • Content Count

    3
  • Joined

  • Last visited

About lincore

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Neat, thanks a lot! Thank you very much. Actually, it doesn't really matter to me if I do it from a Texture, I asked about that specifically out of sheer ignorance. I just picked up Phaser a few days ago and haven't had the time to actually understand what I am talking about. I'll go with sumof's example, you surely have better things to do than writing code for me :~)
  2. I see. Does that mean phaser offers no other way to create a spritesheet from PIXI.Textures? If not I guess I'll have to load a file instead. Thank you for your explaination.
  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!