A tutorial to images, sprites, and other things

I decided I wanted to do another one of these.

So, what are images? They are, well, images.

image

You can draw stuff using them and assign a it to a sprite so it actually looks like something.

The other thing is about the rest of the image category.

How about we break it down into a couple parts?

Create

There are 5 blocks in the “Create” section of the Images tab.

The first block. You can click on the gray rectangle to draw something.

The 2nd block. It creates a rectangle with the given width and height. However, this image will be transparent. How do we fix this? We’ll get to that in a sec.

The 3rd block. It just clones the image.

The 4th block. It returns the entire current screen image. Everything that is on that screen right now.

And the 5th block. Returns the length or width of the image.

Drawing

Yes, the first block is what you use to fill the entire image with the color you want. So, in the example mySprite’s image will be completely transparent.

The 2nd block. Returns the pixel’s color at a given point in an image.

The 3rd block. Pretty self-explanitory if you ask me. But, this block sets a pixel’s color in an image to another one.

The 4th block. Draws a rectangle in an image at a given point with the given dimensions, and outlines it that color.

The 5th block. Draws a line from one point to another with the given color.

The 6th block. Fills the rectangle that you drew with the fourth block with a given color.

The 7th block. Draws an image onto the current image.

Transformations

The 1st block. changes all of one color in an image to another.

The 2nd and 3rd block. Flips the image vertically and horizontally respectively. They basically act like this

image

And finally, this block.

Returns true if both images are the same. And if you’re thinking “Why can’t I do this?”

It doesn’t work for some reason. You just have to use that block.

And this tutorial isn’t over just yet. You can use the

image

block to make the sprite a rectangle so you don’t have to manually do it.

Aaaaaand I just realized that richard did something similar to this but I hope this was insightful anyways.

6 Likes

cool stuff

I discovered images tab a month or 2 ago and have been abusing it ever since

1 Like

It does work, I think you’re just doing it wrong

1 Like

How are you doing it?

Oh shoot I was wrong this creates an rectangle that’s already filled

1 Like

like this
https://arcade.makecode.com/S42314-40433-93902-37622

By default, when using the normal == comparison, the objects are compared, not the contents, so it only returns true if you are comparing a specific image object to itself:

3 Likes

Aah that’s why I have to compare the x and y of an interface instead of using object ==otherobject

1 Like