I want to make a puzzle game similar to jigsaw.
I have an idea to use spritesheet to cut a image.
But i did’t know how to change frame width and height dynamically (once on game level started), or create spritesheet from loaded sprite.
Is possible to do this?
samme
2
1 Like
this.textures.addSpriteSheet('image', loaded_sprite, {frameWidth: 100, frameHeight: 100});
How to get already loaded sprite instead ?
Btw, i got an error even i change loaded_sprite to file path.
samme
5
loaded_sprite.texture.getSourceImage()
should be the 2nd argument.
1 Like
Thank you!
It’s working, but i prefer to load it directly by sprite key, something like this.getSourceImage('key')
instead to create a sprite first.
I know there are a documentation for this, but it’s difficult for me to understand it, i prefer rexrainbow style documentation.
samme
7
this.textures.get('key').getSourceImage()
1 Like
Thank you!
i already try this previously this.textures.get('key')
but i don’t know if i need .getSourceImage()
How do you know about this? is there any page that i can learn phaser 3 more?
samme
9
That one is tricky but if you follow TextureManager.addSpriteSheet() → Texture you can find Texture#getSourceImage().
It would be easier to learn from the examples, though. There doesn’t seem to be one yet.
1 Like