Sign in to follow this  
Lizard

Base64 Images

Recommended Posts

Since you are adding this to `this.textures`, and not loading it using the regular `this.load`, Rich mentioned you need to do a little extra work to make this work. He commented on that GitHub issue - https://github.com/photonstorm/phaser/issues/3342#issuecomment-372332727

Note that you must listen out for the onload event from the Texture Manager before you can use the base64 texture in a game object.

So once you do the add the base 64 data to the textures object, you'll also need to do something like:

this.textures.on('onload', function() { /* do something with the texture */ });

 

Share this post


Link to post
Share on other sites

May be someone know is it possible to use preloaded images as spritesheet? Or may be here is some another way to preload spritesheet as base64?

UPD found how to add frames for already preloaded images in base64 (further it can be used as spritesheet)

this.textures.list.NAMEOFIMAGE.add(index, 0, startX, startY, width, height);

index - number of frame

startX and startY - coordinates for upper left corner cropping rectangle

width and height - size of cropping rectangle

You can easily wrap it into cycle and crop  your spritesheet to frames.

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.