• Content Count

  • Joined

  • Last visited

Everything posted by threedollarbill

  1. Actually, i just tested 2.10.4 now and it doesn't seem to handle the audiocontext issue. I still get no sound despite clicking on the canvas.
  2. @samme: Thank you! @Phaser911: If you're still using an older version of Phaser you should..
  3. I'm currently using 2.9.4.. Looks like 2.10.3 is out. Does that version handle the audiocontext issue?
  4. Ok I was able to fix it. For anyone wondering, this is what I did: => {; });
  5. Hi, the sound on my games suddenly cannot be heard. I'm not sure what's going on. When I look at the console (Chrome), it shows a message saying "The AudioContext was not allowed to start. It must be resume (or created) after a user gesture on the page.". Does anybody have an idea of what's going on? How can I get the sounds play again?
  6. Let's say I start a tween like this: // create sprite let mySprite:Phaser.Sprite = this.create(300, 50, "my_atlas", "bee"); // tween sprite let yTween:Phaser.Tween =;{y: 150}, 1500, Phaser.Easing.Linear.None, false, 0, 999, true); yTween.start(); Does calling "destroy" on the sprite also destroy it's tween? Or will the tween be silently running in the background until it runs 999 times? // destroy sprite (will this also kill the tween and remove it from memory?) mySprite.destroy(true);
  7. I have a transparent image which i am adding on to the stage. The original image is crisp and smooth. However, when I scale it down, it becomes jagged. I am scaling the image with imageSprite.scale.setTo(0.25390625); I've already tried the following and nothing made a difference: 1.) Set the sprite's "smoothed" property to true imageSprite.smoothed = true; 2.) Enable antialiasing new Phaser.Game(754, 690, Phaser.CANVAS, "game_container", null, false, true); 3.) Round pixels = true; I've attached a screenshot of what I'm seeing, and the original image if anybody wants to test it on their own. I would appreciate it if someone could give a solution for this. Thanks.
  8. The client I am working for wants to be able to change how elements inside the game are colored just by just changing a variable in the code (for example "#FF0000" for red, or "#00FF00" green). So basically, what I plan to do is to just tint the sprites to whatever color on runtime, and then draw them to a BitmapData then save it in the cache so I can reuse them over and over without making it too expensive for the CPU (I've read that tinted sprites are heavy when on Phaser.CANVAS). My question is, is creating a lot of BitmapData bad? Apart from the memory that they will take up, is there anything I should be concerned about? I've read that each BitmapData is actually a new canvas. If so, does that mean a lot of BMD = a lot of new canvases = slower performance? Haha I hope I'm making sense.
  9. Is it possible to add an effect similar to Photoshop's "Bevel Emboss" on a Graphics object? Basically, I would like to draw custom shapes on the fly with an embossed look to them.
  10. I find it strange that the "onInputUp" event on a sprite still fires even if my mouse / pointer is not hovering it. Basically, I press down on a sprite, then move my mouse / pointer away before releasing it. I was expecting the "up" event not to fire but it still does. Below is the code I'm using. I'm using typescript by the way. let backButton:Phaser:Sprite = this.create(150, 150, "TA_1", "back_button"); backButton.inputEnabled = true; => { console.log("pressed down"); }); => { console.log("released!"); // <--- this still fires even though my pointer is not over the sprite });
  11. @samme wow thats worked! thanks for that!
  12. Is it possible to have linespacing for BitmapText? Only Text seems to have that option, but I can't do the same for BitmapText.
  13. When using WebGL mode, I know that the less spritesheets / texture atlases you use, the better the performance. In other words, the more you can pack into a single spritesheet, the less the draw calls, and thus the better the performance will be. Is it the same case for CANVAS mode? Is it still important for me to pack my as much images as I can into a single spritesheet? Or does it not matter for CANVAS?
  14. Ahh yes, thanks for this Tom! I saw this in the examples too just now ( ). I should have looked at the examples first before posting here. Thanks again.
  15. I am able to load a binary file but I cannot access it from the cache. I seem to be doing everything correctly. I am loading a zip file by doing this: let zipURL:string = Constants.HOST_BASE_PATH + "puzzles/"; let zipLoader:Phaser.Loader = new Phaser.Loader(; zipLoader.binary("starter_puzzle", zipURL, this.onZipBinaryLoaded, this); zipLoader.start(); private onZipBinaryLoaded(cacheKey:string, binaryData:any):void { // this succeeds, and i do some processing here... } Later on in the game, I try to access that binary file from the cache, but I cannot seem to access it. I've tried the following:"starter_puzzle"); // this returns false"starter_puzzle"); // this returns a "not found in cache" warning I wonder what I'm missing here. I've even tried to explicitly add it to the cache, but still I am unable to access it later on. private onZipBinaryLoaded(cacheKey:string, binaryData:any):void { // here i explicitly add it to the cache do some further processing..., binaryData); // some further processing... }
  16. for anybody having the same problem, i discovered that upon starting full screen, the canvas element is wrapped in a div that has a background-color of black.. so the solution i found was to basically change the background-color property to the one i want right after starting full screen.. public onFullScreenButtonMouseDown():void { = Phaser.ScaleManager.SHOW_ALL; if( {; } else {; = "#20567e"; // <--- set the color here } }
  17. Hi, I know this thread is old, but is it possible to at least change the color of those black bars? I tried this.stage.backgroundColor but it does not do the trick..
  18. I have a "full screen" button on my game which basically toggles between fullscreen on and off. I have set fullScreenScaleMode to "SHOW_ALL" to maintain the aspect ratio of the game on fullscreen. This works as expected, but also results in having black borders on the sides. I was wondering if its possible to change the black borders to a different color other than black. I would like to match it with the game's background color. My game also uses this.stage.backgroundColor = 0x95cb60 but it only changes the color of the actual game area, and not the side borders when on full screen. I am using Canvas by the way, not WebGL. This is the code I'm currently using for full screen: public onFullScreenButtonMouseDown():void { = Phaser.ScaleManager.SHOW_ALL; if( {; } else {; } }
  19. If I have a sprite and I started tweening it, maybe by doing something like.. // create mrFish sprite, add it to this group and begin animating it let mrFish:Phaser.Sprite = this.create(0, 0, "myAtlas", "fish"); let fishTween:Phaser.Tween =;{x: 500}, 3000, Phaser.Easing.Linear.None, false, 0, 0, false); fishTween.start(); Let's say before the tween even finishes, I decide to destroy the object.. Does that automatically take care of the tween and dispose it too? // remove and destroy all sprites in this group (including mrFish) this.removeAll(true);
  20. Is there a difference between the two? Which one is recommended to use?; // or;
  21. Does calling stop() on a tween automatically remove / dispose it from memory? Also, I read here that a tween is automatically removed once it's completed. Is this still the case? I just want to make sure I'm handling my tweens properly so I don't have any memory leaks.
  22. Yes, even after loading has completed, the binary file cannot be found in the cache when trying to access it via its key. The reason why I am trying to do this is because I would like to prevent memory leaks by removing binary files that are no longer being used by my application. The code I originally posted is a simplified version of what I am trying to do. This is what my onLoadBinary function actually looks like. I am basically loading WebP images via the binary loader, decoding them, and creating sprites out of them. private onWebPBinaryFileLoaded(key:string, data:any):void { // convert binary data to array let dataArray:Uint8Array = new Uint8Array(data); // decode image data and create bitmapdata from it let imageData = window.DWP(dataArray); let bmd:Phaser.BitmapData =, imageData.height, key, true); bmd.ctx.putImageData(imageData, 0, 0); // create sprite and add it to the display let imageSprite:Phaser.Sprite =, 0, bmd.texture); this.imagesContainer.addChild(imageSprite); // store record of key this.currentKeysArray.push(key); // <-- I AM STORING THE KEY HERE FOR USE LATER } Later on in my application, once I no longer need the binary file / data, I want to make sure that it is no longer in memory by attempting to look for it in the cache and if found, remove it. I do something like this. private clearPreviousBinariesFromCache():void { // remove binary from cache if found for(let theKey of this.currentKeysArray) { if( {; console.log("found and removed binary!"); // <-- THIS NEVER FIRES AND NO BINARY FILES EVER SEEM TO BE FOUND.. } } // destroy and remove bitmapdata if found let targetBMD:Phaser.BitmapData; for(let theKey of this.currentKeysArray) { if( { // destroy bitmapdata targetBMD =; targetBMD.destroy(); targetBMD = null; // remove bitmapdata from cache; console.log("found and destoyed bmd!"); // <--- THIS FIRES, AND I AM ABLE TO DELETE BMDs } } // reset key array this.currentKeysArray = []; }
  23. How come I cannot access a binary file from the cache? The documentation says that it gets added to the cache after being loaded. I am able to access the data and do whatever I want with it, there's no problem with that. But I just can't access it from the cache, and I'm wondering why. My code goes something like this.. // create a new loader and begin loading... let myLoader:Phaser.Loader = new Phaser.Loader(; myLoader.binary("myBinaryKey", "url/to/my/binary/file", this.onBinaryLoaded, this); // this is the function that is run when the binary file is loaded private onBinaryLoaded(key:string, data:any):void { // attempt to get binary file via cache key let myBinaryFile:any =; // <-- this outputs a "key not found in cache" warning // output data to the console console.log(data); // <-- this successfully outputs the data to the console.. }