Discuss Scratch

linenum
New Scratcher
10 posts

Point to destination while gliding to a position?

Hi is there a way to make a sprite point in the direction of the destination when using “glide”? Thanks.
XxWebWorldxX
Scratcher
18 posts

Point to destination while gliding to a position?

You can make a new sprite (destination), make a sprite point towards (destination) and glide towards (destination)

point towards [destination]
glide () secs to [destination]
linenum
New Scratcher
10 posts

Point to destination while gliding to a position?

Hi I'm using dozens of clones so I guess that might mean spawning extra sprites?

Last edited by linenum (April 25, 2020 01:02:43)

linenum
New Scratcher
10 posts

Point to destination while gliding to a position?

Hi I worked it out myself…. I made a script that converts x and y offsets to degrees. People can let me know if they have any improvements…

https://scratch.mit.edu/projects/388774896/

define Get direction
if <[y] = [0]> then
if <> then
else
end
else

end

Last edited by linenum (April 25, 2020 03:19:40)

linenum
New Scratcher
10 posts

Point to destination while gliding to a position?

See:
https://scratch.mit.edu/projects/388774896/

define Get direction
if <[y] = [0]> then
if <[x] < [0]> then
set [calculated direction] to [-90]
else
set [calculated direction] to [90]
end
else
set [calculated direction] to ([atan] of ((x) / (y)))
end
if <[y] < [0]> then
change [calculated direction] by [180]
end
Oumuamua
Scratcher
1000+ posts

Point to destination while gliding to a position?

So did you solve the problem?

Please edit the topic title adding something like RESOLVED.

Thanks.
linenum
New Scratcher
10 posts

Point to destination while gliding to a position?

Oumuamua wrote:

So did you solve the problem?

Please edit the topic title adding something like RESOLVED.

Thanks.
Yes - I can't seem to edit my first post.

Powered by DjangoBB