• Content Count

  • Joined

  • Last visited

  1. dacatchman


    Thanks for the reply. In Chrome v76, I am getting this randomly when using videos: Sometimes it happens, sometimes it doesn't. Just sitting there refreshing the page sometimes the video plays and other times I get those errors in the console and no video. Any ideas?
  2. dacatchman


    Okay, small update. I figured that I could access the HTML video object directly by going down the object chain, which I can, ie: mySpriteVideo._texture.baseTexture.source.play(); Generally we treat _variables as private, so it feels wrong to do it this way; any other ideas? This can't be what the developers of PIXI intended? Any reason we can't get a PIXI.Video with frame control on it?
  3. dacatchman


    So older pixi had a movieclip, but newer docs show to use AnimatedSprite. Problem is, the construct an animated sprite we need an array of textures. However, all the demos for v4 and v5 for video are just PIXI.Texture.from('path/to/video') and it makes a new texture/sprite each time the video would play. I'm interested in using the animatedSprite loop/gotoAndPlay methods because I'm trying to show videos on demand. Any ideas? I'm quite new to PIXI so it's innards and how to get like, the frames of a Texture and such, are a mystery to me. Thanks!
  4. Thanks Drhayes. Still new to Phaser so this one tripped me up.
  5. It's been a long day and I might just be overlooking the basics, but this seems wrong to me for some reason. var MyClass = function() {var self = this;this.game = new Phaser.Game(1024, 768, Phaser.AUTO, 'game', {preload:this.preload});}MyClass.prototype.constructor = MyClass;MyClass.prototype.preload = function() {console.log(this); // <--- Phaser.Game, not MyClass}var app = new MyClass();
  6. I'm talking the user defined callbacks.
  7. Why do you do this in Phaser? For example, the preload/create callbacks, changes the context by using call and sets it to the game. That just stomps on prototypal class structure, if for example, you wanted a class to contain a game object. Should it behave this way? Why not just pass a reference to the game as an argument, or allow the end user to handle it themselves and not force this?
  8. Took me a while to followup. For those interested, drhayes was correct. You simply extend Phaser.Particle and there is an onEmit callback that the emitter invokes at creation. Here's some sample code: var confetti_colors = ['FFFF00','FF9933','FF0000','3399FF','9933CC'];var ConfettiParticle = function(game, x, y, key, frame){ Phaser.Particle.call(this, game, x, y, key, frame);}ConfettiParticle.prototype = Object.create(Phaser.Particle.prototype);ConfettiParticle.prototype.constructor = ConfettiParticle;ConfettiParticle.prototype.onEmit = function(){ this.tint = '0x'+confetti_colors[Math.floor(Math.random()*confetti_colors.length)];}... (where you define your emitter) ...emitter.particleClass = ConfettiParticle;
  9. Is it possible to get an oncreate callback or some such for the particle emitter? I just want to randomly set the particle color when it's created (via tint, for example). Right now, I have to make a function on update that steps through non-colorized particles and sets a color (then a flag so I don't re-set the color again). This works, but it's not terribly efficient, FPS wise. Any other way to accomplish this?
  10. Always feel silly asking then answering it myself, but for those interested you can accomplish this by making your own bitmap data object, filling the text (plain ol' canvas method, ctx.fillText for example) and then use the bitmap data itself to construct your phaser sprite. For example: var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'render-text', { preload: preload, create: create });var bmd = null;var spr = null;// The Google WebFont Loader will look for this object, so create it before loading the script.WebFontConfig = { active: function() { game.time.events.add(Phaser.Timer.SECOND, createText, this); }, google: { families: ['Revalia'] }};function preload() { game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');}function create() { game.stage.setBackgroundColor(0x2d2d2d); bmd = game.make.bitmapData(400,200);}function createText() { bmd.ctx.beginPath(); bmd.ctx.rect(0,0,400,200); bmd.ctx.fillStyle = '#FF0000'; bmd.ctx.fill(); bmd.ctx.fillStyle = '#000000'; bmd.ctx.font = '32px Revalia'; bmd.ctx.fillText('hello,phaser!',40,40); spr = game.add.sprite(100,100,bmd); spr.inputEnabled = true; spr.input.enableDrag();}
  11. So I'm basically trying to make a tilesprite composed of text. The idea is so I can have dynamic text to behave like a sprite, rather than constructing a different spritesheet for every kind of font I might need. The primary use is to scroll through the text (think like a slot machine?) composed of text, rather than icons. Hence the tilesprite, but I'm sure there's other ways to do it. None of the examples really deal with text being used in such a fashion, so I'm not sure where to begin. This is done fairly simply in just plain old canvas, but I'm not really sure a Phaser equivalent? I thought perhaps RenderTexture, but I can't seem to construct one without using an actual image. I haven't used Phaser since 1.1.3 or so, so I'm not really familiar with all the changes. Anyone got some insight on where to begin here?
  12. Anyone done it yet? http://www.brashmonkey.com/spriter.htm
  13. --edit, missed a part of what you said about the pot being limited to tiled sprites. Thanks for your help on this stuff, I'll hack away and see what's what. I'll likely just stick to Canvas though, it's not a terribly performance hungry application.
  14. Hi all. Enjoying Phaser thus far, but one primary concern I have is if the window running phaser is not in focus, phaser simply stops executing. I know javascript doesn't halt on my system when out of focus, and I've seen other HTML5 games continue to animate (albeit at lower interval of course), but Phaser just outright stops. Is this by design or a limitation? Is there an obvious work around I am not seeing in the docs? Secondly, about WebGL. 1) Is power of 2 always going to be a constraint? I know at the hardware level it is, but many libraries have overcome the issue for end-developers... This of course is not a high priority thing, but I'm just curious (for now I just use canvas). 2) Using a tiled sprite, there is a great degree of shaking/blinking making it pretty much unusable for my current implementation. I read (and posted to no avail) in a previous thread who said upgrading to 1.1.3 fixed the issue for him (he was talking about the examples). For me, though, even with the latest branch it still does it when webGL is selected. I'm on MacOS using Chrome, but the behavior is reproduced for me across every browser so far (I have VM access and can try it on any OS ever; but immediately it annoys me greatly and so I just use canvas for now I'd like to use AUTO for the game object, however, for obvious reasons. Though the power of 2 issue pretty much kills it for my game due to the way my project is designed. I'm making a slot machine game and the "reels" scroll based on a fixed image and so the texture must be 1 icon in width and X icons in height -- and power of 2 crushes my hopes and dreams for variable reel lengths. (Perhaps I'm lazy and shouldn't tile sprite and generate random sprites for the rolling animation; trying to be efficient here tho and maintain some realistic feel -Dan