I’ve been following this tutorial on making a multiplayer card game for Phaser 3
Link Here: https://youtube.com/playlist?list=PLCbP9KGntfcEDAiseVwYVbrmJdoYajNtw&si=2GXSV1LalQ7x7KKM
But upon attempting to preload my images (shown at the ~6:30 mark on the “Building UI” Video), the console informs me that none of the assets can be found (404 Error).
Are there any ideas on potential fixes for this issue?
samme
March 5, 2025, 3:25pm
2
Hi there,
I’m not quite sure how to use the “file loader”?
I’m very new to using this software, and don’t quite understand all it’s telling me to do
Additionally, looking at the “sources” tab in “Inspect Element” shows that “assets” folder is completely absent from the “src” folder, with all the other folders showing up completely fine
samme
March 5, 2025, 4:26pm
5
Are the pokeback1.png
etc. images inside the src/assets
folder in your project? Are you working from phaser-2d-multiplayer-2021-update ?
Yes, I’m working from the linked project.
Yes, they are in client\src\assets
samme
March 5, 2025, 4:39pm
7
Try
import pokeback1Url from 'assets/pokeback1.png';
// etc.
this.load.image('playerCardBack', pokeback1Url);
1 Like
I now get this when starting reloading the page?
samme
March 5, 2025, 4:49pm
9
From scenes/game.js
change the path to '../assets/pokeback1.png'
.
2 Likes
looks like that works now, many thanks!
just got to repeat this whenever I need to add any cards, correct?
1 Like
What you needed to do was only add a slash in front of src url as this;
// from this
'src/assets/~.png'
// to this
'/src/assets/~.png'
If not resolved, then try to use vite instead of snowpack.
Snowpack was not working with me, but vite was.