Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const WIDTH = 720
- const HEIGHT = 480
- const canvas = document.querySelector('#game')
- canvas.width = WIDTH
- canvas.height = HEIGHT
- const ctx = canvas.getContext('2d')
- const backdrop = new Image()
- backdrop.src = 'images/backdrop.png'
- backdrop.addEventListener('load', () => {
- drawImages()
- })
- function drawImages() {
- ctx.drawImage(backdrop, 0, 0, WIDTH, HEIGHT)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement