How do you make a 'move percent' block?

Specifically something like this:

move (10) percent towards x: (50) y: (0)::motion

Chase the cursor

One way is to remember what direction the sprite is pointing towards
Point towards list (50,0)
Use distance to sensing reporter to find out distance to list (50,0)
Move 10% of that distance
point in direction to original direction

I dont want my sprite to rotate during the movement

Change order to
Use distance to sensing reporter to find out 10% distance to list (50,0)
Point towards list (50,0)
Move the distance calculated
point in direction to original direction

Try it and see if you notice
Maybe wrap it in a warp

An alternative is to get distance and direction and use sin and cos to work out the x and y distances to move

Come back if not familiar with sin and cos

can you put the code in blocks

I'm an educator so I naturally want to guide you into trying to make the block without just giving you a solution

oh ok

If you make a block and it doesn't work - post a pic of it and we'll see where it's going wrong

Instead of sin and cos you can calculate the x distance to the destination and the y distance and calculate 10% of those values and then move those x and y amounts

im working on it now

thanks for the help dude
(this is the code)

looks good :slight_smile:

Why not

This block is based on the block:

move (10) steps

so we need the sine and cosine

No.

The definition of the sine for the triangle [(0,0), (sprite.x, sprite.y), (0,sprite.y)]
The angle measured at (sprite.x, sprite.y)


Thus


Of course "Whatever floats one's boat".