pen tool collision

id: 752710

category: Help with Scripts

posts: 9

floppaisbad floppaisbad loading
how do i make pen tool collision
MineTurte MineTurte loading

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!
floppaisbad floppaisbad loading
i have tried doing if touching color dont fall and stuff like that but that did not work
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


-stxllxr -stxllxr loading

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.
SneakyDJ SneakyDJ loading
I searched Google and found this:
when green flag clicked
if <color [#6caed4] is touching [#1a86a7] ?> then
<<pen up> or <clear>>

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

--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.
--CHA0S-- --CHA0S-- loading

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