Can anyone please tell me what I'm doing wrong. I've tried everything (except the right way obviously!).
const c = runtime.objects.myCanvas.getFirstInstance();
//const ctx = c.getContext("2d");
c.moveTo(50,50);
c.lineTo(100,200);
c.stroke();
Getting a Construct DrawingCanvas instance will give you the IDrawingCanvasInstance interface. You can only use the documented methods there. It looks like you're mixing it up with a HTML canvas, which it is not.
— C3 doesn't use Html5 Canvas.
Develop games in your browser. Powerful, performant & highly capable.
C3 does use a HTML5 canvas for the main canvas, with a WebGL context. But DrawingCanvas is not a HTML canvas, it's a WebGL render target.
But the Html5 Canvas drawing methods aren't available without adding it somewhere else like in a script, or addon?
HTML5 canvas refers to the <canvas> element. The entire game draws in to one. Canvases can have either a WebGL context (what Construct uses), or a 2D context. If you want a 2D canvas context, you have to create your own canvas.
Thank you. I think I've understood what you're saying.