Ricardo Masao

Error adding a tileSprite with a texture generated by Pixi.

Recommended Posts

 

Hello everyone,

First time using Phaser, and I'm trying to add a tileSprite to the game using a texture generated by Pixi. But I'm getting the following warnings and errors:

Warning - Phaser.Cache.getImage: Key "__default" not found in Cache.
Warning - 
phaser.min.js:3 Phaser.Cache.getImage: Key "__missing" not found in Cache.
Error - phaser.min.js:3 Uncaught TypeError: Cannot read property 'base' of null at new c.TileSprite

 

I discovered that the error disappears when I add a preload method, load any image, even an image that does not exist. By doing this, the tile appears normally and the erros desappears. Can anyone tell me what's going on? I need to use textures already loaded outside the Phaser.

My Code(.coffee)

@_game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, @element,
	preload: @_preload
	create: @_onPhaserCreate
	update: @_onPhaserUpdate
	render: @_onPhaserRender)

_preload:()=>
	@_game.load.image('load-nothing', '');

_onPhaserCreate:()=>
	@_game.physics.startSystem(Phaser.Physics.ARCADE);

	@_background = new PIXI.Texture(new PIXI.BaseTexture("image_element"))
	@_stars = @_game.add.tileSprite(0, 0, window.innerWidth, window.innerHeight, @_background)

_onPhaserUpdate:()=>
	#

_onPhaserRender:()=>
	#

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.