Discuss Scratch
- FF76YT
-
Scratcher
13 posts
New Coding Block [glide block with steps]
I have a project and there is a glitch that i cannot fix, but you can make a new block. Can you make a glide block with steps? Here is how I imagine the block:
Glide _ seconds _ Steps
If you add this in scratch, thank you.
Glide _ seconds _ Steps
If you add this in scratch, thank you.
- -ShadowOfTheFuture-
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
Does this block mean, keep moving a fixed amount of steps per frame for (number) seconds? Or would it instead take (number) seconds to move the fixed number of steps?
- Botcho_Otkho
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
Number seonds
TO move the number of stepsThat still doesn't explain…
- python_megapixel
-
Scratcher
500+ posts
New Coding Block [glide block with steps]
Do you mean like
but with gliding?
move (10) steps
but with gliding?
- wWSunPandaWw
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
yes
glide (10) secs to x: (0) y: (0)Why isn't this suffice? You either want to glide or move steps, there's no way to do two at once.
Last edited by wWSunPandaWw (April 27, 2018 14:42:00)
- Botcho_Otkho
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
yesPlease, use the quote button next time that you're answering to someone.
- FF76YT
-
Scratcher
13 posts
New Coding Block [glide block with steps]
yesglide (10) secs to x: (0) y: (0)Why isn't this suffice? You either want to glide or move steps, there's no way to do two at once.
I want to glide a certain amount of steps
- _nix
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
For now, I know this is a really complicated block, but this might work for you:
You'll need to replace those 50s with the distance you want to go, and the 10 with the time (of course). Also, you won't find the “cos” and “sin” blocks in the block list; you need to take out an “abs” block instead (it's at the very bottom of the Operators list), then click the dropdown and change it to “cos” or “sin”.
Here's what the block looks like in another version of Scratch with easier-to-see blocks, if you're having trouble putting it together:

Have you heard of custom blocks? You could use a custom block to make this a bit simpler:
Then you just use the “glide secs steps” block the same way you would any other block:
(Edit: fill in [scratchblocks] tag after I forgot to, oops!)
glide (10) secs to x: ((x position) + ((50) * ([cos v] of (direction)))) y: ((y position) + ((50) * ([sin v] of (direction))))
You'll need to replace those 50s with the distance you want to go, and the 10 with the time (of course). Also, you won't find the “cos” and “sin” blocks in the block list; you need to take out an “abs” block instead (it's at the very bottom of the Operators list), then click the dropdown and change it to “cos” or “sin”.
Here's what the block looks like in another version of Scratch with easier-to-see blocks, if you're having trouble putting it together:

Have you heard of custom blocks? You could use a custom block to make this a bit simpler:
define glide (time) secs (dist) steps
glide (time) secs to x: ((x position) + ((dist) * ([cos v] of (direction)))) y: ((y position) + ((dist) * ([sin v] of (direction))))
Then you just use the “glide secs steps” block the same way you would any other block:
glide (10) secs (50) steps :: custom
(Edit: fill in [scratchblocks] tag after I forgot to, oops!)
Last edited by _nix (April 27, 2018 23:08:15)
- Botcho_Otkho
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
It doesn't, because you have to glide with steps to those cordinates, and will require a block likerepeat (10)This should work
move (10) steps
end
point to x (10) y (10)::motion
- FF76YT
-
Scratcher
13 posts
New Coding Block [glide block with steps]
For now, I know this is a really complicated block, but this might work for you:Can you put a new post with the edit
Then you just use the “glide secs steps” block the same way you would any other block:
Last edited by FF76YT (April 29, 2018 20:22:27)
- _nix
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
Oops, I'm sorry I phrased my sentence badly. I meant that I, myself, had fixed a typo in my post. So you don't need to worry about it; my complete post is already thereFor now, I know this is a really complicated block, but this might work for you:Can you put a new post with the edit
Then you just use the “glide secs steps” block the same way you would any other block:

- FF76YT
-
Scratcher
13 posts
New Coding Block [glide block with steps]
It doesn't workOops, I'm sorry I phrased my sentence badly. I meant that I, myself, had fixed a typo in my post. So you don't need to worry about it; my complete post is already thereFor now, I know this is a really complicated block, but this might work for you:Can you put a new post with the edit
Then you just use the “glide secs steps” block the same way you would any other block:
Can you help?
- _nix
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
It doesn't workOkay! Try this project: https://scratch.mit.edu/projects/219579017/#editor
Can you help?
You can drag the big “define glide” script into your backpack, then put it into your own project. Here is a video showing you how to use the backpack: https://www.youtube.com/watch?v=1T4pOTHlHfM
(That video shows you how to use the backpack with sprites, but it works the same way for scripts.)
Once you have the “define glide” script in your own project, you can find the block in the “More Blocks” list, which is at the very end of the category list:

- FF76YT
-
Scratcher
13 posts
New Coding Block [glide block with steps]
Thanks!
One more thing, can you add this block into scratch so I don't always have to type this in?
One more thing, can you add this block into scratch so I don't always have to type this in?
- _nix
-
Scratcher
1000+ posts
New Coding Block [glide block with steps]
Thanks!There's not really a way to do that, unfortunately. But once you have the “define” script in your backpack, you can always drag it out whenever you want.
One more thing, can you add this block into scratch so I don't always have to type this in?





