0

The red circle in the game development with JS I can't get past it

17th Jun 2022, 6:15 PM
Oluwatosin Adu
Oluwatosin Adu - avatar
7 Answers
+ 3
try this : window.onload = function() { var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); function fCircle(x, y, radius, color) { context.fillStyle = color; context.arc(x, y, radius, 0, 2 * Math.PI); context.fill(); } fCircle(300, 350, 50, 'red');}
17th Jun 2022, 6:40 PM
**🇦🇪|🇦🇪**
**🇦🇪|🇦🇪** - avatar
+ 1
Should I post the error message or the whole code
17th Jun 2022, 6:27 PM
Oluwatosin Adu
Oluwatosin Adu - avatar
+ 1
Thanks it worked
17th Jun 2022, 6:50 PM
Oluwatosin Adu
Oluwatosin Adu - avatar
0
Not that i could help you, but it is probably worth it going a bit more into detail what exactly you have a problem with and especially what you already tried so far
17th Jun 2022, 6:23 PM
Alexander Thiem
Alexander Thiem - avatar
0
Depends how long the code is, but if you save it in code pkayground and insert the link here probably the whole code should work…
17th Jun 2022, 6:28 PM
Alexander Thiem
Alexander Thiem - avatar
0
var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var x = 300; var y = 350; context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle="red"; context.fill();
17th Jun 2022, 6:29 PM
Oluwatosin Adu
Oluwatosin Adu - avatar
0
So uncaught type Error in the get context line
17th Jun 2022, 6:30 PM
Oluwatosin Adu
Oluwatosin Adu - avatar