Closed michaelwoodruffdev closed 4 years ago
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 assets
folder located? I can't see it from that project, did you try putting the images from public
folder too? :)
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.![image](https://user-images.githubusercontent.com/45110754/73124074-7cb50280-3f5c-11ea-9504-b485b6186b48.png)
here is the html it is actually getting back from the request![image](https://user-images.githubusercontent.com/45110754/73124111-f8af4a80-3f5c-11ea-85ef-048c54b0e441.png)
here is what is rendering on the canvas![image](https://user-images.githubusercontent.com/45110754/73124082-9fdfb200-3f5c-11ea-950d-250b459fb3fb.png)
here is the code right now
The important lines are definitely
this.load.spritesheet('player', 'assets/spritesheet.png', { frameWidth: 104, frameHeight: 150 });
andthis.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.