autemox

Members
  • Content Count

    4
  • Joined

  • Last visited

  1. Thank you for looking at my fiddle: https://jsfiddle.net/autemox/5x6c3h4s/76/ I tried doubling, tripling, and even x 100 the PIXI.tilemap.Constant.xxx values but none of it had an affect.
  2. (edit: solved, see ivan's comments) Hello, I have come across a problem with pixi-tilemap. I created a small application to show this problem off and see if anyone can help me. It can be viewed on github HERE (edit: or fiddle here) or seen below: export class Game { app: PIXI.Application; // declare the pixi application constructor() { this.app = new PIXI.Application({backgroundColor: 0x1099bb}); // create the pixi application PIXI.loader.add([ // load assets 'assets/images/terrian-01.json', // asset list 'assets/images/benjiro-01.json' ]) .load(this.loaded.bind(this)); // loaded() runs after assets are loaded } loaded() { const tilemap = new PIXI.tilemap.CompositeRectTileLayer(0, []); // can pass textures to this array in second argument, if I do, it does not help anything, but similar results: whichever texture is passed first will appear. the other texture will not. tilemap.addFrame(PIXI.loader.resources['assets/images/terrian-01.json'].textures['terrian-01-287.png'], 64, 0); // a large sign. will load because it is the first spritesheet to be called with addFrame() tilemap.addFrame(PIXI.loader.resources['assets/images/benjiro-01.json'].textures['benjiro-01-181.png'], 0, 0); // a log with an axe in it. will not load unless you put this line up one line higher tilemap.addFrame(PIXI.loader.resources['assets/images/terrian-01.json'].textures['terrian-01-286.png'], 128, 0); // a small sign. will load because it is on the same spritesheet as the large sign and it was the first spritesheet to be called this.app.stage.addChild(tilemap); } } I was unable to find any documentation for pixi-tilemap or communities specifically for it so hopefully this is the best place to post for help. To create a tilemap, I used CompositeRectTileLayer() then addFrame() to add each tile. I attempted to add 3 tiles to the screen. First is terrian-01-287 from the terrian-01 spritesheet. This would be placed at (64, 0). This successfully places. The second is benjiro-01-181 from the benjiro-01 spritesheet. This would be placed at (0, 0), to the left of the first sprite. It does not appear, but there is no error, the texture is successfully passed to addFrame(). Finally, I add another tile, terrian-01-286, and it succesfully adds. The result looks like this: This above picture shows that the texture from terrian-01.json both successfully added to tilemap but the texture from benjiro-01 did not. In fact if you move the line of code that says addFrame(...benjiro-01...) to be the first to run, you will get this: In this case, since benjiro-01.json was the first to be sent to addFrame(), it appears. Neither textures from terrian-01 appear. It is worth noting that I carefully checked the validity of the textures being passed to addFrame() and found nothing unusual. Also if I pass the textures in to the second argument when cost tilemap is declared, which ever texture is passed in will load and the other will not (so same problem). I want to be able to load tiles from multiple resources into the same CompositeRectTileLayer. Alternatively, I can create a CompositeRectTileLayer for each resource, but it doesn't seem like the ideal solution to the problem. Am I doing something wrong here? This doesnt seem to make any sense! Thank you. Any help would be great!
  3. UPDATE: i used Rectangle instead of PIXI.Rectangle. Problem solved. Hello. I am following along with a tutorial https://github.com/kittykatattack/learningPixi I was able to run Pixi successfully in an Angular 6 app using steps I describe here:https://old.reddit.com/r/pixijs/comments/9dzdme/how_to_use_pixi_js_with_angular_6/ I was able to sucessfully load sprites without spritesheets using this code: https://www.paste.org/95084 When attempting to load sprites with spritesheets using this code ngOnInit() { this.app = new PIXI.Application({ // this creates our pixi application width: 800, height: 600, backgroundColor: 0x1099bb }); this.pixiContainer.nativeElement.appendChild(this.app.view); PIXI.loader .add([ 'assets/images/chicken.png', // load sprite textures 'assets/images/chicken-spritesheet.png' ]) .on("progress", this.loadProgressHandler) .load(this.setup.bind(this)); } loadProgressHandler(loader, resource) { console.log(`loaded ${resource.url}. Loading is ${loader.progress}% complete.`); } setup() { // runs when textures are done loading console.log(`loading complete.`); // prepare the spritesheet let texture = PIXI.utils.TextureCache["assets/images/chicken-spritesheet.png"]; //Create the `tileset` sprite from the texture let rectangle:Rectangle = new Rectangle(0, 0, 16, 16); //Create a rectangle object that defines the position and size of the sub-image you want to extract from the texture texture.frame = rectangle; //Tell the texture to use that rectangular section //Create the sprite from the texture let bunny = new Sprite(texture); } I encounter an error: ERROR in ./node_modules/pixi.js/lib/core/renderers/webgl/filters/spriteMask/SpriteMaskFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\core\renderers\webgl\filters\spriteMask' ERROR in ./node_modules/pixi.js/lib/core/sprites/webgl/generateMultiTextureShader.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\core\sprites\webgl' ERROR in ./node_modules/pixi.js/lib/extras/webgl/TilingSpriteRenderer.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\extras\webgl' ERROR in ./node_modules/pixi.js/lib/filters/alpha/AlphaFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\alpha' ERROR in ./node_modules/pixi.js/lib/filters/colormatrix/ColorMatrixFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\colormatrix' ERROR in ./node_modules/pixi.js/lib/filters/displacement/DisplacementFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\displacement' ERROR in ./node_modules/pixi.js/lib/filters/fxaa/FXAAFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\fxaa' ERROR in ./node_modules/pixi.js/lib/filters/noise/NoiseFilter.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\filters\noise' ERROR in ./node_modules/pixi.js/lib/loaders/bitmapFontParser.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\loaders' ERROR in ./node_modules/pixi.js/lib/mesh/webgl/MeshRenderer.js Module not found: Error: Can't resolve 'path' in 'C:\...\first-app\node_modules\pixi.js\lib\mesh\webgl' i 「wdm」: Failed to compile. Here is the full code: https://github.com/autemox/first-pixi-angular-6-app/blob/master/src/app/app.component.ts Does anyone have any guidance for me? I'm not sure what is wrong. Thank you.