Find an Image for the Background of your game
1. Upload an Image to Repl
- Find the downloaded images. Need help?
- Open the asset folder in repl, click:
code > client > asset
- Click and drag your files into this folder. Make sure your files are named something very easy and obvious (it is best to not use spaces or symbols), for example “zombies.png” or “shark.png”. You will resize the images within the code, so don’t worry if it seems to big or small right now.
2. Go into the preload
function in game.js
and add a new image named after the new character set.
code/client/src/game.js
g.loadImage('background', 'grass.jpg');
3. In game.js
, Add drawBackground
function in the create
function
code/client/src/game.js
g.drawBackground('background', 0.8);
Download your zip, and upload it to blobbert.io, and you should have a background!