Discuss Scratch

floppaisbad
Scratcher
15 posts

pen tool collision

how do i make pen tool collision
MineTurte
Scratcher
500+ posts

pen tool collision

floppaisbad wrote:

how do i make pen tool collision
Just repurpose a normal collision engine and add a pen to it. If you need help with that just ask.

Hope this helps!

(pronouns are she/her). Advanced Alpha Game Studios Manager; website: https://aags2.w3spaces.com
This is JuniperActias. AKA Moth mommy. If I helped you out consider following Juni-Bug (my new account)!




If you found this secret, say uwu
Signature gradients here













floppaisbad
Scratcher
15 posts

pen tool collision

i have tried doing if touching color dont fall and stuff like that but that did not work
sashimiricedev
Scratcher
100+ posts

pen tool collision

If your project is 100% pen, you will need to use AABB collision, as the
<touching [ v] ?>
is literally useless for pen.

Basically, in an AABB world, everything is a rectangle or square.

We can check if any face intersects the other.

AABB is kinda difficult to put in scratch, so this video might help.
https://www.youtube.com/watch?v=oOEnWQZIePs



forum helper
Forum Post Demos
I follow most of the discussions I post on, so feel free to reply back if you have any further questions.
-stxllxr
New to Scratch
100+ posts

pen tool collision

sashimiricedev wrote:

AABB is kinda difficult to put in scratch, so this video might help.
It may be to you, although once you understand it it's incredibly simple. I made the collision detection in 40 blocks here, and it actually took longer to learn how to use the rectangle filler in the project than it did to make the collision detection.

How it works is basically it checks for if the first x of the second rectangle is bigger than the second x of the first rectange, and does the same for y. The if-elses are used to determine which rectange is first on the y and x axes, although there might be a better method.

Last edited by -stxllxr (April 7, 2024 20:40:03)

SneakyDJ
Scratcher
4 posts

pen tool collision

I searched Google and found this:
when green flag clicked
if <color [#6caed4] is touching [#1a86a7] ?> then
<<pen up> or <clear>>

end

Last edited by SneakyDJ (April 7, 2024 20:48:26)

--CHA0S--
Scratcher
100+ posts

pen tool collision

You could also use the distance formula and detect collisions that way. That’s how I do it at least

Hi

Trying to become a forum helper
malicondii
Scratcher
100+ posts

pen tool collision

--CHA0S-- wrote:

You could also use the distance formula and detect collisions that way. That’s how I do it at least
That's only viable for circular collisions, the corners of squares and the longer, or shorter, sides of rectangles will be inaccurate, and good luck with irregular polygons lol.

Last edited by malicondii (April 7, 2024 21:38:02)

--CHA0S--
Scratcher
100+ posts

pen tool collision

malicondii wrote:

--CHA0S-- wrote:

You could also use the distance formula and detect collisions that way. That’s how I do it at least
That's only viable for circular collisions, the corners of squares and the longer, or shorter, sides of rectangles will be inaccurate, and good luck with irregular polygons lol.
Fair enough

Hi

Trying to become a forum helper

Powered by DjangoBB