Jump to content

compressionAlgorithm [ERROR]


TrinityCore
 Share

Recommended Posts

Hello Guys!

I want to know why this error is coming out:

phaser.js:17481 Uncaught TypeError: Cannot read property 'compressionAlgorithm' of null
at PIXI.WebGLRenderer.updateTexture (phaser.js:17481)
at PIXI.WebGLSpriteBatch.renderBatch (phaser.js:18911)
at PIXI.WebGLSpriteBatch.flush (phaser.js:18890)
at PIXI.WebGLSpriteBatch.renderTilingSprite (phaser.js:18629)
at Phaser.TileSprite._renderWebGL (phaser.js:60299)
at Phaser.World.PIXI.DisplayObjectContainer._renderWebGL (phaser.js:15056)
at Phaser.Stage.PIXI.DisplayObjectContainer._renderWebGL (phaser.js:15056)
at PIXI.WebGLRenderer.renderDisplayObject (phaser.js:17377)
at PIXI.WebGLRenderer.render (phaser.js:17343)
at Phaser.Game.updateRender (phaser.js:35041)

this is my code:
 

Preload = {

	preload: function(){
		PhaserGame.load.image("Background", "./img/Preload.jpg");
		PhaserGame.load.image("LoadingFrame", "./img/Loading/LoadingFrame.png");
		PhaserGame.load.image("Loading", "./img/Loading/LoadingBar.png");
	},

	create: function(){

		// INTERFAZ //
		this.Background = PhaserGame.add.image(0, 0, "Background");
		PhaserGame.scale.pageAlignHorizontally = true;
		this.LoadingBar = PhaserGame.add.tileSprite(PhaserGame.width/2-(416), PhaserGame.height/2-(26-80), 832, 52, "Loading");
		this.LoadingBar.width = 0;
		this.LoadingFrame = PhaserGame.add.image(this.LoadingBar.position.x, this.LoadingBar.position.y, "LoadingFrame");
		this.LoadingPercentage = PhaserGame.add.text(0, 0, "", {font: "bold 18px Arial"});
		this.LoadingPercentage.addColor("#000000", 0);

		// EVENTOS //
		PhaserGame.load.onLoadStart.add(this.Start, this);
		PhaserGame.load.onFileComplete.add(this.Loading, this);
		PhaserGame.load.onLoadComplete.add(this.Finished, this);
		this.Preloaders();

	},


	update: function(){},

	Preloaders: function(){
		PhaserGame.load.image("Background", "./img/Assest/Background001.png");
		PhaserGame.load.image("BarFrame", "./img/Assest/BarFrame.png");
		PhaserGame.load.image("BlueBar", "./img/Assest/BlueBar.png");
		PhaserGame.load.image("RedBar", "./img/Assest/RedBar.png");
		PhaserGame.load.image("GreenBar", "./img/Assest/GreenBar.png");
		PhaserGame.load.image("Coin", "./img/Assest/Coin.png");
		PhaserGame.load.image("Energy", "./img/Assest/Energy.png");
		PhaserGame.load.image("Star", "./img/Assest/Star.png");
		PhaserGame.load.image("StatusBar001", "./img/Assest/StatusBar001.png");
		PhaserGame.load.image("StatusBar002", "./img/Assest/StatusBar002.png");
		PhaserGame.load.image("StatusBar003", "./img/Assest/BarFrame.png");
		PhaserGame.load.image("Lock", "./img/Assest/Lock.png");
		PhaserGame.load.image("Unlock", "./img/Assest/BarFrame.png");
		PhaserGame.load.image("Health001", "./img/Assest/Health001.png");
		PhaserGame.load.image("Health002", "./img/Assest/Health002.png");
		PhaserGame.load.image("Health003", "./img/Assest/Health003.png");
		// BOTONES //
		PhaserGame.load.spritesheet("Button002", "./img/Buttons/002.png", 108, 48);
		PhaserGame.load.start();
	},

	Start: function(){
		this.LoadingPercentage.text = "Preparing...";
		this.LoadingPercentage.position.x = this.LoadingFrame.position.x+(this.LoadingFrame.width/2-(this.LoadingPercentage.width/2));
		this.LoadingPercentage.position.y = this.LoadingFrame.position.y+(this.LoadingFrame.height/2-(this.LoadingPercentage.height/2));
	},

	Loading: function(progress){
		this.LoadingBar.width = 832*progress/100;
		this.LoadingPercentage.text = progress+"%";
		this.LoadingPercentage.position.x = this.LoadingFrame.position.x+(this.LoadingFrame.width/2-(this.LoadingPercentage.width/2));
		this.LoadingPercentage.position.y = this.LoadingFrame.position.y+(this.LoadingFrame.height/2-(this.LoadingPercentage.height/2));
	},

	Finished(){
		PhaserGame.state.start("MainMenu");
	}

}

This is the line of the error:

this.Background = PhaserGame.add.image(0, 0, "Background");

If that line is commented, do not throw mistakes

Why is this?

Link to comment
Share on other sites

3 hours ago, ncil said:

I don't know if this is contributing to the problem, but something I noticed is that you are loading two different image assets that have the same key of "Background". Once in the preload function and then again in the preloaders function. Try changing one of those to something else and see what happens.

Yes, that was the mistake, thank you!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...