threedollarbill

Members
  • Content count

    31
  • Joined

  • Last visited

About threedollarbill

  • Rank
    Advanced Member
  1. Image Becomes Jagged When Scaled Down

    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 this.game.renderer.renderSession.roundPixels = 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.
  2. Is it ok to have a lot of BitmapData?

    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.
  3. 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.
  4. 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; backButton.events.onInputDown.add(() => { console.log("pressed down"); }); backButton.events.onInputUp.add(() => { console.log("released!"); // <--- this still fires even though my pointer is not over the sprite });
  5. BitmapText linespacing?

    @samme wow thats worked! thanks for that!
  6. BitmapText linespacing?

    Is it possible to have linespacing for BitmapText? Only Text seems to have that option, but I can't do the same for BitmapText.
  7. Do draw calls matter when using CANVAS mode?

    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?
  8. Loaded binary file never gets added to the cache? (unable to access it)

    Ahh yes, thanks for this Tom! I saw this in the examples too just now ( https://phaser.io/examples/v2/loader/load-binary-file ). I should have looked at the examples first before posting here. Thanks again.
  9. 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/starter_puzzle.zip"; let zipLoader:Phaser.Loader = new Phaser.Loader(this.game); 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: this.game.cache.checkBinaryKey("starter_puzzle"); // this returns false this.game.cache.getBinary("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... this.game.cache.addBinary(cacheKey, binaryData); // ...do some further processing... }
  10. Possible to change color of black borders during full screen?

    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 { this.game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; if(this.game.scale.isFullScreen) { this.game.scale.stopFullScreen(); } else { this.game.scale.startFullScreen(false); this.game.canvas.parentElement.style.backgroundColor = "#20567e"; // <--- set the color here } }
  11. Landscape Full Screen Mobile - Black Bars

    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..
  12. 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 { this.game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; if(this.game.scale.isFullScreen) { this.game.scale.stopFullScreen(); } else { this.game.scale.startFullScreen(false); } }
  13. 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 = this.game.add.tween(mrFish.position); fishTween.to({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);
  14. Is there a difference between the two? Which one is recommended to use? this.game.make.tween(obj); // or this.game.add.tween(obj);
  15. Does calling stop() on a tween automatically remove / dispose of it?

    thank you for the extensive insight @Tom Atom!