Discuss Scratch

PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

My browser / operating system: Windows NT 10.0, Chrome 74.0.3729.169, No Flash version detected

This is a link to the project.

Discovery
I discovered this when I was making a project which drew rainbow curves by turning around in a random way.
I wanted it to reset when it hit its own trail, because it became messy after a long time.
So, the sprite was 1x1 and bitmap.
It did not work.
I made a variable, and noticed that sometimes, when I changed from bitmap to vector, it became 0 for a split second.
I fiddled around, and guess what happened later on?

Investigation
I decided to try and figure out how this vector detector worked.
Everything I tried resulted in absolutely nothing except for that split second 0.
So I decided to investigate a different way.
I took the project, reduced its contents, and it turned out that the key to make it happen was…
if on edge, bounce
The if on edge bounce block of all things?!

Generalization
So, now I found a vector detector, but it only worked for 1x1 sprites.
I noticed that for bigger sprites, it expanded.
So maybe if I had an exact replica?
Yep, that was it. So now, I present to you, the vector detector.

Sprite1
when green flag clicked
forever
set [vector? v] to [false]
if on edge, bounce // very important for some reason
if <touching color [#000000] ?> then // backdrop color
set [vector? v] to [true]
end
end

Sprite2 (this is bitmap)
when green flag clicked
forever
go to [Sprite1 v]
end

Edit: This also works for an iPad Air.

Last edited by PkmnQ (May 28, 2019 08:26:58)

PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

bump :: motion
60 second rule??? What are you doing here???

Last edited by PkmnQ (May 28, 2019 08:24:29)

gor-dee
Scratcher
1000+ posts

Why can I make a Vector Detector?

There are some “interesting” issues with touching colour but I haven't seen this before! I noticed that if you replace touching colour with touching mouse pointer or touching tennis ball 2, it works as expected. This might be related to this https://scratch.mit.edu/projects/284523037/ which shows touching colour changes with background colour.
I'll put a link to your project in mine
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

gor-dee wrote:

There are some “interesting” issues with touching colour but I haven't seen this before! I noticed that if you replace touching colour with touching mouse pointer or touching tennis ball 2, it works as expected. This might be related to this https://scratch.mit.edu/projects/284523037/ which shows touching colour changes with background colour.
I'll put a link to your project in mine
No, I think it's seperate actually.
My hypothesis is that vector is slightly bigger than bitmap, and can touch the black backdrop.
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

bump
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

forgot to bump
CatsUnited
Scratcher
1000+ posts

Why can I make a Vector Detector?

From testing, I can confirm that no matter the size of the circle, the costume as a vector image is always +1 in width and height of the bitmapped image. This has to do with how SVG files handle having bitmapped images inside it, and I've got proof using another vector image based program - Adobe Illustrator.
So here's my bitmapped image, as you can see here:

…the image is 748 x 653 in resolution, which it will be if you download the picture I have linked. That image right now is in a bitmapped/raster format. I clicked on the Image Trace button, then Expand to turn the image into a two color vector image. Going to the transform properties, you can now see:

The image has grown by roughly 1 pixel in width and height.

So yeah there you go
--Explosion--
Scratcher
1000+ posts

Why can I make a Vector Detector?

Wierd, but cool
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

CatsUnited wrote:

From testing, I can confirm that no matter the size of the circle, the costume as a vector image is always +1 in width and height of the bitmapped image. This has to do with how SVG files handle having bitmapped images inside it, and I've got proof using another vector image based program - Adobe Illustrator.
So here's my bitmapped image, as you can see here:

…the image is 748 x 653 in resolution, which it will be if you download the picture I have linked. That image right now is in a bitmapped/raster format. I clicked on the Image Trace button, then Expand to turn the image into a two color vector image. Going to the transform properties, you can now see:

The image has grown by roughly 1 pixel in width and height.

So yeah there you go
That is what I suspected, the sprite growing slightly. Thank you.
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

bump
CatsUnited
Scratcher
1000+ posts

Why can I make a Vector Detector?

PkmnQ wrote:

bump
I thought this topic had already been solved though…
PkmnQ
Scratcher
1000+ posts

Why can I make a Vector Detector?

CatsUnited wrote:

PkmnQ wrote:

bump
I thought this topic had already been solved though…
Oh, ok.

Powered by DjangoBB