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.
game.js, Go into the
preload() function in
game.js and add a new image named after the new character set.
drawBackground() function in the
g.drawBackground('grass', 1, 2000, 2000);
setBounds() inside the
onInit() function to set the boundaries of the game.
Make sure that you write it after your
setupfunction or else it will break your game. You can change the numbers to make the bounds whatever size you want.