Phaser 3 Sprite Shows Black Rectangle

Category: Game Development
Phaser 3 Black Sprite Issue

I am working on creating an HTML mobile game using Phaser 3. So far, I have used sprites and images in multiple games that I have developed so far. Today when I added sprite and was testing on Android mobile device, it did not show the sprite. Instead, it showed up as black rectangle.

Phaser 3 sprite shown as black rectangle

Initially I though that I had an animation which was causing some issue. I temporarily turned off the animation and it still kept showing black rectangle. I compared the code with previously developed games and I did not see any obvious error.

After some time, I found out the root cause. The only difference between previous game sprite and current game sprite is the way I have created the sprite. In current game, I have added all images within sprite horizontally. It caused the entire image to be too much long. So instead of one row sprite, I converted that sprite into a sprite with decent number of rows and columns. Once done, everything started working.

Share

0 comments

Your email address will not be published.