Discuss Scratch

JungleHornet
Scratcher
5 posts

Gliding to my mouse

Is there a way to make a sprite glide to my mouse at a set speed until it gets to my mouse whenever I press space?

Check out my game, Surf.io! https://scratch.mit.edu/projects/597357239
mrcreatorluigi
Scratcher
1000+ posts

Gliding to my mouse

I think this script might work:

forever
if <key [space v] pressed?> then
glide () secs to [mouse pointer v]::motion
end
end

if i was in aladdin, my first wish would be to have infinite wishes, and use those infinite wishes for infinite wishes on each wish, rince and repeat
JungleHornet
Scratcher
5 posts

Gliding to my mouse

mrcreatorluigi wrote:

I think this script might work:

forever
if <key [space v] pressed?> then
glide () secs to [mouse pointer v]::motion
end
end
the problem with that is that would glide to my mouse over a second, going different speeds depending on how far away my mouse is. I want something to gile to my mouse at the same speed every time, regardless of how long it would take to get there.

Check out my game, Surf.io! https://scratch.mit.edu/projects/597357239
JungleHornet
Scratcher
5 posts

Gliding to my mouse

nevermind

Check out my game, Surf.io! https://scratch.mit.edu/projects/597357239
supergamer10000
Scratcher
1000+ posts

Gliding to my mouse

JungleHornet wrote:

nevermind
Did that work?

Ask yourself, if you were hacked and lost hours, upon hours of work, would you regret not having a strong password that only takes 5 minutes to make?

Is it time to update your password? Here are some tips to make a strong password:

Length: The longer the password, the stronger it is. A password that is at least 12 characters long.
Complexity: Combination of upper and lowercase letters, numbers, and symbols to make it harder to crack.
Uniqueness: Don't use easily guessable information like your name, address, or date of birth. Also, avoid using the same password for multiple accounts.
Passphrases: A phrase made up of random words, numbers, and symbols, as these can be easier to remember but still secure.
Randomness: Use a random password generator to create a unique and unpredictable password.
Regular updates: Regularly change your passwords to stay ahead of potential security threats.

Remember, the goal is to create a password that is strong, unique, and difficult for others to guess.

I would estimate more than 40% of scratchers have passwords that are hard to guess by a human, but easy to guess by a computer. You never know if today would be the day you lose everything.

Even if just one person was saved from losing hours and hours of work, my mission is accomplished.
JungleHornet
Scratcher
5 posts

Gliding to my mouse

supergamer10000 wrote:

JungleHornet wrote:

nevermind
Did that work?
no i just decided to go with a different movement system in my game.

Check out my game, Surf.io! https://scratch.mit.edu/projects/597357239
AwezomeXD
Scratcher
100+ posts

Gliding to my mouse

JungleHornet wrote:

supergamer10000 wrote:

JungleHornet wrote:

nevermind
Did that work?
no i just decided to go with a different movement system in my game.
Oh, well if you still want to attempt the old movement system this script might work (the decimal in the multiplication block controls the speed) Completely misread your post, sorry, this code below won't work in your case.

when green flag clicked
forever
if <key [space v] pressed?> then
change x by (((mouse x) - (x position)) * (0.1)
change y by (((mouse y) - (y position)) * (0.1)
end
end

However, if you don't mind changing the direction of your sprite, you could probably do this for the sprite to move at a consistent speed:

when green flag clicked
forever
if <key [space v] pressed?> then
point in direction (mouse pointer v)
move (...) steps
end
end

Last edited by AwezomeXD (Nov. 12, 2021 16:23:55)


Hooplah

Powered by DjangoBB