0

Can anyone tell me why this doesn't work?

I feel dumb not being able to figure out why this doesn't work. Your help would would be much appreciated. Edit: Nevermind I'm dumb let cvs; let ctx; let paddleX = 0; let paddleY; let paddleW = 10; let paddleH = 50; window.onload = function(){ cvs = document.getElementById('myC'); ctx = cvs.getContext('2d'); cvs.width = window.innerWidth; cvs.height = window.innerHeight; drawE(); } function draw(rectX, rectY, rectW, rectH, color){ ctx.fillStyle = color; ctx.fillRect(rectX, rectY, rectW, rectH); } function drawE(){ draw(paddleX, cvs.width/2, paddleW, paddleH, 'white'); }

14th Dec 2019, 8:10 AM
Lemonades For Sale
Lemonades For Sale - avatar
2 Answers
0
Make this Code in Sololearn Playground and share here.
14th Dec 2019, 8:41 AM
A͢J
A͢J - avatar
0
I'm just dumb and didnt realize that I put cvs.width/2 instead of cvs.height/2. Still, thanks.
14th Dec 2019, 8:44 AM
Lemonades For Sale
Lemonades For Sale - avatar