gcardozo

Members
  • Content count

    11
  • Joined

  • Last visited

About gcardozo

  • Rank
    Member

Contact Methods

  • Twitter
    @gcardozo_
  1. How to test the performance of a phaser game?

    @agonya are you using atlases? It may improve your game's performance. Tutorial: https://www.codeandweb.com/texturepacker/tutorials/creating-spritesheets-for-phaser-with-texturepacker
  2. Memory usage increases 10x after sound loading

    @samid737 do you know how much memory is usually saved by combining all audios into one audio sprite instead of using several Phaser.Sound?
  3. Memory usage increases 10x after sound loading

    @samme is there any work around to improve it?
  4. Hi, I have a folder with 23MB of sounds (including music), all of them are in .ogg format because I need to support really old browsers. When loading those sounds, memory usage goes up to 900MB. If I comment the lines below, it stays about 90MB. What am I doing wrong? Controller.numMusic = 5; //Load music: for (var i = 0; i < Controller.numMusic; i++) { let soundName:string = "music" + i; this.game.load.audio(soundName, "assets/audios/music/" + soundName + ".ogg"); } this.game.load.audio("menu", "assets/audios/music/menu.ogg"); this.game.load.audio(ESounds.ACERTOU, "assets/audios/" + ESounds.ACERTOU + ".ogg"); this.game.load.audio(ESounds.ERROU, "assets/audios/" + ESounds.ERROU + ".ogg"); this.game.load.audio(ESounds.ANDANDO, "assets/audios/" + ESounds.ANDANDO + ".ogg"); this.game.load.audio(ESounds.CAINDO, "assets/audios/" + ESounds.CAINDO + ".ogg"); this.game.load.audio(ESounds.CLICK_BT, "assets/audios/" + ESounds.CLICK_BT + ".ogg"); this.game.load.audio(ESounds.CLICK_RUN, "assets/audios/" + ESounds.CLICK_RUN + ".ogg"); this.game.load.audio(ESounds.GRAB_ARTIFACT, "assets/audios/" + ESounds.GRAB_ARTIFACT + ".ogg"); this.game.load.audio(ESounds.PUT_ARTIFACT_ALTAR, "assets/audios/" + ESounds.PUT_ARTIFACT_ALTAR + ".ogg"); this.game.load.audio(ESounds.BREAK_ARTIFACT, "assets/audios/" + ESounds.BREAK_ARTIFACT + ".ogg");
  5. I'm trying to crop a Phaser.Text, so I can make something similar to the As3 TextField class (where your text is inside of a mask). But the crop method is not working, here is what I did: this.pText = new Phaser.Text(this.game, 0, 0, text, style); this.pText.crop(new Phaser.Rectangle(0, 0, 20, 20), true); this.pText.updateCrop();
  6. Hi, when I create an empty image, I always get a 32x32 pixels image. //As you can see, I'm not passing any 'key' this.img = this.game.add.image(x, y); Then, even after adding a rectangle to my Phaser.Image, its size is still 32x32. this.rect = new Phaser.Graphics(game); this.rect.beginFill(color, alpha); this.rect.drawRect(0, 0, 200, 100); this.rect.endFill(); this.img.addChild(this.rect); And if I manually set the image width and height properties, it would scale the image children. So, how can I create an empty Phaser.Image of a specific size? Edit: I'm not sure this is the right way of doing it, but I guess I could give this image a texture with the size I need.
  7. Component based architecture in Typescript

    @flyovergames that's exactly what I was looking for, thank you!
  8. Hi, Phaser devs! I'm developing a game using Phaser with TypeScript and what I'm trying to achieve is this: var component:AwesomeComponent = actor.getComponent<AwesomeComponent>(); I know there's a workaround by constructing objects of type T. But I don't like it because I'd probably need to define tons of different constructors to represent all differents kinds of components. What I'm doing so far is passing a string with the type (of course a number would be better, but I'm still prototyping): getComponent<T>(componentType:string): T { for (let i = 0; i < this.components.length; i++) { if (componentType == this.components[i].componentType) { return <T><any>this.components[i]; } } return undefined; } It works, but the result is not good, you have to type the class name twice: var animComp = actor.getComponent<AnimationComponent>("AnimationComponent"); Any suggestions on how to solve it? I know there`s a way to do it, because Unity does exactly that in JavaScript. Thank you for your time!
  9. Hi, Is your tileset "tmw_desert_spacing" and tilemap JSON inside the same folder? Because in your tilemap property "tilesets", looks like it's expecting to be in the same folder: "image":"tmw_desert_spacing.png", I didn't understand what you're trying to achieve here: sid = map.tiles[tile.index][2]; set = map.tilesets[sid]; map.tiles returns the property "tiles" from your tilemap json, and I didn't see any "tiles" property there. If your're trying to get an specific tile, you can do it using: var tile = map.getTile(x, y, layer, true); Bonus: //to get the tileset ID (number): var tilesetID = map.getTilesetIndex("tmw_desert_spacing");
  10. Hi, I'm quite new to web development, so I'm quite lost regarding to make VS Code Intellisense work for PixiJS. I'm currently using Webpack 2 and I'm able to run PixiJS examples, but only because I've included this in my index.html file: <script type="text/javascript" src="libs/pixi.min.js"></script> So, my code works, but I don't get any autocomplete in VS Code because I don't know how to import Pixi classes and methods into my .js project files. Can someone give me pointers or a small tutorial about that? Thanks a lot