-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading images in React #13
Comments
Please attach the repo of your project :) |
Right, sorry about that. Here you go: https://github.com/michaelwoodruffdev/PixelSmash |
Let me check at night 👍 |
Thanks any help would be awesome. I'm developing and debugging in a non-react environment for the time being so no rush. Thanks again let me know if you need anything else from me |
@michaelwoodruffdev where is the |
Alright that was the issue. That's embarrassing. Thanks for the help haha |
I'm making a game where phaser needs to be embedded within a React component. This package seems like a great solution but I'm having trouble loading in images.
I'm hosting a local server using the standard serve command for react, so I know it can't be an access to image file issue.
When loading a png spritesheet I'm getting a black box with a line through it rendering to the screen. I know this means that the image didn't successfully load, so I checked the network tab of my developer tools in the browser. It's showing that it's successfully loading in the resource as an HTML and not as an image.
here is the html it is actually getting back from the request
here is what is rendering on the canvas
here is the code right now
The important lines are definitely
this.load.spritesheet('player', 'assets/spritesheet.png', { frameWidth: 104, frameHeight: 150 });
and
this.player = this.physics.add.sprite(100, 100, 'player');
but I don't believe this code to be the issue, as I've tried to do the same with images in a phaser app outside of React and it has worked just fine. I'm probably missing something obvious. Any help would be appreciated.
The text was updated successfully, but these errors were encountered: