Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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");
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.
davesalt C3 doesn't use Html5 Canvas.
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.
Develop games in your browser. Powerful, performant & highly capable.
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.