Discuss Scratch
- Firedrake969
-
Scratcher
1000+ posts
Smeef!
I mean can you detect if two shapes are touching?Looking through the code ( smeef.heliohost.org/Script.js ), I noticed you use the canvas, not jQuery. How hard is it to learn to use the <canvas> tag with JavaScript?I learned basically how to do it.
Then forgot. So yeah.
But it's pretty simple - there are all sorts of functions for drawing shapes and images and text and etc.
- AonymousGuy
-
Scratcher
1000+ posts
Smeef!
I'm pretty sure - the most rough way would just be comparing the distance between them, which is very possible.I mean can you detect if two shapes are touching?Looking through the code ( smeef.heliohost.org/Script.js ), I noticed you use the canvas, not jQuery. How hard is it to learn to use the <canvas> tag with JavaScript?I learned basically how to do it.
Then forgot. So yeah.
But it's pretty simple - there are all sorts of functions for drawing shapes and images and text and etc.
- Firedrake969
-
Scratcher
1000+ posts
Smeef!
What about rectangles, though? Or triangles? Or weird blobs?I'm pretty sure - the most rough way would just be comparing the distance between them, which is very possible.I mean can you detect if two shapes are touching?Looking through the code ( smeef.heliohost.org/Script.js ), I noticed you use the canvas, not jQuery. How hard is it to learn to use the <canvas> tag with JavaScript?I learned basically how to do it.
Then forgot. So yeah.
But it's pretty simple - there are all sorts of functions for drawing shapes and images and text and etc.
- AonymousGuy
-
Scratcher
1000+ posts
Smeef!
I said “the most rough way”.What about rectangles, though? Or triangles? Or weird blobs?I'm pretty sure - the most rough way would just be comparing the distance between them, which is very possible.I mean can you detect if two shapes are touching?Looking through the code ( smeef.heliohost.org/Script.js ), I noticed you use the canvas, not jQuery. How hard is it to learn to use the <canvas> tag with JavaScript?I learned basically how to do it.
Then forgot. So yeah.
But it's pretty simple - there are all sorts of functions for drawing shapes and images and text and etc.

A quick search found this article, it might help.
I just searched “collision detection in canvas” in Google.