how to get distance plus distance traveled
id: 751266
category: Help with Scripts
posts: 19
Mar 30, 2024 19:41:55
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
a sprite in my game will travel to a point on the map, how can i get its distance traveled, and the total distance from point A to B, into two variables
Mar 30, 2024 19:58:04
how to get distance plus distance traveled
view on scratch
view on legacy ocular
invalidaccess
loading
i think i figured out
https://scratch.mit.edu/projects/992294177/
check this out
and ask me if you have any question
https://scratch.mit.edu/projects/992294177/
check this out
and ask me if you have any question
Mar 30, 2024 20:05:12
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
so the distance traveled thing is all good, but when i said total distance i mean like the distance inbetween point a and b
Mar 30, 2024 20:11:38
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
What is the feature that will use this? Don't get caught up in the x y problem. However, you can try this:
In point A
In the sprite that should move,
HOWEVER, I guarantee that there is a better solution to your problem than using these blocks/this method.
In point A
(distance to [point b v])will give you the distance from point a to point b.
In the sprite that should move,
(distance to [point a v])will give you how far the sprite has traveled.
HOWEVER, I guarantee that there is a better solution to your problem than using these blocks/this method.
Mar 30, 2024 20:12:04
how to get distance plus distance traveled
view on scratch
view on legacy ocular
invalidaccess
loading
so the distance traveled thing is all good, but when i said total distance i mean like the distance inbetween point a and b[/quoi meso the distance traveled thing is all good, but when i said total distance i mean like the distance inbetween point a and b
i mean isnt the distance between point A and B just distance traveled?
that shows the distance for each time you move
Mar 30, 2024 20:14:11
how to get distance plus distance traveled
view on scratch
view on legacy ocular
invalidaccess
loading
x y problem. However, you can try this:to use “distance to ()” block you just need another sprite to find the distance What is the feature that will use this? Don't get caught up in the
In point A(distance to [point b v])will give you the distance from point a to point b.
In the sprite that should move,(distance to [point a v])will give you how far the sprite has traveled.
HOWEVER, I guarantee that there is a better solution to your problem than using these blocks/this method.
Mar 30, 2024 20:32:29
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
bruh i completley forgot that block existed thanks guys
Mar 30, 2024 20:38:21
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
For finding the distance between two points you can use the distance formula. This should work for both finding the distance between the two points but also the distance the sprite has traveled.
PS: once again make sure you're not running into the x y problem
PS: once again make sure you're not running into the x y problem
Mar 30, 2024 20:41:17
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
ok so i made the code block but it wont change the size of it at all
also i made an object go to the landing spot and make a variable that is the total distance from a to b
heres the code i made:
im not good with these scratchblocks btw
also i made an object go to the landing spot and make a variable that is the total distance from a to b
heres the code i made:
im not good with these scratchblocks btw
set size to ((([sin v] of ((((distance to [player v])::#6f6f6f) * (90)) / (total distance::#6f6f6f))) * (125)) + (75)) %
Mar 30, 2024 20:43:33
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
There's a limit to how small or large a sprite can be. The solution depends on if you want to make it bigger or smaller.
PS: hit the green checkmark when writing a post to preview what the scratchblocks will look like
PS: hit the green checkmark when writing a post to preview what the scratchblocks will look like
Mar 30, 2024 20:44:46
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
There's a limit to how small or large a sprite can be. The solution depends on if you want to make it bigger or smaller.
PS: hit the green checkmark when writing a post to preview what the scratchblocks will look like
both?? its just growing to 200 until it hits the midpoint then shrinks to 75
Mar 30, 2024 20:48:17
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
What do you want it to do- grow as it goes to point b? If so, that sin block is messing it up.
Mar 30, 2024 20:49:41
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
What do you want it to do- grow as it goes to point b? If so, that sin block is messing it up.
grow as it goes to point b, but shrinks after hitting the midpoint of its travel line
Mar 30, 2024 20:49:50
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
removed bc it was not what you wanted… working on it rn
Mar 30, 2024 20:53:37
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
ok
Mar 30, 2024 21:08:51
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
here you go! https://scratch.mit.edu/projects/992320503/
Mar 30, 2024 21:11:36
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
thanks, & how can i customize this and cap the size
Mar 30, 2024 21:33:25
how to get distance plus distance traveled
view on scratch
view on legacy ocular
rendered_fox1
loading
it only grew and didnt shrink, for some reason i switched it to floor and it does shrink now, but it starts too small and its peak is also too small, how do i make it so it starts on 75% size
Mar 30, 2024 22:02:13
how to get distance plus distance traveled
view on scratch
view on legacy ocular
MrKingofScratch
loading
You switched what to floor?
also if you're using my project, add 75 to the size, and instead of multiplying the size by 100, multiply it by 25. This will make it so that the distance affects a range from 0 to 25, and adding 75 makes it so it starts at 75. If you want me to do this let me know.
also if you're using my project, add 75 to the size, and instead of multiplying the size by 100, multiply it by 25. This will make it so that the distance affects a range from 0 to 25, and adding 75 makes it so it starts at 75. If you want me to do this let me know.