Discuss Scratch

FancyPantsGames
Scratcher
2 posts

How do I use "My Blocks"

define 
stevetheplayer525
Scratcher
100+ posts

How do I use "My Blocks"

However you want to.
like this for example:
define Example
move (5) steps
if on edge, bounce

Hello. Im stevetheplayer525 i used to be pretty active here, but im kinda busy with new things, like a game made outside of scratch. but you can still check out my profile if you want, i dont care.

Also, thanks to the dummy who got the servers infested with octopi.
MathPuppy314
Scratcher
500+ posts

How do I use "My Blocks"

My blocks are used to run a lot of code in just one block.
define Fade Out
repeat (50)
change [ghost v] effect by (2)
end
This is very useful if there are multiple places when your sprite does the same thing. In that example, there are multiple times I want the sprite to fade out, so I make it into a my block. This way, instead of writing out all the code, you turn it into one block.

My blocks also have inputs. In the next example, you can tell the block how much you want it to fade out.
define Fade to (percent) %
repeat ((percent ::input) / (2))
change [ghost v] effect by (2)
end


fade to (50) % ::custom

They can also be used to run a lot of code in a single frame. By checking the box that says “Run without screen refresh” will make all of your code run without showing you all of it.

define Get out of the ground
repeat until <not <touching [ground v] ?>> //normally this would run very slowly, showing you every part
change y by (1)//____________________ but without screen refresh, it will go instantly.
end

That's pretty much everything I can think of. If you have more questions, feel free to ask!

Last edited by MathPuppy314 (Aug. 14, 2020 23:22:39)



If only I were a kumquat…
Wyan100
Scratcher
1000+ posts

How do I use "My Blocks"

They are similar to

broadcast [ v] and wait

blocks, except they can run without screen refresh and can take inputs and booleans.

"But don't quote me on it!" - Wyan100, 2020
--seaofskiis--
Scratcher
8 posts

How do I use "My Blocks"

FancyPantsGames wrote:

define 

When you make a “My Block”, it will ask for a definition. This confused me at first, until I looked inside some projects with “My block” s. To define and use a “My block”, create a string of code hanging from it. For example if you code this:

define 
say [ Hello! I am going to turn now!] for (2) secs
turn cw (50) degrees
turn cw (50) degrees
turn ccw (50) degrees
turn ccw (50) degrees
next costume

The sprite will say “hello! I am going to turn on now!”, and turn 100 degrees each way when you add that block to a line of code. “My Blocks” can be helpful when you want to repeat a certain bit of code a lot throughout a project, but do not want to code it over and over again. Think of My Blocks as fitting a lot of code into a single block.

ρɾσυԃ ƈԋɾιʂƚιαɳ>>αƈƚιɳɠ>>@skiidreams->>ϝɾιҽɳԃʅყ>>ʂƙιι<<ιɱρҽɾϝҽƈƚ<<@iiks<<ɯɾιƚιɳɠ
RedScarGoldFire2021
Scratcher
17 posts

How do I use "My Blocks"

define change colour
change [colour] effect by (25)



It makes your code run faster, I guess

Last edited by RedScarGoldFire2021 (Jan. 19, 2022 15:24:02)

Coder046
Scratcher
100+ posts

How do I use "My Blocks"

Yes! This is how you use them. They can be very useful at times. For example,
define Check Collisions
Move (1) steps
if <touching [Level v] ?> then
Move (-1) steps
end

If “run without screen refresh” is checked, then this can run in a single frame of your game. They can also have inputs of both the reporter type which looks like this
(reporter::operators)
and the boolean type which looks like this.
<boolean::operators>
They will be available to be dragged out of the definition block into the rest of the definition to control how the block functions.

[Don't worry, those evil kumquats hate fully written, grammatically correct sentences.]
Hello! I'm Coder046, a Scratcher who likes lists, Minecraft projects (as long as they have more than just a few blocks), and making helpful collections of things such as sounds and costumes collected from the Scratch website. If you need help sorting through lists, please ask. If you need some Minecraft block textures, I may be able to help you.
Here's one of my most viewed projects, with more than 400 views: 2D Minecraft World
Isn't it amazing? I guess that since it has so many blocks (there are 1.16 blocks in there, which I hardly have seen elsewhere), people enjoyed it. Please note that it isn't a tile scrolling game; it's more of a screen-changing platformer.
Here's a 2D Minecraft designer that was used to make the 2D world.
Please contact me if you need help with list or Minecraft things! I have a 2D Minecraft shop now open, along with a Pen Animation shop.
wetsoggydoggy
Scratcher
22 posts

How do I use "My Blocks"

You can make your own blocks to start new code. If there isn't a block for something, instead of writting the whole script again, use my blocks.
bubbikins
Scratcher
13 posts

How do I use "My Blocks"

“i wanna make a walking animation but i don't wanna keep moving the ‘next costume’ blocks”
“i know what to do! i'll use blocks!”
define walk (amount of times)
switch costume to [costume thingy walk v]
wait (0.1) secs
next costume
wait (0.1) secs
switch costume to [etc etc v]
blocks are used to run a specific bit of code every time it's used. it's like broadcasts, but with inputs.

Last edited by bubbikins (Jan. 20, 2022 23:18:59)


Ruh roh raggy
goodpersonsowow
Scratcher
97 posts

How do I use "My Blocks"

To make a block, go to the my blocks category and click “make a block”. Give your block a name. There are four options: add a number or text input, add a boolean input, adding a label text, and run without screen refresh. Adding a number or text input can accept any characters. Adding a boolean input can only accept predicates. Adding a label text is like you put some inputs and you want to put more text. Now, the run without screen refresh runs the block without updating the screen. Click “Okay” when you are done. Now you have a block
custom block::custom
and
define custom block
Number or text inputs can go inside anything circular. Boolean inputs can go inside anything hexogonal or circular.
Number or text inputs look like this:
(number or text::custom)
And boolean inputs look like this:
<boolean::custom>

Last edited by goodpersonsowow (Jan. 21, 2022 11:21:12)


____________________________________________________________________________________________________________________________
when green flag clicked
say[This is a signature. It goes at the bottom of every post I make.]
Learn more about them here.
My profile page l My projects l Studios I curate l Sin, cos, and tan of an angle l Paint l Touchlete!

Powered by DjangoBB