Discuss Scratch

galactic_cartoonist1
Scratcher
21 posts

simple 'Slide to x:() y:() for () secs' block

It's like a smooth movement script, but a simple block to just place
Like moving with friction
as displayed in this
smooth movement project

when [a v] key pressed
move smoothly x:(xPos) y:(yPos) for (#) seconds

NOT THE GLIDE BLOCK
glide () secs to x: (0) y: (0)
i hate this block
Evanzap
Scratcher
100+ posts

simple 'Slide to x:() y:() for () secs' block

oh you mean like get faster as it goes on until it gets to where you said?
7salad3salad
Scratcher
1000+ posts

simple 'Slide to x:() y:() for () secs' block

i think i understand… its a smooth walking block.. right? so maybe like

when [a v] key pressed
walk smoothy (#) steps [left v]::motion
and if not then uhh.. please try make it more clear

Nevermind, I just saw your example project

Last edited by 7salad3salad (May 6, 2021 18:04:39)

7salad3salad
Scratcher
1000+ posts

simple 'Slide to x:() y:() for () secs' block

So a block like this?

slide [ ] secs to x: [ ] y: [ ]::motion

Semi support. It can already be done with the script in the project, but it could be useful to newer/younger scratchers.

Last edited by 7salad3salad (May 6, 2021 18:09:04)

galactic_cartoonist1
Scratcher
21 posts

simple 'Slide to x:() y:() for () secs' block

Evanzap wrote:

oh you mean like get faster as it goes on until it gets to where you said?
example:
move fast at first but slow down the closer you get to the position you specify. i don't do *big* code blocks (check of my pfp its all simple), so I just want a simple block to slide to a postition.
-Qlec-
Scratcher
100+ posts

simple 'Slide to x:() y:() for () secs' block

It's not hard to create, and you can easily create a custom block and backpack it
galactic_cartoonist1
Scratcher
21 posts

simple 'Slide to x:() y:() for () secs' block

7salad3salad wrote:

So a block like this?

slide [ ] secs to x: [ ] y: [ ]::motion

Semi support. It can already be done with the script in the project, but it could be useful to newer/younger scratchers.
just like that - exactly - 100% yush
i just need a simple block without needing 20 blocks of code to move 100 steps *smoothly*
it's just hard for me
galactic_cartoonist1
Scratcher
21 posts

simple 'Slide to x:() y:() for () secs' block

-Qlec- wrote:

It's not hard to create, and you can easily create a custom block and backpack it
it's hard for me tho
ScratchCat1038
Scratcher
1000+ posts

simple 'Slide to x:() y:() for () secs' block

Here is a workaround:
define slide (secs) secs to x: (x) y: (y)
repeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>
change x by (((x) - (x position)) / ((secs) * (10)))
change y by (((y) - (y position)) / ((secs) * (10)))
end
galactic_cartoonist1
Scratcher
21 posts

simple 'Slide to x:() y:() for () secs' block

thank you so much holy moly

ScratchCat1038 wrote:

Here is a workaround:
define slide (secs) secs to x: (x) y: (y)
repeat until <<(round (x position)) = (round (x))> and <(round (y position)) = (round (y))>>
change x by (((x) - (x position)) / ((secs) * (10)))
change y by (((y) - (y position)) / ((secs) * (10)))
end
fdreerf
Scratcher
1000+ posts

simple 'Slide to x:() y:() for () secs' block

The slide block has a problem in that there are two parameters the example project has that the block doesn't, which we'll call the “threshold” and the “friction factor”. The threshold is the 5 you see in the example project that determines when the sprite should come to a complete stop, and the factor is that 10 which the distance is divided by and determines how fast the sprite decelerates. A block that accounts for all of this would have an unwieldy 5 inputs and without them there is far less control.

Powered by DjangoBB