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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.